private void DeleteReply(int replyid) { try { Replies.DeleteReply(replyid); InvalidateForumCache(); } catch { } if (ReplyDeleteClicked != null) { ReplyDeleteClicked(this, EventArgs.Empty); } //Request.Form["__EVENTARGUMENT"] = null; }
public void DeletePost(string topicid, string replyid, string jsonform) { var form = HttpUtility.UrlDecode(jsonform); System.Collections.Specialized.NameValueCollection formresult = HttpUtility.ParseQueryString(form); string reason = formresult["ctl00$txtReason"]; int adminmodid = Convert.ToInt32(formresult["ctl00$hdnModerator"]); if (!String.IsNullOrEmpty(topicid)) { Topics.Delete(Convert.ToInt32(topicid)); } if (!String.IsNullOrEmpty(replyid)) { Replies.DeleteReply(Convert.ToInt32(replyid)); } if (!string.IsNullOrEmpty(reason) && Config.UseEmail) { ProcessModeration(1, Convert.ToInt32(topicid), Convert.ToInt32(replyid), adminmodid, reason); } }
public string SplitTopic(string jsonform) { var test = HttpUtility.UrlDecode(jsonform); System.Collections.Specialized.NameValueCollection formresult = HttpUtility.ParseQueryString(test); var replyIDs = new List <int>(); foreach (string key in formresult.AllKeys) { if (key.EndsWith("cbxRow")) { replyIDs.Add(Convert.ToInt32(formresult[key])); } } int topicid = Convert.ToInt32(formresult["ctl00$splitTopicId"]); int forumId = Convert.ToInt32(formresult["ctl00$ddlForum"]); string sort = formresult["ctl00$ddlSort"]; string subject = formresult["ctl00$tbxSubject"]; if (String.IsNullOrEmpty(subject)) { return("No subject supplied"); } TopicInfo oldtopic = Topics.GetTopic(topicid); ForumInfo forum = Forums.GetForum(forumId); if (replyIDs.Count == 0) { return("No replies selected"); } int lastreplyid = sort == "desc" ? replyIDs[replyIDs.Count - 1] : replyIDs[0]; ReplyInfo lastreply = Replies.GetReply(lastreplyid); //get the reply details var topic = new TopicInfo { Subject = subject, Message = lastreply.Message, Date = lastreply.Date, UseSignatures = lastreply.UseSignatures, IsSticky = false, PosterIp = lastreply.PosterIp, Views = 0, ReplyCount = replyIDs.Count - 1, Status = (int)Enumerators.PostStatus.Open, UnModeratedReplies = 0, ForumId = forumId, AuthorId = lastreply.AuthorId, CatId = forum.CatId }; bool isModeratedForum = forum.ModerationLevel != (int)Enumerators.Moderation.UnModerated; if (isModeratedForum) { if (forum.ModerationLevel == (int)Enumerators.Moderation.AllPosts || forum.ModerationLevel == (int)Enumerators.Moderation.Topics) { topic.Status = (int)Enumerators.PostStatus.UnModerated; } } int newtopicid = Topics.Add(topic); //delete the reply used as topic Replies.DeleteReply(lastreplyid); //move the other replies to this topic Replies.MoveReplies(newtopicid, replyIDs); //update the original topic count/dates Topics.Update(oldtopic.Id); Snitz.BLL.Admin.UpdateForumCounts(); return("Selected replies were moved to a new topic"); }