Beispiel #1
0
        static public void SendMail(pages.ForumPage basePage, string from, string fromName, string to, string toName, string subject, string body)
        {
            if (toName != null && toName.Length > 0)
            {
                to = "\"" + toName + "\" <" + to + ">";
            }
            if (fromName != null && fromName.Length > 0)
            {
                from = "\"" + fromName + "\" <" + from + ">";
            }

            System.Web.Mail.MailMessage Mail = new System.Web.Mail.MailMessage();

            Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"]     = basePage.BoardSettings.SmtpServer;
            Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 25;
            Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"]      = 2;
            if (basePage.BoardSettings.SmtpUserName != null && basePage.BoardSettings.SmtpUserPass != null)
            {
                Mail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
                Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"]     = basePage.BoardSettings.SmtpUserName;
                Mail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"]     = basePage.BoardSettings.SmtpUserPass;
            }
            Mail.To      = to;
            Mail.From    = from;
            Mail.Subject = subject;
            Mail.Body    = body;

            System.Web.Mail.SmtpMail.SmtpServer = basePage.BoardSettings.SmtpServer;
            System.Web.Mail.SmtpMail.Send(Mail);
        }
Beispiel #2
0
        static public void CreateWatchEmail(pages.ForumPage basePage, object messageID)
        {
            using (DataTable dt = DB.message_list(messageID))
            {
                foreach (DataRow row in dt.Rows)
                {
                    // Send track mails
                    string subject = String.Format("Topic Subscription New Post Notification (From {0})", basePage.BoardSettings.Name);

                    string body = Utils.ReadTemplate("topicpost.txt");
                    body = body.Replace("{forumname}", basePage.BoardSettings.Name);
                    body = body.Replace("{topic}", row["Topic"].ToString());
                    body = body.Replace("{link}", String.Format("{0}{1}", basePage.ServerURL, Forum.GetLink(Pages.posts, "m={0}#{0}", messageID)));

                    DB.mail_createwatch(row["TopicID"], basePage.BoardSettings.ForumEmail, subject, body, row["UserID"]);
                }
            }
        }
Beispiel #3
0
        private void Forum_Load(object sender, EventArgs e)
        {
            Pages  page;
            string m_baseDir = Data.ForumRoot;

            try
            {
                page = (Pages)System.Enum.Parse(typeof(Pages), Request.QueryString["g"], true);
            }
            catch (Exception)
            {
                page = Pages.forum;
            }

            string src = string.Format("{0}pages/{1}.ascx", m_baseDir, page);

            if (src.IndexOf("/moderate_") >= 0)
            {
                src = src.Replace("/moderate_", "/moderate/");
            }
            if (src.IndexOf("/admin_") >= 0)
            {
                src = src.Replace("/admin_", "/admin/");
            }
            if (src.IndexOf("/help_") >= 0)
            {
                src = src.Replace("/help_", "/help/");
            }

            try
            {
                pages.ForumPage ctl = (pages.ForumPage)LoadControl(src);
                ctl.ForumControl = this;
                this.Controls.Add(ctl);
            }
            catch (System.IO.FileNotFoundException)
            {
                throw new ApplicationException("Failed to load " + src + ".");
            }
        }
Beispiel #4
0
        public XmlTextWriter WriteRSSPrologue(XmlTextWriter writer, pages.ForumPage page)
        {
            /*
             *      writer.WriteStartDocument();
             *      writer.WriteStartElement("rss");
             *      writer.WriteAttributeString("version", "2.0");
             *      writer.WriteStartElement("channel");
             *      writer.WriteElementString("title", "RSS File for " + page.ForumURL);
             *      writer.WriteElementString("link", page.ForumURL);
             *      writer.WriteElementString("description", "Yet Another Forum Web Application");
             *      writer.WriteElementString("copyright", "Copyright 2002-2004 Bjørnar Henden");
             */

            writer.WriteRaw("<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + en);
            writer.WriteRaw("<rss version=\"2.0\">" + en);
            writer.WriteRaw("\t<channel>" + en);
            writer.WriteRaw("\t\t<title>RSS Feed for " + page.ServerURL + "</title>" + en);
            writer.WriteRaw("\t\t<link>" + Encode(page.ForumURL) + "</link>" + en);
            writer.WriteRaw("\t\t<description>Yet Another Forum Web Application RSS Feed</description>" + en);
            writer.WriteRaw("\t\t<copyright>Copyright 2002 - 2004 Bjørnar Henden</copyright>" + en);

            return(writer);
        }
Beispiel #5
0
 static public void SendMail(pages.ForumPage basePage, string from, string to, string subject, string body)
 {
     SendMail(basePage, from, null, to, null, subject, body);
 }