Skip to content

Commit

Permalink
Merge pull request #283 from WillStrohl/tasks/release-07.00.07-prep
Browse files Browse the repository at this point in the history
Tasks/release 07.00.07 prep
  • Loading branch information
WillStrohl authored Apr 14, 2023
2 parents 406cbb3 + 89eec64 commit 9333cd3
Show file tree
Hide file tree
Showing 41 changed files with 1,565 additions and 1,744 deletions.
291 changes: 143 additions & 148 deletions ActiveForums.dnn

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions ReleaseNotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
<h3><b>Community Forums</b> Module for DNN</h3>
<hr/>
<div class="dnnClear">
<h3>07.00.07</h3>
<h4>Features, Enhancements, and Bug Fixes</h4>
<ul>
<li>NEW: Improved Caching for Tokens (<a href="https://github.com/DNNCommunity/Dnn.CommunityForums/issues/258">Issue 258</a>, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>NEW: Added New Email Tokens (<a href="https://github.com/DNNCommunity/Dnn.CommunityForums/issues/169">Issue 169</a>, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>NEW: Added Web API Layer for Future Development (<a href="https://github.com/DNNCommunity/Dnn.CommunityForums/issues/268">Issue 268</a>, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>BUG: Templates Not Removed From the Database After Deleting the Module (<a href="https://github.com/DNNCommunity/Dnn.CommunityForums/issues/97">Issue 97</a>, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>TASK: Removed Deprecated DNN APIs (<a href="https://github.com/DNNCommunity/Dnn.CommunityForums/issues/271">Issue 271</a>, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>TASK: Git Cleanup Tasks (No Issue, thanks <a href="https://github.com/johnhenley" target="_blank">@johnhenley</a>!)</li>
<li>TASK: Improved String Handling &amp; Whitespace Cleanup in Many Classes (No Issue, thanks <a href="https://github.com/WillStrohl" target="_blank">@WillStrohl</a>!)</li>
</ul>

<h3>07.00.06</h3>
<h4>Features, Enhancements, and Bug Fixes</h4>
<ul>
Expand Down
1 change: 1 addition & 0 deletions class/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace DotNetNuke.Modules.ActiveForums.API
{
// TODO: Determine if we need to remove this class
public class Content
{
public int Topic_QuickCreate(int PortalId, int ModuleId, int ForumId, string Subject, string Body, int UserId, string DisplayName, bool IsApproved, string IPAddress)
Expand Down
18 changes: 9 additions & 9 deletions class/ActiveAdminBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ public string HostURL
{
get
{
object obj = DataCache.CacheRetrieve(ModuleId + "HostURL");
object obj = DataCache.CacheRetrieve(string.Concat(ModuleId + "HostURL"));
if (obj == null)
{
string sURL;
if (Request.IsSecureConnection)
{
sURL = "https://" + Common.Globals.GetDomainName(Request) + "/";
sURL = string.Concat("https://", Common.Globals.GetDomainName(Request), "/");
}
else
{
sURL = "http://" + Common.Globals.GetDomainName(Request) + "/";
sURL = string.Concat("http://", Common.Globals.GetDomainName(Request), "/");
}
DataCache.CacheStore(ModuleId + "HostURL", sURL, DateTime.UtcNow.AddMinutes(30));
DataCache.CacheStore(string.Concat(ModuleId, "HostURL"), sURL, DateTime.UtcNow.AddMinutes(30));
return sURL;
}
return Convert.ToString(obj);
}
}
public string GetWarningImage(string ImageId, string WarningMessage)
{
return "<img id=\"" + ImageId + "\" onmouseover=\"showTip(this,'" + WarningMessage + "');\" onmouseout=\"hideTip();\" alt=\"" + WarningMessage + "\" height=\"16\" width=\"16\" src=\"" + Page.ResolveUrl(Globals.ModulePath + "images/warning.gif") + "\" />";
return string.Concat("<img id=\"", ImageId, "\" onmouseover=\"showTip(this,'", WarningMessage, "');\" onmouseout=\"hideTip();\" alt=\"", WarningMessage, "\" height=\"16\" width=\"16\" src=\"", Page.ResolveUrl(string.Concat(Globals.ModulePath, "images/warning.gif")), "\" />");
}
protected string GetSharedResource(string key)
{
Expand All @@ -101,7 +101,7 @@ public DateTime CacheUpdatedTime
{
get
{
object obj = DataCache.CacheRetrieve(ModuleId + "CacheUpdate");
object obj = DataCache.CacheRetrieve(string.Concat(ModuleId, "CacheUpdate"));
if (obj != null)
{
return Convert.ToDateTime(obj);
Expand All @@ -110,7 +110,7 @@ public DateTime CacheUpdatedTime
}
set
{
DataCache.CacheStore(ModuleId + "CacheUpdate", value);
DataCache.CacheStore(string.Concat(ModuleId, "CacheUpdate"), value);
_CacheUpdatedTime = value;
}
}
Expand Down Expand Up @@ -142,13 +142,13 @@ protected override void Render(HtmlTextWriter writer)
public Controls.ClientTemplate GetLoadingTemplate()
{
var template = new Controls.ClientTemplate {ID = "LoadingTemplate"};
template.Controls.Add(new LiteralControl("<div class=\"amloading\"><div class=\"amload\"><img src=\"" + Page.ResolveUrl("~/DesktopModules/ActiveForums/images/spinner.gif") + "\" align=\"absmiddle\" alt=\"Loading\" />Loading...</div></div>"));
template.Controls.Add(new LiteralControl(string.Concat("<div class=\"amloading\"><div class=\"amload\"><img src=\"", Page.ResolveUrl("~/DesktopModules/ActiveForums/images/spinner.gif"), "\" align=\"absmiddle\" alt=\"Loading\" />Loading...</div></div>")));
return template;
}
public Controls.ClientTemplate GetLoadingTemplateSmall()
{
var template = new Controls.ClientTemplate {ID = "LoadingTemplate"};
template.Controls.Add(new LiteralControl("<div style=\"text-align:center;font-family:Tahoma;font-size:10px;\"><img src=\"" + Page.ResolveUrl("~/DesktopModules/ActiveForums/images/spinner.gif") + "\" align=\"absmiddle\" alt=\"Loading\" />Loading...</div>"));
template.Controls.Add(new LiteralControl(string.Concat("<div style=\"text-align:center;font-family:Tahoma;font-size:10px;\"><img src=\"", Page.ResolveUrl("~/DesktopModules/ActiveForums/images/spinner.gif"), "\" align=\"absmiddle\" alt=\"Loading\" />Loading...</div>")));
return template;
}
public void BindTemplateDropDown(DropDownList drp, Templates.TemplateTypes TemplateType, string DefaultText, string DefaultValue)
Expand Down
21 changes: 20 additions & 1 deletion class/Attachment.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
using System.Runtime.Serialization;
//
// Community Forums
// Copyright (c) 2013-2021
// by DNN Community
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;

namespace DotNetNuke.Modules.ActiveForums
{
Expand Down
78 changes: 36 additions & 42 deletions class/Cache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public static void ClearAllCache(int ModuleId, int TabId)
ClearAllForumSettingsCache(ModuleId);
ClearSettingsCache(ModuleId);
ClearTemplateCache(ModuleId);
CacheClear(ModuleId + "fv");
CacheClear(ModuleId + "ForumStatTable");
CacheClear(ModuleId + "ForumStatsOutput");
CacheClear(ModuleId + TabId + "ForumTemplate");
CacheClear(string.Concat(ModuleId, "fv"));
CacheClear(string.Concat(ModuleId, "ForumStatTable"));
CacheClear(string.Concat(ModuleId, "ForumStatsOutput"));
CacheClear(string.Concat(ModuleId, TabId, "ForumTemplate"));
}
catch (Exception ex)
{
Expand All @@ -139,15 +139,15 @@ public static void ClearSettingsCache(int ModuleID)
}
public static void ClearForumsByGroupCache(int ModuleID, int GroupID)
{
object obj = CacheRetrieve(ModuleID + GroupID + "ForumsByGroup");
object obj = CacheRetrieve(string.Concat(ModuleID, GroupID, "ForumsByGroup"));
if (obj != null)
{
CacheClear(ModuleID + GroupID + "ForumsByGroup");
CacheClear(string.Concat(ModuleID, GroupID, "ForumsByGroup"));
}
}
public static void ClearForumGroupsCache(int ModuleID)
{
CacheClear(ModuleID + "ForumGroups");
CacheClear(string.Concat(ModuleID, "ForumGroups"));
IDataReader rd;
rd = DataProvider.Instance().Groups_List(ModuleID);
while (rd.Read())
Expand All @@ -158,11 +158,10 @@ public static void ClearForumGroupsCache(int ModuleID)
}
public static void ClearForumSettingsCache(int ForumID)
{
CacheClear(ForumID + "ForumSettings");
CacheClear(string.Concat(ForumID, "ForumSettings"));
CacheClear(string.Format(CacheKeys.ForumInfo, ForumID));
CacheClear(string.Format(CacheKeys.ForumInfo, ForumID) + "st");

}
CacheClear(string.Concat(string.Format(CacheKeys.ForumInfo, ForumID), "st"));
}
public static void ClearAllForumSettingsCache(int ModuleID)
{
try
Expand All @@ -177,17 +176,17 @@ public static void ClearAllForumSettingsCache(int ModuleID)
int TopicTemplateId;
TopicsTemplateId = Convert.ToInt32(rd["TopicsTemplateId"]);
TopicTemplateId = Convert.ToInt32(rd["TopicTemplateId"]);
CacheClear(intForumID + "ForumSettings");
CacheClear(ModuleID + TopicsTemplateId + "TopicsTemplate");
CacheClear(ModuleID + TopicTemplateId + "TopicTemplate");
CacheClear(string.Concat(intForumID, "ForumSettings"));
CacheClear(string.Concat(ModuleID + TopicsTemplateId, "TopicsTemplate"));
CacheClear(string.Concat(ModuleID + TopicTemplateId, "TopicTemplate"));
CacheClear(string.Format(CacheKeys.ForumInfo, intForumID));
CacheClear(string.Format(CacheKeys.ForumInfo, intForumID) + "st");
CacheClear(string.Concat(string.Format(CacheKeys.ForumInfo, intForumID), "st"));
}
rd.Close();
}
catch (Exception ex)
catch
{

// do nothing?
}

}
Expand All @@ -196,20 +195,19 @@ public static void ClearFilterCache(int ModuleID)
object obj = CacheRetrieve(ModuleID + "FilterList");
if (obj != null)
{
//Current.Cache.Remove(ModuleID & "FilterList")
CacheClear(ModuleID + "FilterList");
CacheClear(string.Concat(ModuleID, "FilterList"));
}
}
public static void ClearTemplateCache(int ModuleId)
{
try
{
if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(Globals.ModulePath + "cache")))
if (System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(string.Concat(Globals.ModulePath, "cache"))))
{
var di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(Globals.ModulePath + "cache"));
var di = new System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath(string.Concat(Globals.ModulePath, "cache")));
foreach (System.IO.FileInfo fi in di.GetFiles())
{
if ((fi.FullName.IndexOf(ModuleId + "_", 0) + 1) > 0)
if ((fi.FullName.IndexOf(string.Concat(ModuleId, "_"), 0) + 1) > 0)
{
fi.Delete();
}
Expand All @@ -219,15 +217,15 @@ public static void ClearTemplateCache(int ModuleId)
}
catch (Exception ex)
{
//DotNetNuke.Services.Exceptions.Exceptions.LogException(ex)
// do nothing?
}
}
public static Hashtable GetSettings(int ModuleId, string SettingsKey, string CacheKey, bool UseCache)
{
var ht = new Hashtable();
if (UseCache)
{
object obj = CacheRetrieve(CacheKey + "st");
object obj = CacheRetrieve(string.Concat(CacheKey, "st"));
if (obj == null)
{
IDataReader dr = DataProvider.Instance().Settings_List(ModuleId, SettingsKey);
Expand All @@ -240,9 +238,8 @@ public static Hashtable GetSettings(int ModuleId, string SettingsKey, string Cac
ht[dr["SettingName"].ToString()] = dr["SettingValue"].ToString();
}
dr.Close();
CacheStore(CacheKey + "st", ht);
//Current.Cache.Insert(ModuleId & SettingsKey & "Settings", ht, Nothing, DateTime.UtcNow.AddMinutes(10), Web.Caching.Cache.NoSlidingExpiration)
}
CacheStore(string.Concat(CacheKey, "st"), ht);
}
else
{
ht = (Hashtable)obj;
Expand All @@ -269,9 +266,9 @@ public static Hashtable GetSettings(int ModuleId, string SettingsKey, string Cac
private static void CacheTemplateToDisk(int ModuleId, int TemplateId, string TemplateType, string Template)
{
string myFile;
string FileName = ModuleId + "_" + TemplateId + TemplateType + ".resources";
string FileName = string.Concat(ModuleId, "_", TemplateId, TemplateType, ".resources");
string strPath;
strPath = HttpContext.Current.Request.MapPath(Globals.ModulePath + "cache\\");
strPath = HttpContext.Current.Request.MapPath(string.Concat(Globals.ModulePath, "cache\\"));
if (! (System.IO.Directory.Exists(strPath)))
{
try
Expand All @@ -280,14 +277,13 @@ private static void CacheTemplateToDisk(int ModuleId, int TemplateId, string Tem
}
catch (Exception ex)
{
// DotNetNuke.Services.Exceptions.Exceptions.LogException(ex)
return;
}

}
try
{
myFile = HttpContext.Current.Request.MapPath(Globals.ModulePath + "cache\\") + FileName;
myFile = HttpContext.Current.Request.MapPath(string.Concat(Globals.ModulePath, "cache\\")) + FileName;
if (System.IO.File.Exists(myFile))
{
try
Expand All @@ -305,12 +301,12 @@ private static void CacheTemplateToDisk(int ModuleId, int TemplateId, string Tem
}
catch (Exception ex)
{
// DotNetNuke.Services.Exceptions.Exceptions.LogException(ex)
// do nothing??
}
}
catch (Exception ex)
{
//DotNetNuke.Services.Exceptions.Exceptions.LogException(ex)
// do nothing??
}
}
#endregion
Expand Down Expand Up @@ -355,7 +351,7 @@ private static string GetTemplateFromMemory(int ModuleId, string TemplateType, i
{
try
{
myFile = HttpContext.Current.Server.MapPath(Globals.DefaultTemplatePath + TemplateType + ".txt");
myFile = HttpContext.Current.Server.MapPath(string.Concat(Globals.DefaultTemplatePath + TemplateType, ".txt"));
if (System.IO.File.Exists(myFile))
{
System.IO.StreamReader objStreamReader = null;
Expand All @@ -370,8 +366,7 @@ private static string GetTemplateFromMemory(int ModuleId, string TemplateType, i
sTemplate = objStreamReader.ReadToEnd();
objStreamReader.Close();
sTemplate = Utilities.ParseSpacer(sTemplate);
CacheStore(ModuleId + TemplateId + TemplateType, sTemplate);
//Current.Cache.Insert(ModuleId & TemplateId & TemplateType, sTemplate, New System.Web.Caching.CacheDependency(Current.Server.MapPath("~/DesktopModules/ActiveForums/config/Templates/" & TemplateType & ".txt")))
CacheStore(string.Concat(ModuleId, TemplateId, TemplateType), sTemplate);
}
}
catch (Exception ex)
Expand All @@ -395,7 +390,7 @@ private static string GetTemplateFromDisk(int ModuleId, string TemplateType, int
{
string sTemplate;
string myFile;
string FileName = ModuleId + "_" + TemplateId + TemplateType + ".resources";
string FileName = string.Concat(ModuleId, "_", TemplateId, TemplateType, ".resources");
System.IO.StreamReader objStreamReader;
if (_disableCache)
{
Expand All @@ -405,7 +400,7 @@ private static string GetTemplateFromDisk(int ModuleId, string TemplateType, int
{
try
{
myFile = HttpContext.Current.Request.MapPath(Globals.ModulePath + "cache\\") + FileName;
myFile = HttpContext.Current.Request.MapPath(string.Concat(Globals.ModulePath, "cache\\")) + FileName;
if (System.IO.File.Exists(myFile))
{
try
Expand Down Expand Up @@ -445,7 +440,7 @@ private static string GetTemplate(int TemplateId, string TemplateType)
{
try
{
string myFile = HttpContext.Current.Server.MapPath(Globals.DefaultTemplatePath + TemplateType + ".txt");
string myFile = HttpContext.Current.Server.MapPath(string.Concat(Globals.DefaultTemplatePath, TemplateType, ".txt"));
if (System.IO.File.Exists(myFile))
{
System.IO.StreamReader objStreamReader = null;
Expand Down Expand Up @@ -526,6 +521,5 @@ internal static string GetTemplate(string TemplateFileName)
}
#endregion


}
}
}
}
Loading

0 comments on commit 9333cd3

Please sign in to comment.