protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString["t"] == null || !PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(); } 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(PageContext.PageTopicName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "t={0}", PageContext.PageTopicID)); Move.Text = GetText("move"); // Ederon : 7/14/2007 - by default, leave pointer is set on value defined on host level LeavePointer.Checked = PageContext.BoardSettings.ShowMoved; ForumList.DataSource = YAF.Classes.Data.DB.forum_listall_sorted(PageContext.PageBoardID, PageContext.PageUserID); DataBind(); System.Web.UI.WebControls.ListItem pageItem = ForumList.Items.FindByValue(PageContext.PageForumID.ToString()); if (pageItem != null) { pageItem.Selected = true; } } }
protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString ["m"] == null || !PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", PageContext.PageCategoryID)); PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(PageContext.PageTopicName, YafBuildLink.GetLink(ForumPages.posts, "t={0}", PageContext.PageTopicID)); Move.Text = GetText("MOVE_MESSAGE"); CreateAndMove.Text = GetText("CREATE_TOPIC"); ForumList.DataSource = YAF.Classes.Data.DB.forum_listall_sorted(PageContext.PageBoardID, PageContext.PageUserID); ForumList.DataTextField = "Title"; ForumList.DataValueField = "ForumID"; DataBind(); ForumList.Items.FindByValue(PageContext.PageForumID.ToString()).Selected = true; ForumList_SelectedIndexChanged(this.ForumList, e); } }
protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString ["t"] == null || !PageContext.ForumReadAccess || !PageContext.BoardSettings.AllowEmailTopic) { YafBuildLink.AccessDenied(); } 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(PageContext.PageTopicName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "t={0}", PageContext.PageTopicID)); SendEmail.Text = GetText("send"); Subject.Text = PageContext.PageTopicName; YafTemplateEmail emailTopic = new YafTemplateEmail(); emailTopic.TemplateParams ["{link}"] = String.Format("{0}{1}", YAF.Classes.Utils.YafForumInfo.ServerURL, YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.posts, "t={0}", PageContext.PageTopicID)); emailTopic.TemplateParams ["{user}"] = PageContext.PageUserName; Message.Text = emailTopic.ProcessTemplate("EMAILTOPIC"); } }
/* Overriden Base Methods */ #region MyRegion /// <summary> /// Creates page links for this page. /// </summary> protected override void CreatePageLinks() { if (PageContext.Settings.LockedForum == 0) { // forum index PageLinks.AddLink(PageContext.BoardSettings.Name, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum)); // category PageLinks.AddLink(PageContext.PageCategoryName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.forum, "c={0}", PageContext.PageCategoryID)); } // forum page PageLinks.AddForumLinks(PageContext.PageForumID); // currect page PageLinks.AddLink(GetText("TITLE"), ""); }
protected void Page_Load(object sender, System.EventArgs e) { if (Request.QueryString ["t"] == null || !PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } ShowToolBar = false; 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(PageContext.PageTopicName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "t={0}", PageContext.PageTopicID)); Posts.DataSource = YAF.Classes.Data.DB.post_list(PageContext.PageTopicID, 1, PageContext.BoardSettings.ShowDeletedMessages); DataBind(); } }
protected void Page_Load(object sender, System.EventArgs e) { if (!PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { AddUser.Text = GetText("INVITE"); 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(GetText("TITLE"), ""); PagerTop.PageSize = 25; } BindData(); }
protected void Page_Load(object sender, System.EventArgs e) { DataRow currentRow = null; if (QuotedTopicID != null) { using (DataTable dt = DB.message_list(QuotedTopicID)) currentRow = dt.Rows[0]; if (Convert.ToInt32(currentRow["TopicID"]) != PageContext.PageTopicID) { YafBuildLink.AccessDenied(); } if (!CanQuotePostCheck(currentRow)) { YafBuildLink.AccessDenied(); } } else if (EditTopicID != null) { using (DataTable dt = DB.message_list(EditTopicID)) currentRow = dt.Rows[0]; _ownerUserId = Convert.ToInt32(currentRow["UserId"]); if (!CanEditPostCheck(currentRow)) { YafBuildLink.AccessDenied(); } } if (PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (Request["t"] == null && Request["m"] == null && !PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (Request["t"] != null && !PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } //Message.EnableRTE = PageContext.BoardSettings.AllowRichEdit; _forumEditor.StyleSheet = YafBuildLink.ThemeFile("theme.css"); _forumEditor.BaseDir = YafForumInfo.ForumRoot + "editors"; Title.Text = GetText("NEWTOPIC"); PollExpire.Attributes.Add("style", "width:50px"); if (!IsPostBack) { // helper bool -- true if this is a completely new topic... bool isNewTopic = (TopicID == null) && (QuotedTopicID == null) && (EditTopicID == null); Priority.Items.Add(new ListItem(GetText("normal"), "0")); Priority.Items.Add(new ListItem(GetText("sticky"), "1")); Priority.Items.Add(new ListItem(GetText("announcement"), "2")); Priority.SelectedIndex = 0; EditReasonRow.Visible = false; Preview.Text = GetText("preview"); PostReply.Text = GetText("Save"); Cancel.Text = GetText("Cancel"); CreatePoll.Text = GetText("createpoll"); RemovePoll.Text = GetText("removepoll"); PersistencyRow.Visible = PageContext.ForumPriorityAccess; PriorityRow.Visible = PageContext.ForumPriorityAccess; CreatePollRow.Visible = !HasPoll(currentRow) && CanHavePoll(currentRow) && PageContext.ForumPollAccess; RemovePollRow.Visible = HasPoll(currentRow) && CanHavePoll(currentRow) && PageContext.ForumPollAccess && PageContext.ForumModeratorAccess; if (RemovePollRow.Visible) { InitPollUI(currentRow); } // Show post to blog option only to a new post BlogRow.Visible = (PageContext.BoardSettings.AllowPostToBlog && isNewTopic && !PageContext.IsGuest); // handle new topic options... NewTopicOptionsRow.Visible = isNewTopic && !PageContext.IsGuest; if (isNewTopic && PageContext.ForumUploadAccess) { TopicAttach.Visible = true; TopicAttachLabel.Visible = true; } 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); tr_captcha1.Visible = true; tr_captcha2.Visible = true; } 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); // check if it's a reply to a topic... if (TopicID != null) { InitReplyToTopic(); } // If currentRow != null, we are quoting a post in a new reply, or editing an existing post if (currentRow != null) { MessageFlags messageFlags = new MessageFlags(currentRow["Flags"]); string message = currentRow["Message"].ToString(); if (QuotedTopicID != null) { // quoting a reply to a topic... InitQuotedReply(currentRow, message, messageFlags); } else if (EditTopicID != null) { // editing a message... InitEditedPost(currentRow, message, messageFlags); } } // add the "New Topic" page link last... if (isNewTopic) { PageLinks.AddLink(GetText("NEWTOPIC")); } // form user is only for "Guest" From.Text = PageContext.PageUserName; if (User != null) { FromRow.Visible = false; } } }
protected void Page_Load(object sender, System.EventArgs e) { using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID)) _forum = dt.Rows [0]; _topic = YAF.Classes.Data.DB.topic_info(PageContext.PageTopicID); if (!IsPostBack) { if (!PageContext.ForumModeratorAccess && !PageContext.ForumUploadAccess) { YafBuildLink.AccessDenied(); } if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } // Ederon : 9/9/2007 - moderaotrs can attach in locked posts if (General.BinaryAnd(_topic["Flags"], TopicFlags.Flags.IsLocked) && !PageContext.ForumModeratorAccess) { YafBuildLink.AccessDenied(/*"The topic is closed."*/); } if (General.BinaryAnd(_forum["Flags"], ForumFlags.Flags.IsLocked)) { YafBuildLink.AccessDenied(/*"The forum is closed."*/); } // Check that non-moderators only edit messages they have written if (!PageContext.ForumModeratorAccess) { using (DataTable dt = YAF.Classes.Data.DB.message_list(Request.QueryString ["m"])) if (( int )dt.Rows [0] ["UserID"] != PageContext.PageUserID) { YafBuildLink.AccessDenied(/*"You didn't post this message."*/); } } 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)); } PageLinks.AddForumLinks(PageContext.PageForumID); PageLinks.AddLink(PageContext.PageTopicName, YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.posts, "t={0}", PageContext.PageTopicID)); PageLinks.AddLink(GetText("TITLE"), ""); Back.Text = GetText("BACK"); Upload.Text = GetText("UPLOAD"); // MJ : 10/14/2007 - list of allowed file extensions DataTable extensionTable = YAF.Classes.Data.DB.extension_list(PageContext.PageBoardID); string types = ""; bool bFirst = true; foreach (DataRow row in extensionTable.Rows) { types += String.Format("{1}*.{0}", row ["Extension"].ToString(), (bFirst ? "" : ", ")); if (bFirst) { bFirst = false; } } if (!String.IsNullOrEmpty(types)) { ExtensionsList.Text = types; } BindData(); } }
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 void Page_Load(object sender, System.EventArgs e) { Mession.UnreadTopics = 0; RssFeed.NavigateUrl = YAF.Classes.Utils.YafBuildLink.GetLinkNotEscaped(YAF.Classes.Utils.ForumPages.rsstopic, "pg=topics&f={0}", Request.QueryString["f"]); RssFeed.Text = GetText("RSSFEED"); RssFeed.Visible = PageContext.BoardSettings.ShowRSSLink; MarkRead.Text = GetText("MARKREAD"); RSSLinkSpacer.Visible = PageContext.BoardSettings.ShowRSSLink; ForumJumpHolder.Visible = PageContext.BoardSettings.ShowForumJump && PageContext.Settings.LockedForum == 0; if (!IsPostBack) { //PageLinks.Clear(); 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)); } PageLinks.AddForumLinks(PageContext.PageForumID, true); ShowList.DataSource = YafStaticData.TopicTimes( ); ShowList.DataTextField = "TopicText"; ShowList.DataValueField = "TopicValue"; _showTopicListSelected = (Mession.ShowList == -1) ? PageContext.BoardSettings.ShowTopicsDefault : Mession.ShowList; HandleWatchForum(); } if (Request.QueryString ["f"] == null) { YafBuildLink.AccessDenied(); } if (!PageContext.ForumReadAccess) { YafBuildLink.AccessDenied(); } using (DataTable dt = YAF.Classes.Data.DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID)) _forum = dt.Rows [0]; if (_forum ["RemoteURL"] != DBNull.Value) { Response.Clear(); Response.Redirect(( string )_forum ["RemoteURL"]); } _forumFlags = new ForumFlags(_forum["Flags"]); PageTitle.Text = ( string )_forum ["Name"]; BindData(); // Always because of yaf:TopicLine if (!PageContext.ForumPostAccess || (_forumFlags.IsLocked && !PageContext.ForumModeratorAccess)) { NewTopic1.Visible = false; NewTopic2.Visible = false; } if (!PageContext.ForumModeratorAccess) { moderate1.Visible = false; moderate2.Visible = false; } }
protected void Page_Load(object sender, System.EventArgs e) { _messageRow = null; if (Request.QueryString ["m"] != null) { using (DataTable dt = DB.message_list(Request.QueryString ["m"])) { _messageRow = dt.Rows [0]; } if (!PageContext.ForumModeratorAccess && PageContext.PageUserID != ( int )_messageRow ["UserID"]) { YafBuildLink.AccessDenied(); } } _forumFlags = new ForumFlags(_messageRow ["ForumFlags"]); _topicFlags = new TopicFlags(_messageRow ["TopicFlags"]); _ownerUserId = ( int )_messageRow ["UserID"]; _isModeratorChanged = (PageContext.PageUserID != _ownerUserId); if (PageContext.PageForumID == 0) { YafBuildLink.AccessDenied(); } if (Request ["t"] == null && !PageContext.ForumPostAccess) { YafBuildLink.AccessDenied(); } if (Request ["t"] != null && !PageContext.ForumReplyAccess) { YafBuildLink.AccessDenied(); } if (!IsPostBack) { // setup page links PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum)); PageLinks.AddLink(PageContext.PageCategoryName, YafBuildLink.GetLink(ForumPages.forum, "c={0}", PageContext.PageCategoryID)); PageLinks.AddForumLinks(PageContext.PageForumID); EraseMessage.Checked = false; ViewState ["delAll"] = false; EraseRow.Visible = false; DeleteReasonRow.Visible = false; LinkedPosts.Visible = false; ReasonEditor.Attributes.Add("style", "width:100%"); Cancel.Text = GetText("Cancel"); if (Request.QueryString ["m"] != null) { // delete message... PreviewRow.Visible = true; DataTable tempdb = DB.message_getRepliesList(Request.QueryString ["m"]); if (tempdb.Rows.Count != 0 && (PageContext.ForumModeratorAccess || PageContext.IsAdmin)) { LinkedPosts.Visible = true; LinkedPosts.DataSource = tempdb; LinkedPosts.DataBind(); } if (Request.QueryString ["action"].ToLower() == "delete") { Title.Text = GetText("EDIT"); //GetText("EDIT"); Delete.Text = GetText("DELETE"); // "GetText("Save"); if (PageContext.IsAdmin) { EraseRow.Visible = true; } } else { Title.Text = GetText("EDIT"); Delete.Text = GetText("UNDELETE"); // "GetText("Save"); } Subject.Text = Convert.ToString(_messageRow ["Topic"]); DeleteReasonRow.Visible = true; ReasonEditor.Text = Convert.ToString(_messageRow ["DeleteReason"]); // populate the message preview with the message datarow... MessagePreview.Message = _messageRow["message"].ToString(); MessagePreview.MessageFlags.BitValue = Convert.ToInt32(_messageRow ["Flags"]); } } }