diff --git a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs index 790d6f6216e..a1ca97129de 100644 --- a/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs +++ b/DNN Platform/DotNetNuke.Web/InternalServices/MessagingServiceController.cs @@ -1,7 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +using DotNetNuke.Security; + namespace DotNetNuke.Web.InternalServices { using System; @@ -64,7 +66,9 @@ public HttpResponseMessage Create(CreateDTO postData) users = userIdsList.Select(id => UserController.Instance.GetUser(portalId, id)).Where(user => user != null).ToList(); } - var message = new Message { Subject = HttpUtility.UrlDecode(postData.Subject), Body = HttpUtility.UrlDecode(postData.Body) }; + var body = HttpUtility.UrlDecode(postData.Body); + body = PortalSecurity.Instance.InputFilter(body, PortalSecurity.FilterFlag.NoMarkup); + var message = new Message { Subject = HttpUtility.UrlDecode(postData.Subject), Body = body }; MessagingController.Instance.SendMessage(message, roles, users, fileIdsList); return this.Request.CreateResponse(HttpStatusCode.OK, new { Result = "success", Value = message.MessageID }); } diff --git a/DNN Platform/Library/Services/Social/Messaging/Internal/Views/MessageConversationView.cs b/DNN Platform/Library/Services/Social/Messaging/Internal/Views/MessageConversationView.cs index e3e75e5a75e..0fb6d260812 100644 --- a/DNN Platform/Library/Services/Social/Messaging/Internal/Views/MessageConversationView.cs +++ b/DNN Platform/Library/Services/Social/Messaging/Internal/Views/MessageConversationView.cs @@ -155,7 +155,7 @@ public void Fill(IDataReader dr) this.To = Null.SetNullString(dr["To"]); this.From = Null.SetNullString(dr["From"]); this.Subject = Null.SetNullString(dr["Subject"]); - this.Body = Null.SetNullString(dr["Body"]); + this.Body = HtmlUtils.ConvertToHtml(Null.SetNullString(dr["Body"])); this.ConversationId = Null.SetNullInteger(dr["ConversationID"]); this.ReplyAllAllowed = Null.SetNullBoolean(dr["ReplyAllAllowed"]); this.SenderUserID = Convert.ToInt32(dr["SenderUserID"]); diff --git a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs index d9c84c45516..daca6eab6d5 100644 --- a/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs +++ b/DNN Platform/Library/Services/Social/Messaging/Scheduler/CoreMessagingScheduler.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information @@ -126,6 +126,7 @@ private static string GetEmailBody(string template, string messageBody, PortalSe template = template.Replace("[PORTALNAME]", portalSettings.PortalName); template = template.Replace("[LOGOURL]", GetPortalLogoUrl(portalSettings)); template = template.Replace("[UNSUBSCRIBEURL]", GetSubscriptionsUrl(portalSettings, recipientUser.UserID)); + template = template.Replace("[YEAR]", DateTime.Now.Year.ToString()); template = ResolveUrl(portalSettings, template); return template; @@ -144,7 +145,7 @@ private static string GetEmailItemContent(PortalSettings portalSettings, Message var emailItemContent = itemTemplate; emailItemContent = emailItemContent.Replace("[TITLE]", messageDetails.Subject); - emailItemContent = emailItemContent.Replace("[CONTENT]", messageDetails.Body); + emailItemContent = emailItemContent.Replace("[CONTENT]", HtmlUtils.ConvertToHtml(messageDetails.Body)); emailItemContent = emailItemContent.Replace("[PROFILEPICURL]", GetProfilePicUrl(portalSettings, authorId)); emailItemContent = emailItemContent.Replace("[PROFILEURL]", GetProfileUrl(portalSettings, authorId)); emailItemContent = emailItemContent.Replace("[DISPLAYNAME]", GetDisplayName(portalSettings, authorId)); diff --git a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs index 9d3ca30ac4a..0d1e8232969 100644 --- a/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs +++ b/DNN Platform/Modules/CoreMessaging/Services/MessagingServiceController.cs @@ -1,7 +1,7 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + namespace DotNetNuke.Modules.CoreMessaging.Services { using System; @@ -11,8 +11,9 @@ namespace DotNetNuke.Modules.CoreMessaging.Services using System.Net.Http; using System.Web; using System.Web.Http; - + using DotNetNuke.Common; + using DotNetNuke.Common.Utilities; using DotNetNuke.Entities.Modules; using DotNetNuke.Entities.Portals; using DotNetNuke.Entities.Users; @@ -117,8 +118,9 @@ public HttpResponseMessage Reply(ReplyDTO postData) { try { - postData.Body = HttpUtility.UrlDecode(postData.Body); - var messageId = InternalMessagingController.Instance.ReplyMessage(postData.ConversationId, postData.Body, postData.FileIds); + var body = HttpUtility.UrlDecode(postData.Body); + body = PortalSecurity.Instance.InputFilter(body, PortalSecurity.FilterFlag.NoMarkup); + var messageId = InternalMessagingController.Instance.ReplyMessage(postData.ConversationId, body, postData.FileIds); var message = this.ToExpandoObject(InternalMessagingController.Instance.GetMessage(messageId)); var portalId = PortalController.GetEffectivePortalId(UserController.Instance.GetCurrentUserInfo().PortalID); diff --git a/DNN Platform/Modules/CoreMessaging/View.ascx b/DNN Platform/Modules/CoreMessaging/View.ascx index c55287d5ae9..62d47584ad2 100644 --- a/DNN Platform/Modules/CoreMessaging/View.ascx +++ b/DNN Platform/Modules/CoreMessaging/View.ascx @@ -114,7 +114,7 @@