From 4ae7a32e29c1e69539611a88a466d2274ac57054 Mon Sep 17 00:00:00 2001 From: Ali Sheikh Taheri Date: Mon, 14 Nov 2016 11:54:42 +0000 Subject: [PATCH 01/12] Fix for maximum file size. --- src/Umbraco.Web.UI/config/log4net.Release.config | 3 ++- src/Umbraco.Web.UI/config/log4net.config | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/config/log4net.Release.config b/src/Umbraco.Web.UI/config/log4net.Release.config index 10b8c9eb7a..54a0e23ab2 100644 --- a/src/Umbraco.Web.UI/config/log4net.Release.config +++ b/src/Umbraco.Web.UI/config/log4net.Release.config @@ -10,7 +10,8 @@ - + + diff --git a/src/Umbraco.Web.UI/config/log4net.config b/src/Umbraco.Web.UI/config/log4net.config index eca84962a1..382f886adc 100644 --- a/src/Umbraco.Web.UI/config/log4net.config +++ b/src/Umbraco.Web.UI/config/log4net.config @@ -10,7 +10,8 @@ - + + From 3aaa33ebe97adc585936fbe51fae65bc5840dc4c Mon Sep 17 00:00:00 2001 From: Ali Sheikh Taheri Date: Mon, 14 Nov 2016 11:55:09 +0000 Subject: [PATCH 02/12] added .log file extension for backup logs. --- src/Umbraco.Web.UI/config/log4net.Release.config | 2 +- src/Umbraco.Web.UI/config/log4net.config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/config/log4net.Release.config b/src/Umbraco.Web.UI/config/log4net.Release.config index 54a0e23ab2..d77e3f9c0d 100644 --- a/src/Umbraco.Web.UI/config/log4net.Release.config +++ b/src/Umbraco.Web.UI/config/log4net.Release.config @@ -11,7 +11,7 @@ - + diff --git a/src/Umbraco.Web.UI/config/log4net.config b/src/Umbraco.Web.UI/config/log4net.config index 382f886adc..28d454165d 100644 --- a/src/Umbraco.Web.UI/config/log4net.config +++ b/src/Umbraco.Web.UI/config/log4net.config @@ -11,7 +11,7 @@ - + From 19b24b5109db7767ff5b2868f9e2313c1c744f9c Mon Sep 17 00:00:00 2001 From: Ali Sheikh Taheri Date: Mon, 14 Nov 2016 11:56:21 +0000 Subject: [PATCH 03/12] Added maximum number of backups to keep. --- src/Umbraco.Web.UI/config/log4net.Release.config | 9 +++++---- src/Umbraco.Web.UI/config/log4net.config | 13 +++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Umbraco.Web.UI/config/log4net.Release.config b/src/Umbraco.Web.UI/config/log4net.Release.config index d77e3f9c0d..e657394df7 100644 --- a/src/Umbraco.Web.UI/config/log4net.Release.config +++ b/src/Umbraco.Web.UI/config/log4net.Release.config @@ -1,18 +1,19 @@ - + - + + @@ -28,6 +29,6 @@ - - + + diff --git a/src/Umbraco.Web.UI/config/log4net.config b/src/Umbraco.Web.UI/config/log4net.config index 28d454165d..0834e2b090 100644 --- a/src/Umbraco.Web.UI/config/log4net.config +++ b/src/Umbraco.Web.UI/config/log4net.config @@ -1,18 +1,19 @@ - + - + - - + + + @@ -28,6 +29,6 @@ - - + + \ No newline at end of file From 5c40a1f9e914a888f4adade726a21948b35369c7 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 19 Dec 2016 16:42:05 +1100 Subject: [PATCH 04/12] bumps version --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 4 ++-- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index df03fe8381..78653d30ea 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,2 +1,2 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) -7.5.5 \ No newline at end of file +7.5.7 \ No newline at end of file diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index b3b5633864..3a27c3ddb2 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -11,5 +11,5 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("7.5.5")] -[assembly: AssemblyInformationalVersion("7.5.5")] \ No newline at end of file +[assembly: AssemblyFileVersion("7.5.7")] +[assembly: AssemblyInformationalVersion("7.5.7")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index ccf4aecf13..86c64872ff 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration { public class UmbracoVersion { - private static readonly Version Version = new Version("7.5.5"); + private static readonly Version Version = new Version("7.5.7"); /// /// Gets the current version of Umbraco. diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index c8c90c2ed5..6c46ff0f80 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -2415,9 +2415,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\" True True - 7550 + 7570 / - http://localhost:7550 + http://localhost:7570 False False From 347ed2896a8baed06432cdd96724e07ecac5289d Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 19 Dec 2016 16:58:24 +1100 Subject: [PATCH 05/12] U4-9282 Rollback not working --- src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index e9a4652512..90f005f68e 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -851,7 +851,8 @@ order by umbracoNode.level, umbracoNode.parentID, umbracoNode.sortOrder"; if (withCache) { var cached = RuntimeCache.GetCacheItem(GetCacheIdKey(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; From c8f0f05570a4d41b3552384aac059e81b40aa664 Mon Sep 17 00:00:00 2001 From: Shannon Date: Mon, 19 Dec 2016 17:10:29 +1100 Subject: [PATCH 06/12] U4-9246 Should ship with numRecompilesBeforeAppRestart="50" to avoid max recompilations reached errors --- src/Umbraco.Web.UI/web.Template.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index ec7948a09a..09df754e74 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -119,7 +119,7 @@ - + From a058f2646278484c622b421836df76de29618b2c Mon Sep 17 00:00:00 2001 From: hartvig Date: Mon, 19 Dec 2016 09:20:21 +0100 Subject: [PATCH 07/12] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e9be6cb5f..1d42543eb3 100644 --- a/README.md +++ b/README.md @@ -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) [![ScreenShot](vimeo.png)](https://vimeo.com/172382998/) From da27108d0d82655d7ec3757859e76690986bceae Mon Sep 17 00:00:00 2001 From: Niels Hartvig Date: Mon, 19 Dec 2016 10:44:22 +0100 Subject: [PATCH 08/12] Updates login controller to not accept non local urls --- .../Controllers/UmbLoginController.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/Controllers/UmbLoginController.cs b/src/Umbraco.Web/Controllers/UmbLoginController.cs index e86e48a18b..d446df5683 100644 --- a/src/Umbraco.Web/Controllers/UmbLoginController.cs +++ b/src/Umbraco.Web/Controllers/UmbLoginController.cs @@ -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(); } From 0daaa3e7852fd4dedeb4ebc2d3f99aab3c58a409 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 20 Dec 2016 12:28:45 +1100 Subject: [PATCH 09/12] Revert "Merge pull request #1618 from AliSheikhTaheri/U4-9180" This reverts commit 4050a375bc5f7ca7b6a620bbf1b9086fb9f1b1c3, reversing changes made to a058f2646278484c622b421836df76de29618b2c. --- src/Umbraco.Web.UI/config/log4net.Release.config | 12 +++++------- src/Umbraco.Web.UI/config/log4net.config | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Web.UI/config/log4net.Release.config b/src/Umbraco.Web.UI/config/log4net.Release.config index e657394df7..10b8c9eb7a 100644 --- a/src/Umbraco.Web.UI/config/log4net.Release.config +++ b/src/Umbraco.Web.UI/config/log4net.Release.config @@ -1,19 +1,17 @@ - + - + - - + - @@ -29,6 +27,6 @@ - - + + diff --git a/src/Umbraco.Web.UI/config/log4net.config b/src/Umbraco.Web.UI/config/log4net.config index 0834e2b090..eca84962a1 100644 --- a/src/Umbraco.Web.UI/config/log4net.config +++ b/src/Umbraco.Web.UI/config/log4net.config @@ -1,19 +1,17 @@ - + - + - - + - @@ -29,6 +27,6 @@ - - + + \ No newline at end of file From 39505cd868b83dfb8171ea1b664a91ebee8312b7 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 20 Dec 2016 13:27:53 +1100 Subject: [PATCH 10/12] U4-9262 CleanForXss breaks rgba() values set as grid background color style --- .../Views/Partials/Grid/Bootstrap2-Fluid.cshtml | 6 +++--- src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml | 6 +++--- .../Views/Partials/Grid/Bootstrap3-Fluid.cshtml | 6 +++--- src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml | 8 ++++---- .../Views/Partials/Grid/Editors/TextString.cshtml | 4 ++-- .../Media/EmbedProviders/AbstractOEmbedProvider.cs | 9 +++++++-- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml index f6b93139ce..d8e9f40e15 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2-Fluid.cshtml @@ -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(); 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)); diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml index c5fabe2abf..c8f9ab7cd1 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap2.cshtml @@ -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(); 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)); diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml index b7e8ef34fb..defe59d808 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3-Fluid.cshtml @@ -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(); 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)); diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml index 3a4fa3b8e2..6ab5c1355a 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Bootstrap3.cshtml @@ -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(); 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)); diff --git a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml index 5a570efdb5..8c92ca0d83 100644 --- a/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/Grid/Editors/TextString.cshtml @@ -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()); diff --git a/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs b/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs index 51622ed504..2f8ec85075 100644 --- a/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs +++ b/src/Umbraco.Web/Media/EmbedProviders/AbstractOEmbedProvider.cs @@ -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)); From 3f7e593bc2ee7c3b48af9506c3e95b129dedb0db Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 20 Dec 2016 14:10:06 +1100 Subject: [PATCH 11/12] U4-9302 Add logging of non security related connection string details when the connection fails --- src/Umbraco.Core/DatabaseContext.cs | 29 +++++++++++++-- .../Persistence/DbConnectionExtensions.cs | 37 ++++++++++++++++++- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Core/DatabaseContext.cs b/src/Umbraco.Core/DatabaseContext.cs index 585f1d51cf..a6d6ca9e6e 100644 --- a/src/Umbraco.Core/DatabaseContext.cs +++ b/src/Umbraco.Core/DatabaseContext.cs @@ -34,6 +34,12 @@ namespace Umbraco.Core private string _connectionString; private string _providerName; private DatabaseSchemaResult _result; + private DateTime? _connectionLastChecked = null; + + /// + /// The number of minutes to throttle the checks to CanConnect + /// + private const int ConnectionCheckMinutes = 1; [Obsolete("Use the constructor specifying all dependencies instead")] public DatabaseContext(IDatabaseFactory factory) @@ -110,13 +116,28 @@ namespace Umbraco.Core { get { - if (IsDatabaseConfigured == false) return false; - var canConnect = DbConnectionExtensions.IsConnectionAvailable(ConnectionString, DatabaseProvider); - LogHelper.Info("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("CanConnect = " + canConnect); + + _connectionLastChecked = canConnect == false ? null : (DateTime?) DateTime.Now; + return canConnect; + } + + return _connectionLastChecked.HasValue; } } + /// /// Gets the configured umbraco db connection string. /// diff --git a/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs b/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs index c0c7b2a777..86072c45d5 100644 --- a/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs +++ b/src/Umbraco.Core/Persistence/DbConnectionExtensions.cs @@ -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("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; } From 4c97c689e9a13b955dd247b6eb51e1039b9581cd Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 22 Dec 2016 14:06:23 +0100 Subject: [PATCH 12/12] Fixes: U4-9199 Grid RTE (rich text editor/ tinyMCE) does not have a max height, causing the user to have to scroll up to see RTE menu buttons --- .../components/grid/grid.rte.directive.js | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js index 5dd7d266df..60bb4957ae 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/grid/grid.rte.directive.js @@ -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); + }); });