Skip to content

Commit

Permalink
Merge pull request #5847 from dnnsoftware/develop
Browse files Browse the repository at this point in the history
Updates `release/10.0.0` with latest fixes from `develop`
  • Loading branch information
valadas authored Oct 15, 2023
2 parents 3af88c5 + 39c25b7 commit 0d7363b
Show file tree
Hide file tree
Showing 22 changed files with 330 additions and 373 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ body:
**NOTE:** _If your version is not listed, please upgrade to the latest version. If you cannot upgrade at this time, please open a [Discussion](https://github.com/dnnsoftware/Dnn.Platform/discussions) instead._
multiple: true
options:
- 9.12.0 (latest release)
- 9.13.0 (release candidate)
- 9.13.0 (latest release)
- 9.13.1 (alpha)
- 10.0.0 (alpha)
validations:
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ private static int GetTabModuleInfoFromMoniker(string monikerValue)
if (ids != null && ids.Any())
{
return ids.First();
}

if (Logger.IsWarnEnabled)
{
Logger.WarnFormat("The specified moniker ({0}) is not defined in the system", monikerValue);
}
}

if (Logger.IsWarnEnabled)
{
Logger.WarnFormat("The specified moniker ({0}) is not defined in the system", monikerValue);
}

return Null.NullInteger;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ private static int GetTabModuleInfoFromMoniker(string monikerValue)
{
return ids.First();
}
}

if (Logger.IsWarnEnabled)
{
Logger.WarnFormat("The specified moniker ({0}) is not defined in the system", monikerValue);
if (Logger.IsWarnEnabled)
{
Logger.WarnFormat("The specified moniker ({0}) is not defined in the system", monikerValue);
}
}

return Null.NullInteger;
Expand Down
3 changes: 1 addition & 2 deletions DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,9 @@ internal override void RewriteUrl(object sender, EventArgs e)
}
}
}
catch (ThreadAbortException exc)
catch (ThreadAbortException)
{
// Do nothing if Thread is being aborted - there are two response.redirect calls in the Try block
Logger.Debug(exc);
}
catch (Exception ex)
{
Expand Down
8 changes: 6 additions & 2 deletions DNN Platform/JavaScript Libraries/DnnPlugins/dnn.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -4314,10 +4314,14 @@
});
};

function registerEvents() {
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(saveRgDataDivScrollTop);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(dnnInitCustomisedCtrls);
}

window.__rgDataDivScrollTopPersistArray = [];
$(document).ajaxComplete(dnnInitCustomisedCtrls);
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(saveRgDataDivScrollTop);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(dnnInitCustomisedCtrls);
$(dnnInitCustomisedCtrls);
$(registerEvents);
handlerSendVerificationMailLink();
})(jQuery);
6 changes: 3 additions & 3 deletions DNN Platform/Library/Entities/Tabs/TabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,9 +1393,9 @@ public TabInfo GetTab(int tabId, int portalId, bool ignoreCache)
// correctly, this may occurred when install is set up in web farm.
tab = CBO.FillObject<TabInfo>(this.dataProvider.GetTab(tabId));

// if tab is not null means that the cache doesn't update correctly, we need clear the cache
// and let it rebuild cache when request next time.
if (tab != null)
// if tab is not null, and it is for "portalId", that means that the cache doesn't update correctly,
// we need to clear the cache and let it rebuild cache when request next time.
if (tab != null && tab.PortalID == portalId)
{
this.ClearCache(tab.PortalID);
}
Expand Down
24 changes: 24 additions & 0 deletions DNN Platform/Library/Security/PortalSecurity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public class PortalSecurity

private static readonly Regex StripTagsRegex = new Regex("<[^<>]*>", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled);
private static readonly Regex BadStatementRegex = new Regex(BadStatementExpression, RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex ControlCharactersRegex = new Regex(@"\p{C}+", RegexOptions.Compiled);
private static readonly Regex ControlCharacterToWhitespaceRegex = new Regex(@"\r\n|\r|\n|\t", RegexOptions.Compiled);

private static readonly Regex[] RxListStrings = new[]
{
Expand Down Expand Up @@ -109,6 +111,14 @@ public enum FilterFlag
[Obsolete("Deprecated in DotNetNuke 9.8.1. Individual string replacement should be completed. Scheduled for removal in v11.0.0.")]
NoAngleBrackets = 16,
NoProfanity = 32,

/// <summary>
/// Removes all unicode control characters (like \0, \t, \n, \r, etc.) from the string.
/// </summary>
/// <remarks>
/// The control characters \r\n, \r, \n, and \t are replaced with a single space instead of being removed.
/// </remarks>
NoControlCharacters = 64,
}

/// <summary>Determines the configuration source for the remove and replace functions.</summary>
Expand Down Expand Up @@ -473,6 +483,11 @@ public string InputFilter(string userInput, FilterFlag filterType)
tempInput = this.Replace(tempInput, ConfigType.ListController, "ProfanityFilter", FilterScope.SystemAndPortalList);
}

if ((filterType & FilterFlag.NoControlCharacters) == FilterFlag.NoControlCharacters)
{
tempInput = FormatRemoveControlCharacters(tempInput);
}

return tempInput;
}

Expand Down Expand Up @@ -1018,6 +1033,15 @@ private static string FormatRemoveSQL(string strSQL)
return BadStatementRegex.Replace(strSQL, " ").Replace("'", "''");
}

/// <summary>This function removes control characters from the string.</summary>
/// <param name="str">This is the string to be filtered.</param>
/// <returns>Filtered UserInput.</returns>
/// <remarks>This is a private function that is used internally by the <see cref="InputFilter"/> function.</remarks>
private static string FormatRemoveControlCharacters(string str)
{
return ControlCharactersRegex.Replace(ControlCharacterToWhitespaceRegex.Replace(str, " "), string.Empty);
}

/// <summary>This function determines if the Input string contains any markup.</summary>
/// <param name="strInput">This is the string to be checked.</param>
/// <returns>True if string contains Markup tag(s).</returns>
Expand Down
6 changes: 6 additions & 0 deletions DNN Platform/Modules/DDRMenu/MenuBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ private void FilterNodes(string nodeString, bool exclude)
this.RootNode.Children.FindAll(
n =>
{
// no need to check when the node is not a page
if (n.TabId <= 0)
{
return false;
}

var tab = TabController.Instance.GetTab(n.TabId, Null.NullInteger, false);
foreach (TabPermissionInfo perm in tab.TabPermissions)
{
Expand Down
19 changes: 17 additions & 2 deletions DNN Platform/Modules/HTML/Components/WorkflowStateController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,31 @@ namespace DotNetNuke.Modules.Html
public class WorkflowStateController
{
private const string WORKFLOWCACHEKEY = "Workflow{0}";
private const string WORKFLOWSCACHEKEY = "Workflows{0}";
private const int WORKFLOWCACHETIMEOUT = 20;

private const CacheItemPriority WORKFLOWCACHEPRIORITY = CacheItemPriority.Normal;

/// <summary>GetWorkFlows retrieves a collection of workflows for the portal.</summary>
/// <summary>GetWorkFlows retrieves a collection of workflows for the portal from the cache.</summary>
/// <param name="portalID">The ID of the Portal.</param>
/// <returns>An <see cref="ArrayList"/> of <see cref="WorkflowStateInfo"/> instances.</returns>
public ArrayList GetWorkflows(int portalID)
{
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalID), typeof(WorkflowStateInfo));
var cacheKey = string.Format(WORKFLOWSCACHEKEY, portalID);
return CBO.GetCachedObject<ArrayList>(new CacheItemArgs(cacheKey, WORKFLOWCACHETIMEOUT, WORKFLOWCACHEPRIORITY, portalID), this.GetWorkflowsCallBack);
}

/// -----------------------------------------------------------------------------
/// <summary>
/// GetWorkflowsCallBack retrieves a collection of WorkflowStateInfo objects for the Portal from the database.
/// </summary>
/// <param name = "cacheItemArgs">Arguments passed by the GetWorkflowStates method.</param>
/// <returns>WorkflowStateInfo List.</returns>
/// -----------------------------------------------------------------------------
public ArrayList GetWorkflowsCallBack(CacheItemArgs cacheItemArgs)
{
var portalId = (int)cacheItemArgs.ParamList[0];
return CBO.FillCollection(DataProvider.Instance().GetWorkflows(portalId), typeof(WorkflowStateInfo));
}

/// <summary>GetWorkFlowStates retrieves a collection of WorkflowStateInfo objects for the Workflow from the cache.</summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ protected void Page_Load(object sender, EventArgs e)
this.portalSettings,
this.currentSettings,
settingsDictionary,
"DNNCKP#-1#",
SettingConstants.HostKey,
null);

switch (this.currentSettings.SettingMode)
Expand All @@ -808,15 +808,15 @@ protected void Page_Load(object sender, EventArgs e)
this.portalSettings,
this.currentSettings,
settingsDictionary,
"DNNCKH#",
SettingConstants.HostKey,
null);
break;
case SettingsMode.Portal:
this.currentSettings = SettingsUtil.LoadEditorSettingsByKey(
this.portalSettings,
this.currentSettings,
settingsDictionary,
$"DNNCKP#{this.request.QueryString["PortalID"]}#",
SettingConstants.PortalKey(this.request.QueryString["PortalID"]),
portalRoles);
break;
case SettingsMode.Page:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ private EditorProviderSettings GetCurrentSettings(HttpContext context)
this.portalSettings,
currentSettings,
settingsDictionary,
"DNNCKH#",
SettingConstants.HostKey,
portalRoles);
break;
case SettingsMode.Portal:
currentSettings = SettingsUtil.LoadEditorSettingsByKey(
this.portalSettings,
currentSettings,
settingsDictionary,
$"DNNCKP#{portalId}#",
SettingConstants.PortalKey(portalId),
portalRoles);
break;
case SettingsMode.Page:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ var codeMirrorInfo in
// get the all-sites settings to be able to to show overridden values
// when we're not in all-sites mode
var allPortalsSettings = SettingsUtil.LoadEditorSettingsByKey(
this.portalSettings, this.currentSettings, EditorController.GetEditorHostSettings(), "DNNCKP#-1#", new List<RoleInfo>());
this.portalSettings, this.currentSettings, EditorController.GetEditorHostSettings(), SettingConstants.HostKey, new List<RoleInfo>());

this.HostBrowserRootDir.ReadOnly = !this.IsHostMode || this.CurrentPortalOnly;
this.HostBrowserRootDir.Text = this.HostBrowserRootDir.ReadOnly ? allPortalsSettings.HostBrowserRootDir : importedSettings.HostBrowserRootDir;
Expand Down Expand Up @@ -1839,8 +1839,8 @@ private void LoadSettings(int currentMode, bool changeMode = true)
var settingsDictionary = EditorController.GetEditorHostSettings();
var portalRoles = RoleController.Instance.GetRoles(this.portalSettings?.PortalId ?? Host.HostPortalID);

var hostKey = "DNNCKH#";
var portalKey = $"DNNCKP#{this.portalSettings?.PortalId ?? Host.HostPortalID}#";
var hostKey = SettingConstants.HostKey;
var portalKey = SettingConstants.PortalKey(this.portalSettings?.PortalId ?? Host.HostPortalID);
var pageKey = $"DNNCKT#{this.CurrentOrSelectedTabId}#";
var moduleKey = $"DNNCKMI#{this.ModuleId}#INS#{this.moduleInstanceName}#";

Expand Down Expand Up @@ -2793,10 +2793,10 @@ private void SaveSettings()
switch (this.CurrentSettingsMode)
{
case SettingsMode.Host:
this.SaveSettingsByKey("DNNCKH#");
this.SaveSettingsByKey(SettingConstants.HostKey);
break;
case SettingsMode.Portal:
this.SaveSettingsByKey($"DNNCKP#{this.portalSettings?.PortalId ?? Host.HostPortalID}#");
this.SaveSettingsByKey(SettingConstants.PortalKey(this.portalSettings?.PortalId ?? Host.HostPortalID));
break;
case SettingsMode.Page:
this.SaveSettingsByKey($"DNNCKT#{this.CurrentOrSelectedTabId}#");
Expand Down Expand Up @@ -3287,6 +3287,7 @@ private EditorProviderSettings ExportSettings()
exportSettings.Config.Skin = this.ddlSkin.SelectedValue;
exportSettings.Config.CodeMirror.Theme = this.CodeMirrorTheme.SelectedValue;
exportSettings.Browser = this.ddlBrowser.SelectedValue;
exportSettings.BrowserAllowFollowFolderPerms = this.BrowAllowFollowPerms.Checked;
exportSettings.ImageButton = this.ddlImageButton.SelectedValue;
exportSettings.FileListViewMode =
(FileListView)Enum.Parse(typeof(FileListView), this.FileListViewMode.SelectedValue);
Expand Down
Loading

0 comments on commit 0d7363b

Please sign in to comment.