protected string GetThreadedRow(object o) { DataRowView row = ( DataRowView )o; if (!IsThreaded || CurrentMessage == ( int )row ["MessageID"]) { return(""); } System.Text.StringBuilder html = new System.Text.StringBuilder(1000); // Threaded string brief = row ["Message"].ToString(); RegexOptions options = RegexOptions.IgnoreCase /*| RegexOptions.Singleline | RegexOptions.Multiline*/; options |= RegexOptions.Singleline; while (Regex.IsMatch(brief, @"\[quote=(.*?)\](.*)\[/quote\]", options)) { brief = Regex.Replace(brief, @"\[quote=(.*?)\](.*)\[/quote\]", "", options); } while (Regex.IsMatch(brief, @"\[quote\](.*)\[/quote\]", options)) { brief = Regex.Replace(brief, @"\[quote\](.*)\[/quote\]", "", options); } while (Regex.IsMatch(brief, @"<.*?>", options)) { brief = Regex.Replace(brief, @"<.*?>", "", options); } while (Regex.IsMatch(brief, @"\[.*?\]", options)) { brief = Regex.Replace(brief, @"\[.*?\]", "", options); } brief = General.BadWordReplace(brief); if (brief.Length > 42) { brief = brief.Substring(0, 40) + "..."; } brief = FormatMsg.AddSmiles(brief); html.AppendFormat("<tr class='post'><td colspan='3' nowrap>"); html.AppendFormat(GetIndentImage(row ["Indent"])); html.AppendFormat("\n<a href='{0}'>{2} ({1}", YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "m={0}#{0}", row ["MessageID"]), row ["UserName"], brief); html.AppendFormat(" - {0})</a>", YafDateTime.FormatDateTimeShort(row ["Posted"])); html.AppendFormat("</td></tr>"); return(html.ToString()); }
private void DisplayPost_PreRender(object sender, EventArgs e) { Attach.Visible = !PostDeleted && CanAttach && !IsLocked; Attach.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.attachments, "m={0}", MessageId); Edit.Visible = !PostDeleted && CanEditPost && !IsLocked; Edit.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.postmessage, "m={0}", MessageId); MovePost.Visible = PageContext.ForumModeratorAccess && !IsLocked; MovePost.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.movemessage, "m={0}", MessageId); Delete.Visible = !PostDeleted && CanDeletePost && !IsLocked; Delete.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.deletemessage, "m={0}&action=delete", MessageId); UnDelete.Visible = CanUnDeletePost && !IsLocked; UnDelete.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.deletemessage, "m={0}&action=undelete", MessageId); Quote.Visible = !PostDeleted && CanReply && !IsLocked; Quote.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.postmessage, "t={0}&f={1}&q={2}", PageContext.PageTopicID, PageContext.PageForumID, MessageId); // report posts ReportButton.Visible = PageContext.BoardSettings.AllowReportAbuse && !IsGuest; // Mek Addition 08/18/2007 ReportButton.Text = PageContext.Localization.GetText("REPORTPOST"); // Mek Addition 08/18/2007 ReportButton.Attributes.Add("onclick", String.Format("return confirm('{0}');", PageContext.Localization.GetText("CONFIRM_REPORTPOST"))); // report spam ReportSpamButton.Visible = PageContext.BoardSettings.AllowReportSpam && !IsGuest; // Mek Addition 08/18/2007 ReportSpamButton.Text = PageContext.Localization.GetText("REPORTSPAM"); // Mek Addition 08/18/2007 ReportSpamButton.Attributes.Add("onclick", String.Format("return confirm('{0}');", PageContext.Localization.GetText("CONFIRM_REPORTSPAM"))); // private messages Pm.Visible = !IsGuest && !PostDeleted && PageContext.User != null && PageContext.BoardSettings.AllowPrivateMessages && !IsSponserMessage; Pm.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.pmessage, "u={0}", UserId); // emailing Email.Visible = !IsGuest && !PostDeleted && PageContext.User != null && PageContext.BoardSettings.AllowEmailSending && !IsSponserMessage; Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_email, "u={0}", UserId); // home page Home.Visible = !PostDeleted && !String.IsNullOrEmpty(UserProfile.Homepage); SetupThemeButtonWithLink(Home, UserProfile.Homepage); // blog page Blog.Visible = !PostDeleted && !String.IsNullOrEmpty(UserProfile.Blog); SetupThemeButtonWithLink(Blog, UserProfile.Blog); // MSN Msn.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.MSN); Msn.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_email, "u={0}", UserId); // Yahoo IM Yim.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.YIM); Yim.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_yim, "u={0}", UserId); // AOL IM Aim.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.AIM); Aim.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_aim, "u={0}", UserId); // ICQ Icq.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.ICQ); Icq.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_icq, "u={0}", UserId); // Skype Skype.Visible = !PostDeleted && PageContext.User != null && !String.IsNullOrEmpty(UserProfile.Skype); Skype.NavigateUrl = YafBuildLink.GetLinkNotEscaped(ForumPages.im_skype, "u={0}", UserId); if (!PostDeleted) { AdminInformation.InnerHtml = @"<span class=""smallfont"">"; if (Convert.ToDateTime(DataRow ["Edited"]) > Convert.ToDateTime(DataRow ["Posted"]).AddSeconds(PageContext.BoardSettings.EditTimeOut)) { // message has been edited // show, why the post was edited or deleted? string whoChanged = (Convert.ToBoolean(DataRow["IsModeratorChanged"])) ? PageContext.Localization.GetText("EDITED_BY_MOD") : PageContext.Localization.GetText("EDITED_BY_USER"); AdminInformation.InnerHtml += String.Format(@"| <span class=""editedinfo"">{0} {1}:</span> {2}", PageContext.Localization.GetText("EDITED"), whoChanged, YafDateTime.FormatDateTimeShort(Convert.ToDateTime(DataRow["Edited"]))); if (Server.HtmlDecode(Convert.ToString(DataRow ["EditReason"])) != "") { // reason was specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), FormatMsg.RepairHtml((string)DataRow["EditReason"], true)); } else { //reason was not specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), PageContext.Localization.GetText("EDIT_REASON_NA")); } } } else { AdminInformation.InnerHtml = @"<span class=""smallfont"">"; if (Server.HtmlDecode(Convert.ToString(DataRow ["DeleteReason"])) != String.Empty) { // reason was specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), FormatMsg.RepairHtml((string)DataRow["DeleteReason"], true)); } else { //reason was not specified AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("EDIT_REASON"), PageContext.Localization.GetText("EDIT_REASON_NA")); } } // display admin only info if (PageContext.IsAdmin) { AdminInformation.InnerHtml += String.Format(" |<b> {0}:</b> {1}", PageContext.Localization.GetText("IP"), DataRow["IP"].ToString()); } AdminInformation.InnerHtml += "</span>"; }