Skip to content

Commit db46a7d

Browse files
committed
Remove obsolete usages in DotNetNuke.Website
Remove the "user online" indicator from the Manage Users and Membership controls. Mark the admin/Sales PayPal integration pages & control as deprecated I did not yet change calls to PortalSecurity.InputFilter for usernames and things like that, instead suppressing those warnings.
1 parent d027d97 commit db46a7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+872
-528
lines changed

DNN Platform/Library/Entities/Host/Host.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ public static bool DisplayBetaNotice
279279
}
280280
}
281281

282-
/// <summary> Gets a value indicating whether gets whether to dislpay the copyright.</summary>
282+
/// <summary>Gets a value indicating whether to display the copyright.</summary>
283283
/// <remarks>
284284
/// Defaults to True.
285285
/// </remarks>

DNN Platform/Library/Framework/PageBase.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ namespace DotNetNuke.Framework
2525
using DotNetNuke.UI.Modules;
2626
using DotNetNuke.Web.Client.ClientResourceManagement;
2727

28-
/// Namespace: DotNetNuke.Framework
29-
/// Project: DotNetNuke
30-
/// Class: PageBase
3128
/// <summary>PageBase provides a custom DotNetNuke base class for pages.</summary>
3229
public abstract class PageBase : Page
3330
{
@@ -43,10 +40,7 @@ public abstract class PageBase : Page
4340
private CultureInfo pageCulture;
4441
private string localResourceFile;
4542

46-
/// <summary>
47-
/// Initializes a new instance of the <see cref="PageBase"/> class.
48-
/// Creates the Page.
49-
/// </summary>
43+
/// <summary>Initializes a new instance of the <see cref="PageBase"/> class.</summary>
5044
protected PageBase()
5145
{
5246
this.localizedControls = new ArrayList();

DNN Platform/Library/Services/Exceptions/ErrorContainer.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ public ErrorContainer(string strError)
2626
/// <param name="strError">The error message.</param>
2727
/// <param name="exc">The exception.</param>
2828
public ErrorContainer(string strError, Exception exc)
29-
{
30-
this.Container = this.FormatException(strError, exc);
31-
}
32-
33-
/// <summary>Initializes a new instance of the <see cref="ErrorContainer"/> class.</summary>
34-
/// <param name="portalSettings">The portal settings.</param>
35-
/// <param name="strError">The error message.</param>
36-
/// <param name="exc">The exception.</param>
37-
public ErrorContainer(PortalSettings portalSettings, string strError, Exception exc)
3829
{
3930
UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
4031
if (objUserInfo.IsSuperUser)
@@ -47,6 +38,15 @@ public ErrorContainer(PortalSettings portalSettings, string strError, Exception
4738
}
4839
}
4940

41+
/// <summary>Initializes a new instance of the <see cref="ErrorContainer"/> class.</summary>
42+
/// <param name="portalSettings">The portal settings.</param>
43+
/// <param name="strError">The error message.</param>
44+
/// <param name="exc">The exception.</param>
45+
public ErrorContainer(PortalSettings portalSettings, string strError, Exception exc)
46+
: this(strError, exc)
47+
{
48+
}
49+
5050
public ModuleMessage Container { get; set; }
5151

5252
private ModuleMessage FormatException(string strError)

DNN Platform/Library/Startup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace DotNetNuke
3636
using DotNetNuke.Services.Localization;
3737
using DotNetNuke.Services.Log.EventLog;
3838
using DotNetNuke.Services.Mail.OAuth;
39+
using DotNetNuke.Services.Mobile;
3940
using DotNetNuke.Services.Search.Controllers;
4041
using DotNetNuke.UI.Modules;
4142
using DotNetNuke.UI.Modules.Html5;
@@ -90,6 +91,7 @@ public void ConfigureServices(IServiceCollection services)
9091
services.AddTransient<IModuleController, ModuleController>();
9192
services.AddTransient<IPackageController, PackageController>();
9293
services.AddTransient<ITabController, TabController>();
94+
services.AddTransient<IRedirectionController, RedirectionController>();
9395

9496
services.AddTransient<IDataContext>(x =>
9597
{

DNN Platform/Website/Default.aspx.cs

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace DotNetNuke.Framework
1515
using System.Web.UI.WebControls;
1616

1717
using DotNetNuke.Abstractions;
18+
using DotNetNuke.Abstractions.Application;
1819
using DotNetNuke.Abstractions.Portals;
1920
using DotNetNuke.Application;
2021
using DotNetNuke.Common.Utilities;
@@ -42,23 +43,34 @@ namespace DotNetNuke.Framework
4243

4344
using DataCache = DotNetNuke.Common.Utilities.DataCache;
4445
using Globals = DotNetNuke.Common.Globals;
46+
using ReleaseMode = DotNetNuke.Abstractions.Application.ReleaseMode;
4547

46-
/// <summary>
47-
/// The DNN default page.
48-
/// </summary>
48+
/// <summary>The DNN default page.</summary>
4949
public partial class DefaultPage : CDefault, IClientAPICallbackEventHandler
5050
{
5151
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(DefaultPage));
5252
private static readonly Regex HeaderTextRegex = new Regex(
5353
"<meta([^>])+name=('|\")robots('|\")",
5454
RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.Compiled);
5555

56-
/// <summary>
57-
/// Initializes a new instance of the <see cref="DefaultPage"/> class.
58-
/// </summary>
56+
private readonly IApplicationInfo appInfo;
57+
private readonly IModuleControlPipeline moduleControlPipeline;
58+
59+
/// <summary>Initializes a new instance of the <see cref="DefaultPage"/> class.</summary>
5960
public DefaultPage()
61+
: this(null, null, null)
6062
{
61-
this.NavigationManager = Globals.GetCurrentServiceProvider().GetRequiredService<INavigationManager>();
63+
}
64+
65+
/// <summary>Initializes a new instance of the <see cref="DefaultPage"/> class.</summary>
66+
/// <param name="navigationManager">The navigation manager.</param>
67+
/// <param name="appInfo">The application info.</param>
68+
/// <param name="moduleControlPipeline">The module control pipeline.</param>
69+
public DefaultPage(INavigationManager navigationManager, IApplicationInfo appInfo, IModuleControlPipeline moduleControlPipeline)
70+
{
71+
this.NavigationManager = navigationManager ?? Globals.GetCurrentServiceProvider().GetRequiredService<INavigationManager>();
72+
this.appInfo = appInfo ?? Globals.GetCurrentServiceProvider().GetRequiredService<IApplicationInfo>();
73+
this.moduleControlPipeline = moduleControlPipeline ?? Globals.GetCurrentServiceProvider().GetRequiredService<IModuleControlPipeline>();
6274
}
6375

6476
public string CurrentSkinPath
@@ -135,6 +147,10 @@ protected string HtmlAttributeList
135147
}
136148
}
137149

150+
private IPortalAliasInfo CurrentPortalAlias => this.PortalSettings.PortalAlias;
151+
152+
private IPortalAliasInfo PrimaryPortalAlias => this.PortalSettings.PrimaryAlias;
153+
138154
/// <inheritdoc/>
139155
public string RaiseClientAPICallbackEvent(string eventArgument)
140156
{
@@ -167,7 +183,7 @@ public string RaiseClientAPICallbackEvent(string eventArgument)
167183
/// <returns>A value indicating whether the current version is not a production version.</returns>
168184
protected bool NonProductionVersion()
169185
{
170-
return DotNetNukeContext.Current.Application.Status != ReleaseMode.Stable;
186+
return this.appInfo.Status != ReleaseMode.Stable;
171187
}
172188

173189
/// <summary>Contains the functionality to populate the Root aspx page with controls.</summary>
@@ -215,7 +231,7 @@ protected override void OnInit(EventArgs e)
215231
}
216232
else
217233
{
218-
this.Response.Redirect(Globals.GetPortalDomainName(this.PortalSettings.PortalAlias.HTTPAlias, this.Request, true), true);
234+
this.Response.Redirect(Globals.GetPortalDomainName(this.CurrentPortalAlias.HttpAlias, this.Request, true), true);
219235
}
220236
}
221237
}
@@ -227,18 +243,18 @@ protected override void OnInit(EventArgs e)
227243
if (Config.GetFriendlyUrlProvider() == "advanced")
228244
{
229245
// advanced mode compares on the primary alias as set during alias identification
230-
if (this.PortalSettings.PrimaryAlias != null && this.PortalSettings.PortalAlias != null)
246+
if (this.PrimaryPortalAlias != null && this.PortalSettings.PortalAlias != null)
231247
{
232-
if (string.Compare(this.PortalSettings.PrimaryAlias.HTTPAlias, this.PortalSettings.PortalAlias.HTTPAlias, StringComparison.InvariantCulture) != 0)
248+
if (string.Compare(this.PrimaryPortalAlias.HttpAlias, this.CurrentPortalAlias.HttpAlias, StringComparison.InvariantCulture) != 0)
233249
{
234-
primaryHttpAlias = this.PortalSettings.PrimaryAlias.HTTPAlias;
250+
primaryHttpAlias = this.PrimaryPortalAlias.HttpAlias;
235251
}
236252
}
237253
}
238254
else
239255
{
240256
// other modes just depend on the default alias
241-
if (string.Compare(this.PortalSettings.PortalAlias.HTTPAlias, this.PortalSettings.DefaultPortalAlias, StringComparison.InvariantCulture) != 0)
257+
if (string.Compare(this.CurrentPortalAlias.HttpAlias, this.PortalSettings.DefaultPortalAlias, StringComparison.InvariantCulture) != 0)
242258
{
243259
primaryHttpAlias = this.PortalSettings.DefaultPortalAlias;
244260
}
@@ -248,7 +264,7 @@ protected override void OnInit(EventArgs e)
248264
{
249265
// a primary http alias was identified
250266
var originalurl = this.Context.Items["UrlRewrite:OriginalUrl"].ToString();
251-
this.CanonicalLinkUrl = originalurl.Replace(this.PortalSettings.PortalAlias.HTTPAlias, primaryHttpAlias);
267+
this.CanonicalLinkUrl = originalurl.Replace(this.CurrentPortalAlias.HttpAlias, primaryHttpAlias);
252268

253269
if (UrlUtils.IsSecureConnectionOrSslOffload(this.Request))
254270
{
@@ -460,27 +476,20 @@ private void InitializePage()
460476
// Skip is popup is just a tab (no slave module)
461477
if (slaveModule.DesktopModuleID != Null.NullInteger)
462478
{
463-
var control = ModuleControlFactory.CreateModuleControl(slaveModule) as IModuleControl;
479+
var control = (IModuleControl)this.moduleControlPipeline.CreateModuleControl(slaveModule);
464480
string extension = Path.GetExtension(slaveModule.ModuleControl.ControlSrc.ToLowerInvariant());
465481
switch (extension)
466482
{
467483
case ".mvc":
468484
var segments = slaveModule.ModuleControl.ControlSrc.Replace(".mvc", string.Empty).Split('/');
469-
470-
control.LocalResourceFile = string.Format(
471-
"~/DesktopModules/MVC/{0}/{1}/{2}.resx",
472-
slaveModule.DesktopModule.FolderName,
473-
Localization.LocalResourceDirectory,
474-
segments[0]);
485+
control.LocalResourceFile =
486+
$"~/DesktopModules/MVC/{slaveModule.DesktopModule.FolderName}/{Localization.LocalResourceDirectory}/{segments[0]}.resx";
475487
break;
476488
default:
477-
control.LocalResourceFile = string.Concat(
478-
slaveModule.ModuleControl.ControlSrc.Replace(
479-
Path.GetFileName(slaveModule.ModuleControl.ControlSrc),
480-
string.Empty),
481-
Localization.LocalResourceDirectory,
482-
"/",
483-
Path.GetFileName(slaveModule.ModuleControl.ControlSrc));
489+
var controlFileName = Path.GetFileName(slaveModule.ModuleControl.ControlSrc);
490+
var controlSrcPath = slaveModule.ModuleControl.ControlSrc.Replace(controlFileName, string.Empty);
491+
control.LocalResourceFile =
492+
$"{controlSrcPath}{Localization.LocalResourceDirectory}/{controlFileName}";
484493
break;
485494
}
486495

@@ -599,8 +608,7 @@ private void InitializePage()
599608
// NonProduction Label Injection
600609
if (this.NonProductionVersion() && Host.DisplayBetaNotice && !UrlUtils.InPopUp())
601610
{
602-
string versionString =
603-
$" ({DotNetNukeContext.Current.Application.Status} Version: {DotNetNukeContext.Current.Application.Version})";
611+
string versionString = $" ({this.appInfo.Status} Version: {this.appInfo.Version})";
604612
this.Title += versionString;
605613
}
606614

DNN Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ namespace DotNetNuke.Modules.Admin.Authentication
1818
using System.Web.UI.WebControls;
1919

2020
using DotNetNuke.Abstractions;
21+
using DotNetNuke.Abstractions.Logging;
22+
using DotNetNuke.Abstractions.Portals;
2123
using DotNetNuke.Common;
2224
using DotNetNuke.Common.Utilities;
23-
using DotNetNuke.Common.Utils;
2425
using DotNetNuke.Entities.Host;
2526
using DotNetNuke.Entities.Modules;
2627
using DotNetNuke.Entities.Portals;
@@ -59,15 +60,25 @@ public partial class Login : UserModuleBase
5960
RegexOptions.IgnoreCase | RegexOptions.Compiled);
6061

6162
private readonly INavigationManager navigationManager;
63+
private readonly IEventLogger eventLogger;
6264

6365
private readonly List<AuthenticationLoginBase> loginControls = new List<AuthenticationLoginBase>();
6466
private readonly List<AuthenticationLoginBase> defaultauthLogin = new List<AuthenticationLoginBase>();
6567
private readonly List<OAuthLoginBase> oAuthControls = new List<OAuthLoginBase>();
6668

6769
/// <summary>Initializes a new instance of the <see cref="Login"/> class.</summary>
6870
public Login()
71+
: this(null, null)
6972
{
70-
this.navigationManager = this.DependencyProvider.GetRequiredService<INavigationManager>();
73+
}
74+
75+
/// <summary>Initializes a new instance of the <see cref="Login"/> class.</summary>
76+
/// <param name="navigationManager">The navigation manager.</param>
77+
/// <param name="eventLogger">The event logger.</param>
78+
public Login(INavigationManager navigationManager, IEventLogger eventLogger)
79+
{
80+
this.navigationManager = navigationManager ?? this.DependencyProvider.GetRequiredService<INavigationManager>();
81+
this.eventLogger = eventLogger ?? this.DependencyProvider.GetRequiredService<IEventLogger>();
7182
}
7283

7384
/// <summary>Gets the Redirect URL (after successful login).</summary>
@@ -107,7 +118,7 @@ protected string RedirectURL
107118
redirectURL = UrlUtils.ValidReturnUrl(redirectURL);
108119
}
109120

110-
var alias = this.PortalAlias.HTTPAlias;
121+
var alias = this.CurrentPortalAlias.HttpAlias;
111122
var comparison = StringComparison.InvariantCultureIgnoreCase;
112123

113124
// we need .TrimEnd('/') because a portlalias for a specific culture will not have a trailing /, while a returnurl will.
@@ -324,8 +335,12 @@ protected string UserName
324335
private bool NeedRedirectAfterLogin =>
325336
this.LoginStatus == UserLoginStatus.LOGIN_SUCCESS
326337
|| this.LoginStatus == UserLoginStatus.LOGIN_SUPERUSER
338+
#pragma warning disable CS0618 // UserLoginStatus.LOGIN_INSECUREHOSTPASSWORD is deprecated
327339
|| this.LoginStatus == UserLoginStatus.LOGIN_INSECUREHOSTPASSWORD
328340
|| this.LoginStatus == UserLoginStatus.LOGIN_INSECUREADMINPASSWORD;
341+
#pragma warning disable CS0618 // UserLoginStatus.LOGIN_INSECUREHOSTPASSWORD is deprecated
342+
343+
private IPortalAliasInfo CurrentPortalAlias => this.PortalSettings.PortalAlias;
329344

330345
/// <summary>Page_Init runs when the control is initialised.</summary>
331346
/// <param name="e">The event arguments.</param>
@@ -550,7 +565,9 @@ protected void PasswordUpdated(object sender, Password.PasswordUpdatedEventArgs
550565
user.Membership.UpdatePassword = false;
551566
this.LoginStatus = user.IsSuperUser ? UserLoginStatus.LOGIN_SUPERUSER : UserLoginStatus.LOGIN_SUCCESS;
552567
UserLoginStatus userstatus = UserLoginStatus.LOGIN_FAILURE;
568+
#pragma warning disable CS0618 // UserController.CheckInsecurePassword is deprecated
553569
UserController.CheckInsecurePassword(user.Username, user.Membership.Password, ref userstatus);
570+
#pragma warning disable CS0618 // UserController.CheckInsecurePassword is deprecated
554571
this.LoginStatus = userstatus;
555572
this.ValidateUser(user, true);
556573
}
@@ -1341,7 +1358,7 @@ private void ValidateUser(UserInfo objUser, bool ignoreExpiring)
13411358
this.pnlProceed.Visible = true;
13421359
break;
13431360
case UserValidStatus.UPDATEPASSWORD:
1344-
var portalAlias = Globals.AddHTTP(this.PortalSettings.PortalAlias.HTTPAlias);
1361+
var portalAlias = Globals.AddHTTP(this.CurrentPortalAlias.HttpAlias);
13451362
if (MembershipProviderConfig.PasswordRetrievalEnabled || MembershipProviderConfig.PasswordResetEnabled)
13461363
{
13471364
UserController.ResetPasswordToken(this.User);
@@ -1403,15 +1420,15 @@ private bool LocaleEnabled(string locale)
14031420

14041421
private void AddEventLog(int userId, string username, int portalId, string propertyName, string propertyValue)
14051422
{
1406-
var log = new LogInfo
1423+
ILogInfo log = new LogInfo
14071424
{
1408-
LogUserID = userId,
14091425
LogUserName = username,
1410-
LogPortalID = portalId,
1411-
LogTypeKey = EventLogController.EventLogType.ADMIN_ALERT.ToString(),
1426+
LogTypeKey = nameof(EventLogType.ADMIN_ALERT),
14121427
};
1428+
log.LogPortalId = portalId;
1429+
log.LogUserId = userId;
14131430
log.AddProperty(propertyName, propertyValue);
1414-
LogController.Instance.AddLog(log);
1431+
this.eventLogger.AddLog(log);
14151432
}
14161433
}
14171434
}

0 commit comments

Comments
 (0)