Skip to content

Commit

Permalink
Merge pull request #3710 from dnnsoftware/release/9.6.0
Browse files Browse the repository at this point in the history
Release/9.6.0
  • Loading branch information
valadas committed Apr 29, 2020
2 parents a9dc202 + 600e5a8 commit f5f7e91
Show file tree
Hide file tree
Showing 193 changed files with 5,193 additions and 1,655 deletions.
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Provide any additional context that may be helpful in understanding and/or resol
Please add X in at least one of the boxes as appropriate. In order for an issue to be accepted, a developer needs to be able to reproduce the issue on a currently supported version. If you are looking for a workaround for an issue with an older version, please visit the forums at https://dnncommunity.org/forums
-->
* [ ] 10.0.0 alpha build
* [ ] 9.5.0 alpha build
* [ ] 9.4.4 latest supported release
* [ ] 9.5.1 alpha build
* [ ] 9.5.0 latest supported release
* [ ] 9.4.4

## Affected browser
<!--
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/image-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Compress images
on: pull_request
jobs:
build:
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Compress Images
uses: calibreapp/image-actions@master
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
*.dotCover
*.ldf
Artifacts/
[Ss]rc
[Tt]emp
[Bb]uild/**/*.zip

Expand Down
22 changes: 15 additions & 7 deletions Build/Cake/database.cake
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Database tasks for your local DNN development site
using System.Data.SqlClient;

Task("ResetDatabase")
.Does(() =>
.Does(() =>
{
var script = ReplaceScriptVariables(LoadScript("db-connections-drop"));
ExecuteScript(script);
Expand All @@ -15,6 +16,13 @@ Task("ResetDatabase")

public const string ScriptsPath = @".\Build\Cake\sql\";

private static readonly string[] GoStatement = {
"\r\nGO\r\n",
"\nGO\n",
"\nGO\r\n",
"\r\nGO\n",
};

public string LoadScript(string scriptName) {
var script = scriptName + ".local.sql";
if (!System.IO.File.Exists(ScriptsPath + script)) {
Expand All @@ -30,16 +38,16 @@ public string ReplaceScriptVariables(string script) {
.Replace("{DBLogin}", Settings.DnnSqlUsername);
}

public bool ExecuteScript(string ScriptStatement)
public bool ExecuteScript(string scriptStatement)
{
try
{
using (var connection = new System.Data.SqlClient.SqlConnection(Settings.SaConnectionString))
using (var connection = new SqlConnection(Settings.SaConnectionString))
{
connection.Open();
foreach (var cmd in ScriptStatement.Split(new string[] {"\r\nGO\r\n"}, StringSplitOptions.RemoveEmptyEntries)) {
var command = new System.Data.SqlClient.SqlCommand(cmd, connection);
command.ExecuteNonQuery();
foreach (var cmd in scriptStatement.Split(GoStatement, StringSplitOptions.RemoveEmptyEntries)) {
var command = new SqlCommand(cmd, connection);
command.ExecuteNonQuery();
}
connection.Close();
}
Expand All @@ -49,4 +57,4 @@ public bool ExecuteScript(string ScriptStatement)
return false;
}
return true;
}
}
2 changes: 2 additions & 0 deletions Build/Cake/devsite.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Note these tasks depend on the correct settings in your settings file.

Task("ResetDevSite")
.IsDependentOn("SetVersion")
.IsDependentOn("UpdateDnnManifests")
.IsDependentOn("ResetDatabase")
.IsDependentOn("PreparePackaging")
.IsDependentOn("OtherPackages")
Expand Down
4 changes: 2 additions & 2 deletions Build/Cake/sql/create-db.sql
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
IF db_id('{DBName}') IS NOT NULL DROP DATABASE {DBName};
IF db_id('{DBName}') IS NOT NULL DROP DATABASE [{DBName}];
GO

CREATE DATABASE [{DBName}] ON PRIMARY
( NAME = N'{DBName}', FILENAME = N'{DBPath}\{DBName}.mdf')
LOG ON
LOG ON
( NAME = N'{DBName}_log', FILENAME = N'{DBPath}\{DBName}_log.ldf')
GO

Expand Down
34 changes: 0 additions & 34 deletions DNN Platform/Components/Telerik/DotNetNuke.Telerik.Web.dnn
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,6 @@
</file>
</files>
</component>
<component type="Config">
<config>
<configFile>web.config</configFile>
<install>
<configuration>
<nodes>
<node path="/configuration/system.web/httpHandlers" action="update" key="path" collision="overwrite">
<add verb="*" path="Telerik.Web.UI.WebResource.axd" validate="false" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" />
</node>
<node path="/configuration/system.webServer/handlers" action="update" key="name" collision="overwrite">
<add name="Telerik.Web.UI.WebResource" verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode" />
</node>
<node path="/configuration/system.webServer/modules" action="update" key="name" collision="overwrite">
<add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" preCondition="managedHandler" />
</node>
<node path="/configuration/system.web/httpModules" action="update" key="name" collision="overwrite">
<add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" />
</node>
<node path="/configuration/system.web/httpHandlers" action="update" key="path" collision="overwrite">
<add verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" validate="true" />
</node>
<node path="/configuration/system.webServer/handlers" action="update" key="name" collision="overwrite">
<add name="Telerik.Web.UI.ChartHttpHandler" verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4"/>
</node>
</nodes>
</configuration>
</install>
<uninstall>
<configuration>
<nodes/>
</configuration>
</uninstall>
</config>
</component>
</components>
</package>
</packages>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using DotNetNuke.DependencyInjection.Extensions;
using DotNetNuke.Web.Mvc.Framework.Controllers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
Expand All @@ -11,7 +12,7 @@ namespace DotNetNuke.Web.Mvc.Extensions
{
public static class StartupExtensions
{
public static void AddWebApiControllers(this IServiceCollection services)
public static void AddMvcControllers(this IServiceCollection services)
{
var controllerTypes = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(TypeExtensions.SafeGetTypes)
Expand All @@ -21,7 +22,7 @@ public static void AddWebApiControllers(this IServiceCollection services)
);
foreach (var controller in controllerTypes)
{
services.AddScoped(controller);
services.TryAddTransient(controller);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions DNN Platform/DotNetNuke.Web.Mvc/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
using DotNetNuke.Web.Mvc.Extensions;
using System.Web.Mvc;
using DotNetNuke.Common;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace DotNetNuke.Web.Mvc
{
public class Startup : IDnnStartup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<IControllerFactory, DefaultControllerFactory>();
services.TryAddSingleton<IControllerFactory, DefaultControllerFactory>();
services.AddSingleton<MvcModuleControlFactory>();

services.AddWebApiControllers();
services.AddMvcControllers();

DependencyResolver.SetResolver(new DnnMvcDependencyResolver(Globals.DependencyProvider));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using DotNetNuke.DependencyInjection.Extensions;
using DotNetNuke.Web.Api;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Linq;

Expand Down Expand Up @@ -32,7 +33,7 @@ public static void AddWebApi(this IServiceCollection services)
!x.IsAbstract);
foreach (var controller in controllerTypes)
{
services.AddScoped(controller);
services.TryAddScoped(controller);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public Task<HttpResponseMessage> PostFile()
// local references for use in closure
var portalSettings = PortalSettings;
var currentSynchronizationContext = SynchronizationContext.Current;
var userInfo = UserInfo;
var userInfo = UserInfo;
var task = request.Content.ReadAsMultipartAsync(provider)
.ContinueWith(o =>
{
Expand Down Expand Up @@ -344,6 +344,7 @@ public class UploadByUrlDto
public string Filter { get; set; }
public bool IsHostMenu { get; set; }
public int PortalId { get; set; } = -1;
public string ValidationCode { get; set; }
}

[DataContract]
Expand Down Expand Up @@ -389,13 +390,26 @@ private static FileUploadDto UploadFile(
string fileName,
bool overwrite,
bool isHostPortal,
bool extract)
bool extract,
string validationCode)
{
var result = new FileUploadDto();
BinaryReader reader = null;
Stream fileContent = null;
try
{
var extensionList = new List<string>();
if (!string.IsNullOrWhiteSpace(filter))
{
extensionList = filter.Split(',').Select(i => i.Trim()).ToList();
}

var validateParams = new List<object>{ extensionList, portalId, userInfo.UserID};
if (!ValidationUtils.ValidationCodeMatched(validateParams, validationCode))
{
throw new InvalidOperationException("Bad Request");
}

var extension = Path.GetExtension(fileName).ValueOrEmpty().Replace(".", "");
result.FileIconUrl = IconController.GetFileIconUrl(extension);

Expand All @@ -406,7 +420,7 @@ private static FileUploadDto UploadFile(
}

var folderManager = FolderManager.Instance;
var effectivePortalId = isHostPortal ? Null.NullInteger : portalId;
var effectivePortalId = isHostPortal ? Null.NullInteger : portalId;
var folderInfo = folderManager.GetFolder(effectivePortalId, folder);

int userId;
Expand Down Expand Up @@ -556,6 +570,7 @@ public Task<HttpResponseMessage> UploadFromLocal(int portalId)
var folder = string.Empty;
var filter = string.Empty;
var fileName = string.Empty;
var validationCode = string.Empty;
var overwrite = false;
var isHostPortal = false;
var extract = false;
Expand Down Expand Up @@ -592,7 +607,9 @@ public Task<HttpResponseMessage> UploadFromLocal(int portalId)
int.TryParse(item.ReadAsStringAsync().Result, out portalId);
}
break;
case "\"VALIDATIONCODE\"":
validationCode = item.ReadAsStringAsync().Result ?? "";
break;
case "\"POSTFILE\"":
fileName = item.Headers.ContentDisposition.FileName.Replace("\"", "");
if (fileName.IndexOf("\\", StringComparison.Ordinal) != -1)
Expand All @@ -613,7 +630,7 @@ public Task<HttpResponseMessage> UploadFromLocal(int portalId)
currentSynchronizationContext.Send(
delegate
{
result = UploadFile(stream, portalId, userInfo, folder, filter, fileName, overwrite, isHostPortal, extract);
result = UploadFile(stream, portalId, userInfo, folder, filter, fileName, overwrite, isHostPortal, extract, validationCode);
},
null
);
Expand Down Expand Up @@ -680,7 +697,7 @@ public HttpResponseMessage UploadFromUrl(UploadByUrlDto dto)
}

result = UploadFile(responseStream, portalId, UserInfo, dto.Folder.ValueOrEmpty(), dto.Filter.ValueOrEmpty(),
fileName, dto.Overwrite, dto.IsHostMenu, dto.Unzip);
fileName, dto.Overwrite, dto.IsHostMenu, dto.Unzip, dto.ValidationCode);

/* Response Content Type cannot be application/json
* because IE9 with iframe-transport manages the response
Expand Down
18 changes: 18 additions & 0 deletions DNN Platform/DotNetNuke.Web/UI/WebControls/DnnFileUploadOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Globalization;
using System.Runtime.Serialization;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Portals;

namespace DotNetNuke.Web.UI.WebControls
{
Expand Down Expand Up @@ -141,6 +142,23 @@ public Dictionary<string, string> Parameters
[DataMember(Name = "folderPath")]
public string FolderPath;

[DataMember(Name = "validationCode")]
public string ValidationCode
{
get
{
var portalSettings = PortalSettings.Current;
var parameters = new List<object>(){Extensions};
if (portalSettings != null)
{
parameters.Add(portalSettings.PortalId);
parameters.Add(portalSettings.UserInfo.UserID);
}

return ValidationUtils.ComputeValidationCode(parameters);
}
}

public DnnFileUploadOptions()
{
FolderPicker = new DnnDropDownListOptions();
Expand Down
6 changes: 3 additions & 3 deletions DNN Platform/JavaScript Libraries/jQuery/jQuery.dnn
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="jQuery" type="JavaScript_Library" version="03.04.01" isSystem="true">
<package name="jQuery" type="JavaScript_Library" version="03.05.00" isSystem="true">
<friendlyName>jQuery JavaScript Library</friendlyName>
<description>jQuery is a JavaScript library that is used to manipulate the Document Object Model (DOM).</description>
<iconFile>Icons\Sigma\Extensions_32x32_Standard.png</iconFile>
Expand All @@ -19,7 +19,7 @@
<libraryName>jQuery</libraryName>
<fileName>jquery.js</fileName>
<objectName>jQuery</objectName>
<CDNPath>//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js</CDNPath>
<CDNPath>https://code.jquery.com/jquery-3.5.0.min.js</CDNPath>
</javaScriptLibrary>
</component>
<component type="JavaScriptFile">
Expand All @@ -37,4 +37,4 @@
</components>
</package>
</packages>
</dotnetnuke>
</dotnetnuke>
4 changes: 2 additions & 2 deletions DNN Platform/JavaScript Libraries/jQuery/jquery.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DNN Platform/JavaScript Libraries/jQuery/jquery.min.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="jQuery-Migrate" type="JavaScript_Library" version="03.01.00" isSystem="true">
<package name="jQuery-Migrate" type="JavaScript_Library" version="03.02.00" isSystem="true">
<friendlyName>jQuery Migrate JavaScript Library</friendlyName>
<description>jQuery Migrate is a JavaScript library that is used to mintain jQuery backwards compatability.</description>
<description>A development tool to help migrate away from APIs and features that have been or will be removed from jQuery core</description>
<iconFile>Icons\Sigma\Extensions_32x32_Standard.png</iconFile>
<owner>
<name>DNN</name>
Expand All @@ -21,7 +21,7 @@
<javaScriptLibrary>
<libraryName>jQuery-Migrate</libraryName>
<fileName>jquery-migrate.js</fileName>
<CDNPath>//code.jquery.com/jquery-migrate-3.1.0.min.js</CDNPath>
<CDNPath>https://code.jquery.com/jquery-migrate-3.2.0.min.js</CDNPath>
</javaScriptLibrary>
</component>
<component type="JavaScriptFile">
Expand Down
Loading

0 comments on commit f5f7e91

Please sign in to comment.