public string GetUsersOnline(int portalId, int moduleId, User user) { var sb = new StringBuilder(); var dr = DataProvider.Instance().Profiles_GetUsersOnline(portalId, moduleId, 2); try { var mainSettings = DataCache.MainSettings(moduleId); while (dr.Read()) { if (sb.Length > 0) { sb.Append(", "); } sb.Append(UserProfiles.GetDisplayName(moduleId, true, false, user.IsAdmin || user.IsSuperUser, dr.GetInt("UserId"), dr.GetString("Username"), dr.GetString("FirstName"), dr.GetString("LastName"), dr.GetString("DisplayName"))); } dr.Close(); return(sb.ToString()); } catch (Exception ex) { if (!dr.IsClosed) { dr.Close(); } return(string.Empty); } }
public string GetLastPostAuthor() { if (_currentRow == null) { return(null); } var userId = Convert.ToInt32(_currentRow["LastReplyAuthorId"]); var userName = _currentRow["LastReplyUserName"].ToString(); var firstName = _currentRow["LastReplyFirstName"].ToString(); var lastName = _currentRow["LastReplyLastName"].ToString(); var displayName = _currentRow["LastReplyDisplayName"].ToString(); return(UserProfiles.GetDisplayName(ModuleId, true, false, ForumUser.IsAdmin, userId, userName, firstName, lastName, displayName)); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); string sDisplayName = string.Empty; int tUid = -1; if (Request.Params["UID"] != null) { if (SimulateIsNumeric.IsNumeric(Request.Params["UID"])) { tUid = Convert.ToInt32(Request.Params["UID"]); DotNetNuke.Entities.Users.UserController uc = new DotNetNuke.Entities.Users.UserController(); DotNetNuke.Entities.Users.UserInfo ui = uc.GetUser(PortalId, tUid); if (ui != null) { sDisplayName = UserProfiles.GetDisplayName(ModuleId, ui.UserID, ui.Username, ui.FirstName, ui.LastName, ui.DisplayName); } } } else { tUid = UserId; sDisplayName = UserProfiles.GetDisplayName(ModuleId, UserId, UserInfo.Username, UserInfo.FirstName, UserInfo.LastName, UserInfo.DisplayName); } lblHeader.Text = string.Format(Utilities.GetSharedResource("[RESX:ProfileForUser]"), sDisplayName); if (MainSettings.UseSkinBreadCrumb) { Environment.UpdateBreadCrumb(Page.Controls, "<a href=\"" + Utilities.NavigateUrl(TabId, "", new string[] { "afv=profile", "uid=" + tUid.ToString() }) + "\">" + lblHeader.Text + "</a>"); } DotNetNuke.Framework.CDefault tempVar = this.BasePage; Environment.UpdateMeta(ref tempVar, "[VALUE] - " + lblHeader.Text, "[VALUE]", "[VALUE]"); SettingsBase ctl = null; ctl = (SettingsBase)(new DotNetNuke.Modules.ActiveForums.Controls.UserProfile()); ctl.ModuleConfiguration = this.ModuleConfiguration; if (!(this.Params == string.Empty)) { ctl.Params = this.Params; } plhProfile.Controls.Add(ctl); }
public static string ParseProfileTemplate(string profileTemplate, User up, int portalId, int moduleId, string imagePath, CurrentUserTypes currentUserType, bool legacyTemplate, bool userPrefHideAvatar, bool userPrefHideSignature, string ipAddress, int currentUserId, int timeZoneOffset) { try { if (legacyTemplate) { profileTemplate = CleanTemplate(profileTemplate); } if (up.Profile == null) { up = new UserController().FillProfile(portalId, -1, up); } // TODO figure out why/if this recurion is possible. Seems a bit scary as it could create a loop. if (profileTemplate.Contains("[POSTINFO]")) { var sPostInfo = GetPostInfo(portalId, moduleId, up.UserId, up.UserName, up, imagePath, false, ipAddress, up.Profile.IsUserOnline, currentUserType, currentUserId, userPrefHideAvatar, timeZoneOffset); profileTemplate = profileTemplate.Replace("[POSTINFO]", sPostInfo); } var mainSettings = DataCache.MainSettings(moduleId); // Parse DNN profile fields if needed var pt = profileTemplate; if (pt.IndexOf("[DNN:PROFILE:", StringComparison.Ordinal) >= 0) { pt = ParseProfile(portalId, up.UserId, pt, currentUserType, currentUserId); } // Parse Roles if (pt.Contains("[ROLES:")) { pt = ParseRoles(pt, (up.UserId == -1) ? string.Empty : up.Profile.Roles); } var result = new StringBuilder(pt); // Used in a few places to determine if info should be shown or removed. var isMod = (currentUserType == CurrentUserTypes.Admin || currentUserType == CurrentUserTypes.ForumMod || currentUserType == CurrentUserTypes.SuperUser); // Used in a few places to determine if info should be shown or removed. var isAdmin = (currentUserType == CurrentUserTypes.Admin || currentUserType == CurrentUserTypes.SuperUser); var isAuthethenticated = currentUserType != CurrentUserTypes.Anon; // IP Address result.Replace("[MODIPADDRESS]", isMod ? ipAddress : string.Empty); // User Edit result.Replace("[AF:BUTTON:EDITUSER]", isAdmin && up.UserId > 0 ? string.Format("<button class='af-button af-button-edituser' data-id='{0}' data-name='{1}'>[RESX:Edit]</button>", up.UserId, Utilities.JSON.EscapeJsonString(up.DisplayName)) : string.Empty); // Points var totalPoints = up.PostCount; if (mainSettings.EnablePoints && up.UserId > 0 && up.Profile != null) { totalPoints = (up.Profile.TopicCount * mainSettings.TopicPointValue) + (up.Profile.ReplyCount * mainSettings.ReplyPointValue) + (up.Profile.AnswerCount * mainSettings.AnswerPointValue) + up.Profile.RewardPoints; result.Replace("[AF:PROFILE:TOTALPOINTS]", totalPoints.ToString()); result.Replace("[AF:POINTS:VIEWCOUNT]", up.Profile.ViewCount.ToString()); result.Replace("[AF:POINTS:ANSWERCOUNT]", up.Profile.AnswerCount.ToString()); result.Replace("[AF:POINTS:REWARDPOINTS]", up.Profile.RewardPoints.ToString()); } else { result.Replace("[AF:PROFILE:TOTALPOINTS]", string.Empty); result.Replace("[AF:POINTS:VIEWCOUNT]", string.Empty); result.Replace("[AF:POINTS:ANSWERCOUNT]", string.Empty); result.Replace("[AF:POINTS:REWARDPOINTS]", string.Empty); } // User Status var sUserStatus = string.Empty; if (mainSettings.UsersOnlineEnabled && up.UserId > 0 && up.Profile != null) { sUserStatus = UserProfiles.UserStatus(imagePath, up.Profile.IsUserOnline, up.UserId, moduleId, "[RESX:UserOnline]", "[RESX:UserOffline]"); } result.Replace("[AF:PROFILE:USERSTATUS]", sUserStatus); result.Replace("[AF:PROFILE:USERSTATUS:CSS]", sUserStatus.Contains("online") ? "af-status-online" : "af-status-offline"); // Rank result.Replace("[AF:PROFILE:RANKDISPLAY]", (up.UserId > 0) ? UserProfiles.GetUserRank(portalId, moduleId, up.UserId, totalPoints, 0) : string.Empty); result.Replace("[AF:PROFILE:RANKNAME]", (up.UserId > 0) ? UserProfiles.GetUserRank(portalId, moduleId, up.UserId, totalPoints, 1) : string.Empty); // PM Image/link var pmUrl = string.Empty; var pmLink = string.Empty; if (up.UserId > 0 && currentUserId >= 0 && up.UserId != currentUserId) { switch (mainSettings.PMType) { case PMTypes.Core: pmLink = "<img class='ComposeMessage' data-recipient='{ \"id\": \"user-" + up.UserId + "\", \"name\": \"" + HttpUtility.JavaScriptStringEncode(up.DisplayName) + "\"}' src='" + imagePath + "/images/icon_pm.png' alt=\"[RESX:SendPM]\" title=\"[RESX:SendPM]\" border=\"0\" /></a>"; break; case PMTypes.Ventrian: pmUrl = Common.Globals.NavigateURL(mainSettings.PMTabId, string.Empty, new[] { "type=compose", "sendto=" + up.UserId }); pmLink = "<a href=\"" + pmUrl + "\"><img src=\"" + imagePath + "/images/icon_pm.png\" alt=\"[RESX:SendPM]\" border=\"0\" /></a>"; break; } } result.Replace("[AF:PROFILE:PMLINK]", pmLink); result.Replace("[AF:PROFILE:PMURL]", pmUrl); // Signature var sSignature = string.Empty; if (mainSettings.AllowSignatures != 0 && !userPrefHideSignature && up.Profile != null && !up.Profile.SignatureDisabled) { sSignature = up.Profile.Signature; if (sSignature != string.Empty) { sSignature = Utilities.ManageImagePath(sSignature); } switch (mainSettings.AllowSignatures) { case 1: sSignature = Utilities.HTMLEncode(sSignature); sSignature = sSignature.Replace(System.Environment.NewLine, "<br />"); break; case 2: sSignature = Utilities.HTMLDecode(sSignature); break; } } result.Replace("[AF:PROFILE:SIGNATURE]", sSignature); // Avatar var sAvatar = string.Empty; if (!userPrefHideAvatar && !up.Profile.AvatarDisabled) { sAvatar = UserProfiles.GetAvatar(up.UserId, mainSettings.AvatarWidth, mainSettings.AvatarHeight); } result.Replace("[AF:PROFILE:AVATAR]", sAvatar); // Display Name result.Replace("[AF:PROFILE:DISPLAYNAME]", UserProfiles.GetDisplayName(moduleId, true, isMod, isAdmin, up.UserId, up.UserName, up.FirstName, up.LastName, up.DisplayName)); // These fields are no longer used result.Replace("[AF:PROFILE:LOCATION]", string.Empty); result.Replace("[AF:PROFILE:WEBSITE]", string.Empty); result.Replace("[AF:PROFILE:YAHOO]", string.Empty); result.Replace("[AF:PROFILE:MSN]", string.Empty); result.Replace("[AF:PROFILE:ICQ]", string.Empty); result.Replace("[AF:PROFILE:AOL]", string.Empty); result.Replace("[AF:PROFILE:OCCUPATION]", string.Empty); result.Replace("[AF:PROFILE:INTERESTS]", string.Empty); result.Replace("[AF:CONTROL:AVATAREDIT]", string.Empty); result.Replace("[AF:BUTTON:PROFILEEDIT]", string.Empty); result.Replace("[AF:BUTTON:PROFILESAVE]", string.Empty); result.Replace("[AF:BUTTON:PROFILECANCEL]", string.Empty); result.Replace("[AF:PROFILE:BIO]", string.Empty); result.Replace("[MODUSERSETTINGS]", string.Empty); // Date Created var sDateCreated = string.Empty; var sDateCreatedReplacement = "[AF:PROFILE:DATECREATED]"; if (up.UserId > 0 && up.Profile != null && up.Profile.DateCreated != null) { if (pt.Contains("[AF:PROFILE:DATECREATED:")) { var sFormat = pt.Substring(pt.IndexOf("[AF:PROFILE:DATECREATED:", StringComparison.Ordinal) + (sDateCreatedReplacement.Length), 1); sDateCreated = up.Profile.DateCreated.ToString(sFormat); sDateCreatedReplacement = "[AF:PROFILE:DATECREATED:" + sFormat + "]"; } else { sDateCreated = Utilities.GetDate(up.Profile.DateCreated, moduleId, timeZoneOffset); } } result.Replace(sDateCreatedReplacement, sDateCreated); // Last Activity var sDateLastActivity = string.Empty; var sDateLastActivityReplacement = "[AF:PROFILE:DATELASTACTIVITY]"; if (up.Profile.DateLastActivity != null && up.UserId > 0) { if (pt.Contains("[AF:PROFILE:DATELASTACTIVITY:")) { string sFormat = pt.Substring(pt.IndexOf("[AF:PROFILE:DATELASTACTIVITY:", StringComparison.Ordinal) + (sDateLastActivityReplacement.Length), 1); sDateLastActivity = up.Profile.DateLastActivity.ToString(sFormat); sDateLastActivityReplacement = "[AF:PROFILE:DATELASTACTIVITY:" + sFormat + "]"; } else { sDateLastActivity = Utilities.GetDate(up.Profile.DateLastActivity, moduleId, timeZoneOffset); } } result.Replace(sDateLastActivityReplacement, sDateLastActivity); // Post Count result.Replace("[AF:PROFILE:POSTCOUNT]", (up.PostCount == 0) ? string.Empty : up.PostCount.ToString()); result.Replace("[AF:PROFILE:USERCAPTION]", up.Profile.UserCaption); result.Replace("[AF:PROFILE:USERID]", up.UserId.ToString()); result.Replace("[AF:PROFILE:USERNAME]", Utilities.HTMLEncode(up.UserName).Replace("&#", "&#")); result.Replace("[AF:PROFILE:FIRSTNAME]", Utilities.HTMLEncode(up.FirstName).Replace("&#", "&#")); result.Replace("[AF:PROFILE:LASTNAME]", Utilities.HTMLEncode(up.LastName).Replace("&#", "&#")); result.Replace("[AF:PROFILE:DATELASTPOST]", (up.Profile.DateLastPost == DateTime.MinValue) ? string.Empty : Utilities.GetDate(up.Profile.DateLastPost, moduleId, timeZoneOffset)); result.Replace("[AF:PROFILE:TOPICCOUNT]", up.Profile.TopicCount.ToString()); result.Replace("[AF:PROFILE:REPLYCOUNT]", up.Profile.ReplyCount.ToString()); result.Replace("[AF:PROFILE:ANSWERCOUNT]", up.Profile.AnswerCount.ToString()); result.Replace("[AF:PROFILE:REWARDPOINTS]", up.Profile.RewardPoints.ToString()); return(result.ToString()); } catch (Exception ex) { return(ex.Message); } }
public static string ParseEmailTemplate(string template, string templateName, int portalID, int moduleID, int tabID, int forumID, int topicId, int replyId, string comments, Entities.Users.UserInfo user, int userId, int timeZoneOffset) { var portalSettings = (Entities.Portals.PortalSettings)(HttpContext.Current.Items["PortalSettings"]); var ms = DataCache.MainSettings(moduleID); var sOut = template; // If we have a template name, load the template into sOut if (templateName != string.Empty) { if (templateName.Contains("_Subject_")) { templateName = templateName.Replace("_Subject_" + moduleID, string.Empty); var objTemplate = GetTemplateByName(templateName, moduleID, portalID); sOut = objTemplate.Subject; } else { var objTemplate = GetTemplateByName(templateName, moduleID, portalID); sOut = objTemplate.TemplateHTML; } } // Load Subject and body from topic or reply var subject = string.Empty; var body = string.Empty; var dateCreated = Utilities.NullDate(); var authorName = string.Empty; if (topicId > 0 && replyId > 0) { var ri = new ReplyController().Reply_Get(portalID, moduleID, topicId, replyId); if (ri != null) { subject = ri.Content.Subject; body = ri.Content.Body; dateCreated = ri.Content.DateCreated; authorName = ri.Content.AuthorName; } } else { var ti = new TopicsController().Topics_Get(portalID, moduleID, topicId); if (ti != null) { subject = ti.Content.Subject; body = ti.Content.Body; dateCreated = ti.Content.DateCreated; authorName = ti.Content.AuthorName; } } body = Utilities.ManageImagePath(body, Common.Globals.AddHTTP(Common.Globals.GetDomainName(HttpContext.Current.Request))); // load the forum information var fi = new ForumController().Forums_Get(forumID, -1, false); // Load the user if needed if (user == null) { var objUsers = new Entities.Users.UserController(); var objUser = objUsers.GetUser(portalID, userId); user = objUser; } // Load the user properties string sFirstName; string sLastName; string sDisplayName; string sUsername; if (user != null) { sFirstName = user.FirstName; sLastName = user.LastName; sDisplayName = user.DisplayName; sUsername = user.Username; } else { sFirstName = string.Empty; sLastName = string.Empty; sDisplayName = string.Empty; sUsername = string.Empty; } // Build the link string link; if (string.IsNullOrEmpty(fi.PrefixURL) || !Utilities.IsRewriteLoaded()) { if (replyId == 0) { link = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.TopicId + "=" + topicId }) : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + topicId }); } else { link = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId }) : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + topicId, ParamKeys.ContentJumpId + "=" + replyId }); } } else { var contentId = (replyId > 0) ? replyId : -1; link = new Data.Common().GetUrl(moduleID, -1, forumID, topicId, -1, contentId); } if (!(link.StartsWith("http"))) { if (!link.StartsWith("/")) { link = "/" + link; } if (link.IndexOf(HttpContext.Current.Request.Url.Host, StringComparison.Ordinal) == -1) { link = Common.Globals.AddHTTP(HttpContext.Current.Request.Url.Host) + link; } } // Build the forum Url var forumURL = ms.UseShortUrls ? Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID }) : Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ForumId + "=" + forumID, ParamKeys.ViewType + "=" + Views.Topics }); // Build Moderation url var modLink = Common.Globals.NavigateURL(tabID, string.Empty, new[] { ParamKeys.ViewType + "=modtopics", ParamKeys.ForumId + "=" + forumID }); if (modLink.IndexOf(HttpContext.Current.Request.Url.Host, StringComparison.Ordinal) == -1) { modLink = Common.Globals.AddHTTP(HttpContext.Current.Request.Url.Host) + modLink; } var result = new StringBuilder(sOut); result.Replace("[DISPLAYNAME]", UserProfiles.GetDisplayName(moduleID, userId, authorName, sFirstName, sLastName, sDisplayName)); result.Replace("[USERNAME]", sUsername); result.Replace("[USERID]", userId.ToString()); result.Replace("[FORUMNAME]", fi.ForumName); result.Replace("[PORTALID]", portalID.ToString()); result.Replace("[FIRSTNAME]", sFirstName); result.Replace("[LASTNAME]", sLastName); result.Replace("[FULLNAME]", sFirstName + " " + sLastName); result.Replace("[GROUPNAME]", fi.GroupName); result.Replace("[POSTDATE]", Utilities.GetDate(dateCreated, moduleID, timeZoneOffset)); result.Replace("[COMMENTS]", comments); result.Replace("[PORTALNAME]", portalSettings.PortalName); result.Replace("[MODLINK]", "<a href=\"" + modLink + "\">" + modLink + "</a>"); result.Replace("[LINK]", "<a href=\"" + link + "\">" + link + "</a>"); result.Replace("[HYPERLINK]", "<a href=\"" + link + "\">" + link + "</a>"); result.Replace("[LINKURL]", link); result.Replace("[FORUMURL]", forumURL); result.Replace("[FORUMLINK]", "<a href=\"" + forumURL + "\">" + forumURL + "</a>"); if (user != null) { result.Replace("[SENDERUSERNAME]", user.UserID.ToString()); result.Replace("[SENDERFIRSTNAME]", user.FirstName); result.Replace("[SENDERLASTNAME]", user.LastName); result.Replace("[SENDERDISPLAYNAME]", user.DisplayName); } else { result.Replace("[SENDERUSERNAME]", string.Empty); result.Replace("[SENDERFIRSTNAME]", string.Empty); result.Replace("[SENDERLASTNAME]", string.Empty); result.Replace("[SENDERDISPLAYNAME]", string.Empty); } result.Replace("[SUBJECT]", subject); result.Replace("[BODY]", body); result.Replace("[Body]", body); return(result.ToString()); }
private string BuildItem(DataRow dr, int PostTabID, int Indent, bool IncludeBody, int PortalId) { SettingsInfo MainSettings = DataCache.MainSettings(ModuleID); StringBuilder sb = new StringBuilder(1024); string[] Params = { ParamKeys.ForumId + "=" + dr["ForumID"].ToString(), ParamKeys.TopicId + "=" + dr["TopicId"].ToString(), ParamKeys.ViewType + "=" + Views.Topic }; string URL = DotNetNuke.Common.Globals.NavigateURL(PostTabID, "", Params); if (Request.QueryString["asg"] != null) { if (SimulateIsNumeric.IsNumeric(Request.QueryString["asg"])) { Params = new string[] { "asg=" + Request.QueryString["asg"], ParamKeys.ForumId + "=" + dr["ForumId"].ToString(), ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + dr["TopicId"].ToString() }; URL = DotNetNuke.Common.Globals.NavigateURL(PostTabID, "", Params); } } else if (MainSettings.URLRewriteEnabled && !(string.IsNullOrEmpty(dr["FullUrl"].ToString()))) { string sTopicURL = string.Empty; if (!(string.IsNullOrEmpty(MainSettings.PrefixURLBase))) { sTopicURL = "/" + MainSettings.PrefixURLBase; } sTopicURL += dr["FullUrl"].ToString(); URL = sTopicURL; } if (URL.IndexOf(Request.Url.Host) == -1) { URL = DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host) + URL; } if (LastBuildDate == new DateTime()) { LastBuildDate = Convert.ToDateTime(dr["DateCreated"]).AddMinutes(offSet); } else { if (Convert.ToDateTime(dr["DateCreated"]).AddMinutes(offSet) > LastBuildDate) { LastBuildDate = Convert.ToDateTime(dr["DateCreated"]).AddMinutes(offSet); } } sb.Append(WriteElement("item", Indent)); string body = dr["Body"].ToString(); if (body.IndexOf("<body>") > 0) { body = TemplateUtils.GetTemplateSection(body, "<body>", "</body>"); } /* * if (body.Contains("[IMAGE:")) * { * string strHost = DotNetNuke.Common.Globals.AddHTTP(DotNetNuke.Common.Globals.GetDomainName(Request)) + "/"; * string pattern = "([IMAGE:(.+?)])"; * Regex regExp = new Regex(pattern); * MatchCollection matches = null; * matches = regExp.Matches(body); * foreach (Match match in matches) * { * string sImage = ""; * sImage = "<img src=\"" + strHost + "DesktopModules/ActiveForums/viewer.aspx?portalid=" + PortalId + "&moduleid=" + ModuleID + "&attachid=" + match.Groups[2].Value + "\" border=\"0\" />"; * body = body.Replace(match.Value, sImage); * } * } * if (body.Contains("[THUMBNAIL:")) * { * string strHost = DotNetNuke.Common.Globals.AddHTTP(DotNetNuke.Common.Globals.GetDomainName(Request)) + "/"; * string pattern = "([THUMBNAIL:(.+?)])"; * Regex regExp = new Regex(pattern); * MatchCollection matches = null; * matches = regExp.Matches(body); * foreach (Match match in matches) * { * string sImage = ""; * string thumbId = match.Groups[2].Value.Split(':')[0]; * string parentId = match.Groups[2].Value.Split(':')[1]; * sImage = "<a href=\"" + strHost + "DesktopModules/ActiveForums/viewer.aspx?portalid=" + PortalId + "&moduleid=" + ModuleID + "&attachid=" + parentId + "\" target=\"_blank\"><img src=\"" + strHost + "DesktopModules/ActiveForums/viewer.aspx?portalid=" + PortalId + "&moduleid=" + ModuleID + "&attachid=" + thumbId + "\" border=\"0\" /></a>"; * body = body.Replace(match.Value, sImage); * } * } */ body = body.Replace("src=\"/Portals", "src=\"" + DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host) + "/Portals"); body = Utilities.ManageImagePath(body, DotNetNuke.Common.Globals.AddHTTP(Request.Url.Host)); sb.Append(WriteElement("title", dr["Subject"].ToString(), Indent + 1)); sb.Append(WriteElement("description", body, Indent + 1)); sb.Append(WriteElement("link", URL, Indent + 1)); sb.Append(WriteElement("dc:creator", UserProfiles.GetDisplayName(ModuleID, -1, dr["AuthorUserName"].ToString(), dr["AuthorFirstName"].ToString(), dr["AuthorLastName"].ToString(), dr["AuthorDisplayName"].ToString(), null), Indent + 1)); sb.Append(WriteElement("pubDate", Convert.ToDateTime(dr["DateCreated"]).AddMinutes(offSet).ToString("r"), Indent + 1)); sb.Append(WriteElement("guid", URL, Indent + 1)); sb.Append(WriteElement("slash:comments", dr["ReplyCount"].ToString(), Indent + 1)); sb.Append(WriteElement("/item", Indent)); return(sb.ToString()); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); btnCancel.Click += new System.EventHandler(btnCancel_Click); btnSend.Click += new System.EventHandler(btnSend_Click); string warnImg = "<img src=\"" + ImagePath + "/images/warning.png\" />"; reqEmail.Text = warnImg; reqMessage.Text = warnImg; reqName.Text = warnImg; reqSubject.Text = warnImg; regEmail.Text = warnImg; regEmail.ValidationExpression = "\\b[a-zA-Z0-9._%\\-+']+@[a-zA-Z0-9.\\-]+\\.[a-zA-Z]{2,4}\\b"; string TopicSubject = string.Empty; if (TopicId > 0) { TopicsController tc = new TopicsController(); TopicInfo ti = tc.Topics_Get(PortalId, ModuleId, TopicId, ForumId, UserId, true); if (ti != null) { if (Permissions.HasPerm(ForumInfo.Security.Read, ForumUser.UserRoles)) { if (!Page.IsPostBack) { string SubjectDefault = GetSharedResource("[RESX:EmailSubjectDefault]"); TopicSubject = ti.Content.Subject; SubjectDefault = SubjectDefault.Replace("[SUBJECT]", ti.Content.Subject); txtRecipSubject.Text = SubjectDefault; string MessageDefault = GetSharedResource("[RESX:EmailMessageDefault]"); string sURL = NavigateUrl(TabId, "", new string[] { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + TopicId }); if (MainSettings.UseShortUrls) { sURL = NavigateUrl(TabId, "", new string[] { ParamKeys.TopicId + "=" + TopicId }); } MessageDefault = MessageDefault.Replace("[TOPICLINK]", sURL); MessageDefault = MessageDefault.Replace("[DISPLAYNAME]", UserProfiles.GetDisplayName(ModuleId, UserId, UserInfo.Username, UserInfo.FirstName, UserInfo.LastName, UserInfo.DisplayName)); txtMessage.Text = MessageDefault; } } if (MainSettings.UseSkinBreadCrumb) { string sCrumb = "<a href=\"" + NavigateUrl(TabId, "", ParamKeys.GroupId + "=" + ForumGroupId) + "\">" + ForumInfo.GroupName + "</a>|"; if (MainSettings.UseShortUrls) { sCrumb += "<a href=\"" + NavigateUrl(TabId, "", ParamKeys.ForumId + "=" + ForumId) + "\">" + ForumInfo.ForumName + "</a>"; sCrumb += "|<a href=\"" + NavigateUrl(TabId, "", ParamKeys.TopicId + "=" + TopicId) + "\">" + TopicSubject + "</a>"; } else { sCrumb += "<a href=\"" + NavigateUrl(TabId, "", new string[] { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=" + Views.Topics }) + "\">" + ForumInfo.ForumName + "</a>"; sCrumb += "|<a href=\"" + NavigateUrl(TabId, "", new string[] { ParamKeys.ForumId + "=" + ForumId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + TopicId }) + "\">" + TopicSubject + "</a>"; } if (Environment.UpdateBreadCrumb(Page.Controls, sCrumb)) { bcUpdated = true; } } } else { Response.Redirect(NavigateUrl(TabId)); } } }