private bool CanEditPostCheck(DataRow message) { bool postLocked = false; if (!PageContext.IsAdmin && PageContext.BoardSettings.LockPosts > 0) { DateTime edited = (DateTime)message["Edited"]; if (edited.AddDays(PageContext.BoardSettings.LockPosts) < DateTime.Now) { postLocked = true; } } DataRow forumInfo, topicInfo; // get topic and forum information topicInfo = DB.topic_info(PageContext.PageTopicID); using (DataTable dt = DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID)) forumInfo = dt.Rows[0]; // Ederon : 9/9/2007 - moderator can edit in locked topics return(((!postLocked && !General.BinaryAnd(forumInfo["Flags"], ForumFlags.Flags.IsLocked) && !General.BinaryAnd(topicInfo["Flags"], TopicFlags.Flags.IsLocked) && (SqlDataLayerConverter.VerifyInt32(message["UserID"]) == PageContext.PageUserID)) || PageContext.ForumModeratorAccess) && PageContext.ForumEditAccess); }
/// <summary> /// Get status of provider role vs YAF roles. /// </summary> /// <param name="currentRow">Data row which contains data about role.</param> /// <returns>String "Linked" when role is linked to YAF roles, "Unlinkable" otherwise.</returns> protected string GetLinkedStatus(System.Data.DataRowView currentRow) { // check whether role is Guests role, which can't be linked if (General.BinaryAnd(currentRow["Flags"], 2)) { return("Unlinkable"); } else { return("Linked"); } }
protected string LadderInfo(object _o) { DataRowView dr = (DataRowView)_o; ///object IsLadder,object MinPosts ///Eval( "IsLadder"),Eval( "MinPosts") bool isLadder = General.BinaryAnd(dr["Flags"], RankFlags.Flags.IsLadder); string tmp = String.Format("{0}", isLadder); if (isLadder) { tmp += String.Format(" ({0} posts)", dr["MinPosts"]); } return(tmp); }
private bool CanQuotePostCheck(DataRow message) { DataRow forumInfo, topicInfo; // get topic and forum information topicInfo = DB.topic_info(PageContext.PageTopicID); using (DataTable dt = DB.forum_list(PageContext.PageBoardID, PageContext.PageForumID)) forumInfo = dt.Rows[0]; if (topicInfo == null || forumInfo == null) { return(false); } // Ederon : 9/9/2007 - moderator can reply to locked topics return((!General.BinaryAnd(forumInfo["Flags"], ForumFlags.Flags.IsLocked) && !General.BinaryAnd(topicInfo["Flags"], TopicFlags.Flags.IsLocked) || PageContext.ForumModeratorAccess) && PageContext.ForumReplyAccess); }
/// <summary> /// Handles the PostReply click including: Replying, Editing and New post. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void PostReply_Click(object sender, System.EventArgs e) { if (!IsPostReplyVerified()) { return; } if (IsPostReplyDelay()) { return; } // update the last post time... Mession.LastPost = DateTime.Now.AddSeconds(30); long nMessageID = 0; if (TopicID != null) // Reply to topic { nMessageID = PostReplyHandleReplyToTopic(); } else if (EditTopicID != null) // Edit existing post { nMessageID = PostReplyHandleEditPost(); } else // New post { nMessageID = PostReplyHandleNewPost(); } // Check if message is approved bool bApproved = false; using (DataTable dt = DB.message_list(nMessageID)) foreach (DataRow row in dt.Rows) { bApproved = General.BinaryAnd(row["Flags"], MessageFlags.Flags.IsApproved); } // Create notification emails if (bApproved) { CreateMail.CreateWatchEmail(nMessageID); if (PageContext.ForumUploadAccess && TopicAttach.Checked) { // redirect to the attachment page... YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.attachments, "m={0}", nMessageID); } else { // regular redirect... YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.posts, "m={0}&#post{0}", nMessageID); } } else { // Tell user that his message will have to be approved by a moderator //PageContext.AddLoadMessage("Since you posted to a moderated forum, a forum moderator must approve your post before it will become visible."); string url = YAF.Classes.Utils.YafBuildLink.GetLink(YAF.Classes.Utils.ForumPages.topics, "f={0}", PageContext.PageForumID); if (YAF.Classes.Config.IsRainbow) { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1"); } else { YAF.Classes.Utils.YafBuildLink.Redirect(YAF.Classes.Utils.ForumPages.info, "i=1&url={0}", Server.UrlEncode(url)); } } }
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 bool GetModerated(object o) { return(General.BinaryAnd((( DataRow )o) ["Flags"], ForumFlags.Flags.IsModerated)); }