")
- if (Regex.IsMatch(sBody, "\\[CODE([^>]*)\\]", RegexOptions.IgnoreCase))
+ if (Regex.IsMatch(body, "\\[CODE([^>]*)\\]", RegexOptions.IgnoreCase))
{
- var objCode = new CodeParser();
- sBody = CodeParser.ParseCode(HttpUtility.HtmlDecode(sBody));
+ body = CodeParser.ParseCode(HttpUtility.HtmlDecode(body));
}
- sBody = Utilities.StripExecCode(sBody);
+ body = Utilities.StripExecCode(body);
if (mainSettings.AutoLinkEnabled)
{
- sBody = Utilities.AutoLinks(sBody, uri.Host);
+ body = Utilities.AutoLinks(body, uri.Host);
}
- if (sBody.Contains("<%@"))
+ if (body.Contains("<%@"))
{
- sBody = sBody.Replace("<%@ ", "<%@ ");
+ body = body.Replace("<%@ ", "<%@ ");
}
- if (content.Body.ToLowerInvariant().Contains("runat"))
+ if (body.ToLowerInvariant().Contains("runat"))
{
- sBody = Regex.Replace(sBody, "runat", "runat", RegexOptions.IgnoreCase);
+ body = Regex.Replace(body, "runat", "runat", RegexOptions.IgnoreCase);
}
}
- return sBody;
+ return body;
}
internal static StringBuilder ReplacePostTokens(StringBuilder template, IPostInfo post, PortalSettings portalSettings, SettingsInfo mainSettings, INavigationManager navigationManager, ForumUserInfo forumUser, Uri requestUri, string rawUrl)
{
+ /* if likes not allowed for forum, remove like-related tokens */
+ if (!post.Forum.AllowLikes)
+ {
+ template = RemovePrefixedToken(template, "[FORUMPOST:LINKONCLICK");
+ template = RemovePrefixedToken(template, "[FORUMPOST:LIKECOUNT");
+ template = RemovePrefixedToken(template, "[FORUMPOST:ISLIKED");
+ }
+
// Perform Profile Related replacements
var author = new AuthorInfo(post.PortalId, post.Forum.ModuleId, post.Author.AuthorId);
if (template.ToString().Contains("[POSTINFO]"))
@@ -360,7 +364,7 @@ internal static StringBuilder ReplacePostTokens(StringBuilder template, IPostInf
template.Replace("[POSTINFO]", sPostInfo);
}
- post.Content.Body = ReplaceBody(post.Content, mainSettings, requestUri).Replace("
", " ");
+ post.Content.Body = ReplaceBody(post.Content.Body, mainSettings, requestUri).Replace("
", " ");
template = ResourceStringTokenReplacer.ReplaceResourceTokens(template);
var tokenReplacer = new TokenReplacer(portalSettings, forumUser, post, requestUri, rawUrl) { AccessingUser = forumUser.UserInfo, };
@@ -407,7 +411,7 @@ internal static StringBuilder ReplaceDateToken(StringBuilder template, string to
return template;
}
-
+
internal static StringBuilder RemoveObsoleteTokens(StringBuilder template)
{
// no longer using this
@@ -932,6 +936,10 @@ internal static StringBuilder MapLegacyPostTokenSynonyms(StringBuilder template,
template = ReplaceLegacyTokenWithFormatString(template, portalSettings, language, "[LINK]", "[FORUMPOST:LINK", "[LINK]");
template = ReplaceLegacyTokenWithFormatString(template, portalSettings, language, "[HYPERLINK]", "[FORUMPOST:LINK", "[LINK]");
+ template = ReplaceLegacyTokenWithFormatString(template, portalSettings, language, "[LIKES]", "[FORUMPOST:LIKEONCLICK", "[LIKESx1]");
+ template = ReplaceLegacyTokenWithFormatString(template, portalSettings, language, "[LIKESx2]", "[FORUMPOST:LIKEONCLICK", "[LIKESx2]");
+ template = ReplaceLegacyTokenWithFormatString(template, portalSettings, language, "[LIKESx3]", "[FORUMPOST:LIKEONCLICK", "[LIKESx3]");
+
return template;
}
diff --git a/Dnn.CommunityForums/scripts/afcommon.js b/Dnn.CommunityForums/scripts/afcommon.js
index ad4d5feee..a01af10f4 100644
--- a/Dnn.CommunityForums/scripts/afcommon.js
+++ b/Dnn.CommunityForums/scripts/afcommon.js
@@ -282,9 +282,12 @@ function amaf_likePost(mid, fid, cid) {
url: dnn.getVar("sf_siteRoot", "/") + 'API/ActiveForums/Like/Like',
beforeSend: sf.setModuleHeaders
}).done(function (data) {
+ $('#af-topicview-likes-' + cid).toggleClass('fa-thumbs-up').toggleClass('fa-thumbs-o-up').text(" " + data);
+ /* these are for backward compatibility and can be remove in v10 */
$('#af-topicview-likes1-' + cid).toggleClass('fa-thumbs-up').toggleClass('fa-thumbs-o-up').text(" " + data);
$('#af-topicview-likes2-' + cid).toggleClass('fa-thumbs-up').toggleClass('fa-thumbs-o-up').text(" " + data);
$('#af-topicview-likes3-' + cid).toggleClass('fa-thumbs-up').toggleClass('fa-thumbs-o-up').text(" " + data);
+ /* these are for backward compatibility and can be remove in v10 */
}).fail(function (xhr, status) {
alert('error liking post');
});
diff --git a/Dnn.CommunityForums/themes/community-bootstrap/templates/TopicView.ascx b/Dnn.CommunityForums/themes/community-bootstrap/templates/TopicView.ascx
index e3c72fe4b..8d7b945b7 100644
--- a/Dnn.CommunityForums/themes/community-bootstrap/templates/TopicView.ascx
+++ b/Dnn.CommunityForums/themes/community-bootstrap/templates/TopicView.ascx
@@ -95,10 +95,10 @@
[FORUMPOST:MODEDITDATE]
-
- [LIKESx2]
-
-
+
+ [FORUMPOST:LIKEONCLICK| [FORUMPOST:LIKECOUNT]| [FORUMPOST:LIKECOUNT]]
+
+
@@ -145,9 +145,9 @@
[FORUMPOST:MODEDITDATE]
-
- [LIKESx2]
-
+
+ [FORUMPOST:LIKEONCLICK| [FORUMPOST:LIKECOUNT]| [FORUMPOST:LIKECOUNT]]
+
diff --git a/Dnn.CommunityForums/themes/community-default/templates/TopicView.ascx b/Dnn.CommunityForums/themes/community-default/templates/TopicView.ascx
index c9c5d4775..fae30fa26 100644
--- a/Dnn.CommunityForums/themes/community-default/templates/TopicView.ascx
+++ b/Dnn.CommunityForums/themes/community-default/templates/TopicView.ascx
@@ -101,9 +101,9 @@
[FORUMPOST:MODEDITDATE]
-
- [LIKESx2]
-
+
+ [FORUMPOST:LIKEONCLICK| [FORUMPOST:LIKECOUNT]| [FORUMPOST:LIKECOUNT]]
+
@@ -156,9 +156,9 @@
[FORUMPOST:MODEDITDATE]
-
- [LIKESx2]
-
+
+ [FORUMPOST:LIKEONCLICK| [FORUMPOST:LIKECOUNT]| [FORUMPOST:LIKECOUNT]]
+