void ForumLastPost_PreRender(object sender, EventArgs e)
        {
            if (DataRow != null)
            {
                if (int.Parse(DataRow ["ReadAccess"].ToString()) == 0)
                {
                    TopicInPlaceHolder.Visible = false;
                }

                if (DataRow ["LastPosted"] != DBNull.Value)
                {
                    LastPosted.Text          = YafDateTime.FormatDateTimeTopic(DataRow ["LastPosted"]);
                    topicLink.NavigateUrl    = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "t={0}", DataRow ["LastTopicID"]);
                    topicLink.Text           = General.Truncate(General.BadWordReplace(DataRow ["LastTopicName"].ToString()), 50);
                    ProfileUserLink.UserID   = Convert.ToInt32(DataRow ["LastUserID"]);
                    ProfileUserLink.UserName = DataRow ["LastUser"].ToString();

                    LastTopicImgLink.ToolTip     = PageContext.Localization.GetText("GO_LAST_POST");
                    LastTopicImgLink.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "m={0}#post{0}", DataRow ["LastMessageID"]);
                    Icon.ThemeTag = (DateTime.Parse(Convert.ToString(DataRow ["LastPosted"])) > Mession.GetTopicRead(( int )DataRow ["LastTopicID"])) ? "ICON_NEWEST" : "ICON_LATEST";

                    LastPostedHolder.Visible = true;
                    NoPostsLabel.Visible     = false;
                }
                else
                {
                    // show "no posts"
                    LastPostedHolder.Visible = false;
                    NoPostsLabel.Visible     = true;
                }
            }
        }
        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 InitQuotedReply(DataRow currentRow, string message, MessageFlags messageFlags)
        {
            if (PageContext.BoardSettings.RemoveNestedQuotes)
            {
                message = FormatMsg.RemoveNestedQuotes(message);
            }

            // If the message being quoted in BBCode but the editor uses HTML, convert the message text to HTML
            if (messageFlags.IsBBCode && _forumEditor.UsesHTML)
            {
                message = BBCode.ConvertBBCodeToHtmlForEdit(message);
            }

            // Ensure quoted replies have bad words removed from them
            message = General.BadWordReplace(message);

            // Quote the original message
            _forumEditor.Text = String.Format("[quote={0}]{1}[/quote]\n", currentRow["username"], message).TrimStart();
        }
Exemple #4
0
        private void BindData()
        {
            int userID = ( int )Security.StringToLongOrRedirect(Request.QueryString ["u"]);

            MembershipUser user = UserMembershipHelper.GetMembershipUser(userID);

            if (user == null)
            {
                YafBuildLink.AccessDenied(/*No such user exists*/);
            }

            YafCombinedUserData userData = new YafCombinedUserData(user, userID);

            // populate user information controls...
            UserName.Text        = HtmlEncode(userData.Membership.UserName);
            Name.Text            = HtmlEncode(userData.Membership.UserName);
            Joined.Text          = String.Format("{0}", YafDateTime.FormatDateLong(Convert.ToDateTime(userData.Joined)));
            LastVisit.Text       = YafDateTime.FormatDateTime(userData.LastVisit);
            Rank.Text            = userData.RankName;
            Location.Text        = HtmlEncode(General.BadWordReplace(userData.Profile.Location));
            RealName.InnerHtml   = HtmlEncode(General.BadWordReplace(userData.Profile.RealName));
            Interests.InnerHtml  = HtmlEncode(General.BadWordReplace(userData.Profile.Interests));
            Occupation.InnerHtml = HtmlEncode(General.BadWordReplace(userData.Profile.Occupation));
            Gender.InnerText     = GetText("GENDER" + userData.Profile.Gender);

            PageLinks.Clear();
            PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
            PageLinks.AddLink(GetText("MEMBERS"), YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.members));
            PageLinks.AddLink(userData.Membership.UserName, "");

            double dAllPosts = 0.0;

            if (SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]) > 0)
            {
                dAllPosts = 100.0 * SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPostsForum"]);
            }

            Stats.InnerHtml = String.Format("{0:N0}<br/>[{1} / {2}]",
                                            userData.DBRow ["NumPosts"],
                                            String.Format(GetText("NUMALL"), dAllPosts),
                                            String.Format(GetText("NUMDAY"), (double)SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumPosts"]) / SqlDataLayerConverter.VerifyInt32(userData.DBRow["NumDays"]))
                                            );

            // private messages
            ///CHANGED THIS ON 12/1/2010
            //PM.Visible = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowPrivateMessages;
            PM.Visible = false;

            PM.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.pmessage, "u={0}", userData.UserID);

            // email link
            Email.Visible     = !userData.IsGuest && User != null && PageContext.BoardSettings.AllowEmailSending;
            Email.NavigateUrl = YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID);
            if (PageContext.IsAdmin)
            {
                Email.TitleNonLocalized = userData.Membership.Email;
            }

            // homepage link
            Home.Visible = !String.IsNullOrEmpty(userData.Profile.Homepage);
            SetupThemeButtonWithLink(Home, userData.Profile.Homepage);

            // blog link
            Blog.Visible = !String.IsNullOrEmpty(userData.Profile.Blog);
            SetupThemeButtonWithLink(Blog, userData.Profile.Blog);

            MSN.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.MSN));
            MSN.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_email, "u={0}", userData.UserID);

            YIM.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.YIM));
            YIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_yim, "u={0}", userData.UserID);

            AIM.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.AIM));
            AIM.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_aim, "u={0}", userData.UserID);

            ICQ.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.ICQ));
            ICQ.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_icq, "u={0}", userData.UserID);

            Skype.Visible     = (User != null && !String.IsNullOrEmpty(userData.Profile.Skype));
            Skype.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.im_skype, "u={0}", userData.UserID);

            // localize tab titles...
            AboutTab.HeaderText       = GetText("ABOUT");
            StatisticsTab.HeaderText  = GetText("STATISTICS");
            AvatarTab.HeaderText      = GetText("AVATAR");
            Last10PostsTab.HeaderText = GetText("LAST10");

            if (PageContext.BoardSettings.AvatarUpload && userData.HasAvatarImage)
            {
                Avatar.ImageUrl = YafForumInfo.ForumRoot + "resource.ashx?u=" + (userID);
            }
            else if (!String.IsNullOrEmpty(userData.Avatar))                 // Took out PageContext.BoardSettings.AvatarRemote
            {
                Avatar.ImageUrl = String.Format("{3}resource.ashx?url={0}&width={1}&height={2}",
                                                Server.UrlEncode(userData.Avatar),
                                                PageContext.BoardSettings.AvatarWidth,
                                                PageContext.BoardSettings.AvatarHeight,
                                                YafForumInfo.ForumRoot);
            }
            else
            {
                Avatar.Visible    = false;
                AvatarTab.Visible = false;
            }

            Groups.DataSource = Roles.GetRolesForUser(UserMembershipHelper.GetUserNameFromID(userID));

            //EmailRow.Visible = PageContext.IsAdmin;
            ModerateTab.Visible     = PageContext.IsAdmin || PageContext.IsForumModerator;
            AdminUserButton.Visible = PageContext.IsAdmin;

            if (LastPosts.Visible)
            {
                LastPosts.DataSource   = YAF.Classes.Data.DB.post_last10user(PageContext.PageBoardID, Request.QueryString ["u"], PageContext.PageUserID);
                SearchUser.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.search,
                                                                                          "postedby={0}",
                                                                                          userData.Membership.UserName);
            }

            DataBind();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            _quickReplyEditor.BaseDir    = YafForumInfo.ForumRoot + "editors";
            _quickReplyEditor.StyleSheet = YafBuildLink.ThemeFile("theme.css");

            _topic = YAF.Classes.Data.DB.topic_info(PageContext.PageTopicID);

            // in case topic is deleted or not existant
            if (_topic == null)
            {
                YafBuildLink.Redirect(ForumPages.info, "i=6");                  // invalid argument message
            }
            // get topic flags
            _topicFlags = new TopicFlags(_topic["Flags"]);

            using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID))
                _forum = dt.Rows [0];

            _forumFlags = new ForumFlags(_forum["Flags"]);

            if (!PageContext.ForumReadAccess)
            {
                YafBuildLink.AccessDenied();
            }

            #region Initial Setup
            if (!IsPostBack)
            {
                if (PageContext.Settings.LockedForum == 0)
                {
                    PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum));
                    PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID));
                }

                QuickReply.Text         = GetText("POSTMESSAGE", "SAVE");
                DataPanel1.TitleText    = GetText("QUICKREPLY");
                DataPanel1.ExpandText   = GetText("QUICKREPLY_SHOW");
                DataPanel1.CollapseText = GetText("QUICKREPLY_HIDE");

                PageLinks.AddForumLinks(PageContext.PageForumID);
                PageLinks.AddLink(General.BadWordReplace(Server.HtmlDecode(PageContext.PageTopicName)), "");

                TopicTitle.Text = General.BadWordReplace(( string )_topic ["Topic"]);

                ViewOptions.Visible     = PageContext.BoardSettings.AllowThreaded;
                ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0;

                RssTopic.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg={0}&t={1}", Request.QueryString ["g"], PageContext.PageTopicID);
                RssTopic.Visible     = PageContext.BoardSettings.ShowRSSLink;

                QuickReplyPlaceHolder.Visible = PageContext.BoardSettings.ShowQuickAnswer;

                if ((PageContext.IsGuest && PageContext.BoardSettings.EnableCaptchaForGuests) ||
                    (PageContext.BoardSettings.EnableCaptchaForPost && !PageContext.IsCaptchaExcluded))
                {
                    Session ["CaptchaImageText"] = General.GetCaptchaString();
                    imgCaptcha.ImageUrl          = String.Format("{0}resource.ashx?c=1", YafForumInfo.ForumRoot);
                    CaptchaDiv.Visible           = true;
                }

                if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess))
                {
                    NewTopic1.Visible = false;
                    NewTopic2.Visible = false;
                }

                // Ederon : 9/9/2007 - moderators can relpy in locked topics
                if (!PageContext.ForumReplyAccess ||
                    ((_topicFlags.IsLocked || _forumFlags.IsLocked) && !PageContext.ForumModeratorAccess))
                {
                    PostReplyLink1.Visible        = PostReplyLink2.Visible = false;
                    QuickReplyPlaceHolder.Visible = false;
                }

                if (PageContext.ForumModeratorAccess)
                {
                    MoveTopic1.Visible = true;
                    MoveTopic2.Visible = true;
                }
                else
                {
                    MoveTopic1.Visible = false;
                    MoveTopic2.Visible = false;
                }

                if (!PageContext.ForumModeratorAccess)
                {
                    LockTopic1.Visible   = false;
                    UnlockTopic1.Visible = false;
                    DeleteTopic1.Visible = false;
                    LockTopic2.Visible   = false;
                    UnlockTopic2.Visible = false;
                    DeleteTopic2.Visible = false;
                }
                else
                {
                    LockTopic1.Visible   = !_topicFlags.IsLocked;
                    UnlockTopic1.Visible = !LockTopic1.Visible;
                    LockTopic2.Visible   = LockTopic1.Visible;
                    UnlockTopic2.Visible = !LockTopic2.Visible;
                }

                // handle custom BBCode javascript or CSS...
                BBCode.RegisterCustomBBCodePageElements(Page, this.GetType());
            }
            #endregion

            // Mark topic read
            Mession.SetTopicRead(PageContext.PageTopicID, DateTime.Now);

            BindData();
        }
 protected string GetPollQuestion()
 {
     return(HtmlEncode(General.BadWordReplace(_dtPoll.Rows [0] ["Question"].ToString())));
 }
Exemple #7
0
        /// <summary>
        /// Handles page load event.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            // if user isn't authenticated, redirect him to login page
            if (User == null || PageContext.IsGuest)
            {
                YafBuildLink.Redirect(ForumPages.login, "ReturnUrl={0}", General.GetSafeRawUrl());
            }

            // set attributes of editor
            _editor.BaseDir    = YafForumInfo.ForumRoot + "editors";
            _editor.StyleSheet = YafBuildLink.ThemeFile("theme.css");

            // this needs to be done just once, not during postbacks
            if (!IsPostBack)
            {
                // create page links
                CreatePageLinks();

                // localize button labels
                Save.Text      = GetText("SAVE");
                Preview.Text   = GetText("PREVIEW");
                Cancel.Text    = GetText("CANCEL");
                FindUsers.Text = GetText("FINDUSERS");
                AllUsers.Text  = GetText("ALLUSERS");
                Clear.Text     = GetText("CLEAR");

                // only administrators can send messages to all users
                AllUsers.Visible = PageContext.IsAdmin;

                if (!String.IsNullOrEmpty(Request.QueryString ["p"]))
                {
                    // PM is a reply or quoted reply (isQuoting)
                    // to the given message id "p"
                    bool isQuoting = Request.QueryString ["q"] == "1";

                    // get quoted message
                    DataTable dt = DB.pmessage_list(Security.StringToLongOrRedirect(Request.QueryString ["p"]));

                    // there is such a message
                    if (dt.Rows.Count > 0)
                    {
                        // message info is in first row
                        DataRow row = dt.Rows [0];
                        // get message sender/recipient
                        int toUserId   = ( int )row ["ToUserID"];
                        int fromUserId = ( int )row ["FromUserID"];

                        // verify access to this PM
                        if (toUserId != PageContext.PageUserID && fromUserId != PageContext.PageUserID)
                        {
                            YafBuildLink.AccessDenied();
                        }

                        // handle subject
                        string subject = ( string )row ["Subject"];
                        if (!subject.StartsWith("Re: "))
                        {
                            subject = "Re: " + subject;
                        }
                        Subject.Text = subject;

                        // set "To" user and disable changing...
                        To.Text           = row ["FromUser"].ToString();
                        To.Enabled        = false;
                        FindUsers.Enabled = false;
                        AllUsers.Enabled  = false;

                        if (isQuoting)                           // PM is a quoted reply
                        {
                            string body = row ["Body"].ToString();

                            if (PageContext.BoardSettings.RemoveNestedQuotes)
                            {
                                body = FormatMsg.RemoveNestedQuotes(body);
                            }

                            // Ensure quoted replies have bad words removed from them
                            body = General.BadWordReplace(body);

                            // Quote the original message
                            body = String.Format("[QUOTE={0}]{1}[/QUOTE]", row ["FromUser"], body);

                            // we don't want any whitespaces at the beginning of message
                            _editor.Text = body.TrimStart();
                        }
                    }
                }
                else if (!String.IsNullOrEmpty(Request.QueryString ["u"]))
                {
                    // PM is being sent to a predefined user
                    int toUserId;

                    if (Int32.TryParse(Request.QueryString ["u"], out toUserId))
                    {
                        // get user's name
                        using (DataTable dt = DB.user_list(PageContext.PageBoardID, toUserId, true))
                        {
                            To.Text    = dt.Rows [0] ["Name"] as string;
                            To.Enabled = false;
                            // hide find user/all users buttons
                            FindUsers.Enabled = false;
                            AllUsers.Enabled  = false;
                        }
                    }
                }
                else
                {
                    // Blank PM

                    // multi-receiver info is relevant only when sending blank PM
                    if (PageContext.BoardSettings.PrivateMessageMaxRecipients > 1)
                    {
                        // format localized string
                        MultiReceiverInfo.Text = String.Format(
                            "<br />{0}<br />{1}",
                            String.Format(
                                PageContext.Localization.GetText("MAX_RECIPIENT_INFO"),
                                PageContext.BoardSettings.PrivateMessageMaxRecipients
                                ),
                            PageContext.Localization.GetText("MULTI_RECEIVER_INFO")
                            );
                        // display info
                        MultiReceiverInfo.Visible = true;
                    }
                }
            }
        }
        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();
        }