From 356ae81afe9ec8c206a2fb0e0f29fa076dc81d6e Mon Sep 17 00:00:00 2001 From: Stefan Kamphuis Date: Thu, 21 Sep 2023 12:31:39 +0200 Subject: [PATCH 1/6] No Warning for moniker not found, when moniker is empty --- .../Api/StandardTabAndModuleInfoProvider.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs index 92ee5e26fad..32bfc56dc9c 100644 --- a/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web/Api/StandardTabAndModuleInfoProvider.cs @@ -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; From e78fbe2ca762a0f90a875ac7857e934218668a59 Mon Sep 17 00:00:00 2001 From: Stefan Kamphuis Date: Thu, 21 Sep 2023 12:32:38 +0200 Subject: [PATCH 2/6] No Warning for moniker not found, when moniker is empty --- .../StandardTabAndModuleInfoProvider.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs index 6e1248da8ff..9b42bd337f8 100644 --- a/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs +++ b/DNN Platform/DotNetNuke.Web.Mvc/StandardTabAndModuleInfoProvider.cs @@ -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; } } From 8509a7bc38eaf225762773c3fcccd1beb60eac00 Mon Sep 17 00:00:00 2001 From: Stefan Kamphuis Date: Thu, 21 Sep 2023 13:09:13 +0200 Subject: [PATCH 3/6] In DDRMenu.FilterNodes only do GetTab when tabId > 0 This improves efficiency and reduces useless log lines, because GetTab would add a log for each Tab not found. --- DNN Platform/Modules/DDRMenu/MenuBase.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DNN Platform/Modules/DDRMenu/MenuBase.cs b/DNN Platform/Modules/DDRMenu/MenuBase.cs index f101f72d890..9dc4a35883d 100644 --- a/DNN Platform/Modules/DDRMenu/MenuBase.cs +++ b/DNN Platform/Modules/DDRMenu/MenuBase.cs @@ -216,6 +216,9 @@ 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) { From f9c6d604396010c2fbe689a7d5eaa888b3b8dac1 Mon Sep 17 00:00:00 2001 From: Stefan Kamphuis Date: Thu, 21 Sep 2023 13:31:58 +0200 Subject: [PATCH 4/6] BasicUrlRewriter: no log after redirect --- DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs index 989dca682fd..57b393df041 100644 --- a/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs +++ b/DNN Platform/HttpModules/UrlRewrite/BasicUrlRewriter.cs @@ -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) { From 8ec5ce091117903f3da3659a4f797fcaba24a1fb Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Wed, 4 Oct 2023 09:19:15 -0500 Subject: [PATCH 5/6] Fix missing braces --- DNN Platform/Modules/DDRMenu/MenuBase.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/DNN Platform/Modules/DDRMenu/MenuBase.cs b/DNN Platform/Modules/DDRMenu/MenuBase.cs index 9dc4a35883d..879ba0c0917 100644 --- a/DNN Platform/Modules/DDRMenu/MenuBase.cs +++ b/DNN Platform/Modules/DDRMenu/MenuBase.cs @@ -217,7 +217,11 @@ private void FilterNodes(string nodeString, bool exclude) n => { // no need to check when the node is not a page - if (n.TabId <= 0) return false; + if (n.TabId <= 0) + { + return false; + } + var tab = TabController.Instance.GetTab(n.TabId, Null.NullInteger, false); foreach (TabPermissionInfo perm in tab.TabPermissions) From d056edf887e0ad2a73502751f5ebdda54a14c935 Mon Sep 17 00:00:00 2001 From: Daniel Valadas Date: Wed, 4 Oct 2023 10:40:50 -0400 Subject: [PATCH 6/6] Removed extra blank line --- DNN Platform/Modules/DDRMenu/MenuBase.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/DNN Platform/Modules/DDRMenu/MenuBase.cs b/DNN Platform/Modules/DDRMenu/MenuBase.cs index 879ba0c0917..be6de3421e2 100644 --- a/DNN Platform/Modules/DDRMenu/MenuBase.cs +++ b/DNN Platform/Modules/DDRMenu/MenuBase.cs @@ -222,7 +222,6 @@ private void FilterNodes(string nodeString, bool exclude) return false; } - var tab = TabController.Instance.GetTab(n.TabId, Null.NullInteger, false); foreach (TabPermissionInfo perm in tab.TabPermissions) {