protected string GetPrintBody(object o) { DataRowView row = ( DataRowView )o; string message = row ["Message"].ToString(); message = FormatMsg.FormatMessage(message, new MessageFlags(Convert.ToInt32(row ["Flags"]))); return(message); }
protected string FormatBody(object o) { DataRowView row = (DataRowView)o; string html = FormatMsg.FormatMessage(this, row["Message"].ToString(), new MessageFlags(Convert.ToInt32(row["Flags"]))); string sig = row["user_signature"].ToString(); if (sig != string.Empty) { sig = FormatMsg.FormatMessage(this, sig, new MessageFlags()); html += "<br/><hr noshade/>" + sig; } return(html); }
protected string FormatBody(object o) { DataRowView row = (DataRowView)o; string html = FormatMsg.FormatMessage(this, row["Message"].ToString(), new MessageFlags(Convert.ToInt32(row["Flags"]))); if (row["user_Signature"].ToString().Length > 0) { string sig = row["user_signature"].ToString(); // don't allow any HTML on signatures MessageFlags tFlags = new MessageFlags(); tFlags.IsHTML = false; sig = FormatMsg.FormatMessage(this, sig, tFlags); html += "<br/><hr noshade/>" + sig; } return(html); }
private void Preview_Click(object sender, System.EventArgs e) { PreviewRow.Visible = true; MessageFlags tFlags = new MessageFlags(); tFlags.IsHTML = Message.UsesHTML; tFlags.IsBBCode = Message.UsesBBCode; string body = FormatMsg.FormatMessage(this, Message.Text, tFlags); using (DataTable dt = DB.user_list(PageBoardID, PageUserID, true)) { if (!dt.Rows[0].IsNull("user_Signature")) { body += "<br/><hr noshade/>" + FormatMsg.FormatMessage(this, dt.Rows[0]["user_Signature"].ToString(), new MessageFlags()); } } PreviewCell.InnerHtml = body; }
/// <summary> /// Formats the message and replaces Forum Code to HTML. /// </summary> /// <param name="o">The object DataRowView that is going to be converted.</param> /// <returns>Returns the convertted string.</returns> public string FormatMessage(object o) { DataRowView row = (DataRowView)o; return(FormatMsg.FormatMessage(this, row["Message"].ToString(), new MessageFlags(Convert.ToInt32(row["Flags"])))); }
protected string FormatBody(object o) { DataRowView row = (DataRowView)o; return(FormatMsg.FormatMessage(this, row["Body"].ToString(), Convert.ToInt32(row["Flags"]))); }
protected string FormatBody() { DataRowView row = DataRow; string html2 = FormatMsg.FormatMessage(ForumPage, row["Message"].ToString(), new MessageFlags(Convert.ToInt32(row["Flags"]))); // define valid image extensions string[] aImageExtensions = { "jpg", "gif", "png" }; if (long.Parse(row["HasAttachments"].ToString()) > 0) { string stats = ForumPage.GetText("ATTACHMENTINFO"); string strFileIcon = ForumPage.GetThemeContents("ICONS", "ATTACHED_FILE"); html2 += "<p>"; using (DataTable dt = DB.attachment_list(row["MessageID"], null, null)) { // show file then image attachments... int tmpDisplaySort = 0; while (tmpDisplaySort <= 1) { bool bFirstItem = true; foreach (DataRow dr in dt.Rows) { string strFilename = Convert.ToString(dr["FileName"]).ToLower(); bool bShowImage = false; // verify it's not too large to display (might want to make this a board setting) if (Convert.ToInt32(dr["Bytes"]) <= 262144) { // is it an image file? for (int i = 0; i < aImageExtensions.Length; i++) { if (strFilename.EndsWith(aImageExtensions[i])) { bShowImage = true; break; } } } if (bShowImage && tmpDisplaySort == 1) { if (bFirstItem) { html2 += "<i class=\"smallfont\">"; html2 += String.Format(ForumPage.GetText("IMAGE_ATTACHMENT_TEXT"), Convert.ToString(row["UserName"])); html2 += "</i><br/>"; bFirstItem = false; } html2 += String.Format("<img src=\"{0}image.aspx?a={1}\" alt=\"{2}\"><br/>", Data.ForumRoot, dr["AttachmentID"], Server.HtmlEncode(Convert.ToString(dr["FileName"]))); } else if (!bShowImage && tmpDisplaySort == 0) { if (bFirstItem) { html2 += String.Format("<b class=\"smallfont\">{0}</b><br/>", ForumPage.GetText("ATTACHMENTS")); bFirstItem = false; } // regular file attachment int kb = (1023 + (int)dr["Bytes"]) / 1024; html2 += String.Format("<img border='0' src='{0}'> <b><a href=\"{1}image.aspx?a={2}\">{3}</a></b> <span class='smallfont'>{4}</span><br/>", strFileIcon, Data.ForumRoot, dr["AttachmentID"], dr["FileName"], String.Format(stats, kb, dr["Downloads"])); } } // now show images tmpDisplaySort++; html2 += "<br/>"; } } } if (row["Signature"] != DBNull.Value && row["Signature"].ToString().ToLower() != "<p> </p>" && ForumPage.BoardSettings.AllowSignatures) { // don't allow any HTML on signatures MessageFlags tFlags = new MessageFlags(); tFlags.IsHTML = false; html2 += "<br/><hr noshade/>" + FormatMsg.FormatMessage(ForumPage, row["Signature"].ToString(), tFlags); } return(html2); }
protected void Page_Load(object sender, EventArgs e) { // Put user code to initialize the page here RssFeed rf = new RssFeed(); XmlTextWriter writer = new XmlTextWriter(Response.OutputStream, Encoding.UTF8); writer.Formatting = Formatting.Indented; rf.WriteRSSPrologue(writer); // Usage rf.AddRSSItem(writer, "Item Title", "http://test.com", "This is a test item"); switch (Request.QueryString["pg"]) { case "latestposts": if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } using (DataTable dt = DB.topic_latest(PageContext.PageBoardID, 7, PageContext.PageUserID)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Subject"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.posts, "t={0}", Request.QueryString["t"]), General.BadWordReplace(row["Message"].ToString()), Convert.ToDateTime(row["Posted"]).ToString("r")); } } break; case "latestannouncements": if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } using (DataTable dt = DB.topic_announcements(PageContext.PageBoardID, 7, PageContext.PageUserID)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Subject"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.posts, "t={0}", Request.QueryString["t"]), General.BadWordReplace(row["Message"].ToString()), Convert.ToDateTime(row["Posted"]).ToString("r")); } } break; case "posts": if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } if (Request.QueryString["t"] != null) { using ( DataTable dt = DB.post_list(PageContext.PageTopicID, 1, PageContext.BoardSettings.ShowDeletedMessages)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Subject"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.posts, "t={0}", Request.QueryString["t"]), FormatMsg.FormatMessage(row["Message"].ToString(), new MessageFlags(row["Flags"])), Convert.ToDateTime(row["Posted"]).ToString("r")); } } } break; case "forum": using ( DataTable dt = DB.forum_listread(PageContext.PageBoardID, PageContext.PageUserID, null, null)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Forum"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.topics, "f={0}", row["ForumID"]), General.BadWordReplace(row["Description"].ToString())); } } break; case "topics": if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } int forumId; if (Request.QueryString["f"] != null && int.TryParse(Request.QueryString["f"], out forumId)) { //vzrus changed to separate DLL specific code using (DataTable dt = DB.rsstopic_list(forumId)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Topic"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.posts, "t={0}", row["TopicID"]), General.BadWordReplace(row["Topic"].ToString()), Convert.ToDateTime(row["Posted"]).ToString("r")); } } } break; case "active": using ( DataTable dt = DB.topic_active(PageContext.PageBoardID, PageContext.PageUserID, DateTime.Now + TimeSpan.FromHours(-24), (PageContext.Settings.CategoryID == 0) ? null : (object)PageContext.Settings.CategoryID)) { foreach (DataRow row in dt.Rows) { rf.AddRSSItem(writer, General.BadWordReplace(row["Subject"].ToString()), YafForumInfo.ServerURL + YafBuildLink.GetLinkNotEscaped(ForumPages.posts, "t={0}", row["LinkTopicID"]), General.BadWordReplace(row["Subject"].ToString())); } } break; default: break; } rf.WriteRSSClosing(writer); writer.Flush(); writer.Close(); Response.ContentEncoding = Encoding.UTF8; Response.ContentType = "text/xml"; Response.Cache.SetCacheability(HttpCacheability.Public); Response.End(); }