public void GetPostLayer() { //DataTable dataTable = new DataTable(); string[] array = DNTRequest.GetString("pid").Split(','); for (int i = 0; i < array.Length; i++) { string text = array[i]; string text2 = text.Split('|')[0]; if (!text2.IsNullOrEmpty()) { //dataTable = BBX.Data.Posts.GetPostLayer(currentPostTableId, int.Parse(text2)); //if (dataTable.Rows.Count > 0) var pi = Post.FindByID(text2.ToInt()); if (pi != null) { if (pi.Layer == 0) { TopicAdmins.DeleteTopics(pi.Tid + "", false); } else { Posts.DeletePost(pi, false, false); } } } } }
private void SetPostInfo_Click(object sender, EventArgs e) { #region 除选中的帖子 if (this.CheckCookie()) { if (DNTRequest.GetString("pid") != "") { string pidlist = DNTRequest.GetString("pid"); string posttableid = ViewState["posttablename"].ToString().Trim().Replace(BaseConfigs.GetTablePrefix + "posts", ""); posttableid = (posttableid == "" ? "1" : posttableid); foreach (string idlist in DNTRequest.GetString("pid").Split(',')) { int pid = int.Parse(idlist.Split('|')[0]); int tid = int.Parse(idlist.Split('|')[1]); #region 更新用户金币金币 PostInfo post = Posts.GetPostInfo(tid, pid); ForumInfo forum = Forums.GetForumInfo(post.Fid); int Losslessdel = Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24); // 通过验证的用户可以删除帖子,如果是主题贴则另处理 if (post.Layer == 0) { TopicAdmins.DeleteTopics(tid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false); //重新统计论坛帖数 Forums.SetRealCurrentTopics(forum.Fid); } else { int reval = Posts.DeletePost(posttableid, Convert.ToInt32(pid), false, true); if (reval > 0 && Losslessdel < 0) { UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1); } // 删除主题游客缓存 ForumUtils.DeleteTopicCacheFile(tid.ToString()); //再次确保回复数精确 Topics.UpdateTopicReplies(tid); } #endregion } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量删帖", "帖子ID:" + pidlist); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchpost.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_searchpost.aspx';</script>"); } } #endregion }
private void DeleteSelectTopic_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (Request["tid"] != "") { TopicAdmins.DeleteTopics(Request["tid"], false); base.RegisterStartupScript("", "<script>alert('提交成功');window.location.href='forum_auditingtopic.aspx';</script>"); return; } base.RegisterStartupScript("", "<script>alert('您未选择任何主题!');window.location.href='forum_auditingtopic.aspx';</script>"); } }
/// <summary> /// 创建主题帖信息 /// </summary> /// <param name="topicinfo"></param> /// <returns></returns> public PostInfo CreatePost(TopicInfo topicinfo) { PostInfo postinfo = new PostInfo(); postinfo.Fid = forumid; postinfo.Tid = topicinfo.Tid; postinfo.Poster = username; postinfo.Posterid = userid; postinfo.Title = useradminid == 1 ? Utils.HtmlEncode(posttitle) : postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(posttitle)); postinfo.Postdatetime = curdatetime; postinfo.Message = message; postinfo.Ip = DNTRequest.GetIP(); postinfo.Invisible = UserAuthority.GetTopicPostInvisible(forum, useradminid, userid, usergroupinfo, postinfo); postinfo.Usesig = TypeConverter.StrToInt(DNTRequest.GetString("usesig")); postinfo.Htmlon = (usergroupinfo.Allowhtml == 1 && (TypeConverter.StrToInt(DNTRequest.GetString("htmlon")) == 1)) ? 1 : 0; postinfo.Smileyoff = (smileyoff == 0 && forum.Allowsmilies == 1) ? TypeConverter.StrToInt(DNTRequest.GetString("smileyoff")) : smileyoff; postinfo.Bbcodeoff = (usergroupinfo.Allowcusbbcode == 1 && forum.Allowbbcode == 1) ? postinfo.Bbcodeoff = TypeConverter.StrToInt(DNTRequest.GetString("bbcodeoff")) : 1; postinfo.Parseurloff = TypeConverter.StrToInt(DNTRequest.GetString("parseurloff")); postinfo.Topictitle = topicinfo.Title; //if (Utils.GetCookie("lasttopictitle") == Utils.MD5(postinfo.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(postinfo.Message)) //{ // AddErrLine("请勿重复发帖"); // return postinfo; //} try { postinfo.Pid = Posts.CreatePost(postinfo); Utils.WriteCookie("lasttopictitle", Utils.MD5(postinfo.Title)); Utils.WriteCookie("lasttopicmessage", Utils.MD5(postinfo.Message)); } catch { TopicAdmins.DeleteTopics(topicinfo.Tid.ToString(), false); AddErrLine("帖子保存出现异常"); } //创建投票 if (createpoll) { msg = Polls.CreatePoll(DNTRequest.GetFormString("PollItemname"), DNTRequest.GetString("multiple") == "on" ? 1 : 0, DNTRequest.GetInt("maxchoices", 1), DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0, enddatetime, topicinfo.Tid, pollitem, userid); } return(postinfo); }
private void SetPostInfo_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (Request["pid"] != "") { string pid = Request["pid"]; //string text = this.ViewState["posttablename"].ToString().Trim().Replace(BaseConfigs.GetTablePrefix + "posts", ""); //text = ((String.IsNullOrEmpty(text)) ? "1" : text); string[] array = Request["pid"].Split(','); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; int num = int.Parse(text2.Split('|')[0]); int tid = int.Parse(text2.Split('|')[1]); var pi = Post.FindByID(num); if (pi != null) { var forumInfo = Forums.GetForumInfo(pi.Fid); if (forumInfo != null) { //Utils.StrDateDiffHours(postInfo.Postdatetime, this.config.Losslessdel * 24); if (pi.Layer == 0) { TopicAdmins.DeleteTopics(tid.ToString(), forumInfo.Recyclebin != 0, false); XForum.SetRealCurrentTopics(forumInfo.ID); } else { Posts.DeletePost(pi, false, true); ForumUtils.DeleteTopicCacheFile(tid.ToString()); Topics.UpdateTopicReplyCount(tid); } } } } AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量删帖", "帖子ID:" + pid); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchpost.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_searchpost.aspx';</script>"); } }
private void DeleteSelectTopic_Click(object sender, EventArgs e) { #region 除选中的主题 if (this.CheckCookie()) { if (DNTRequest.GetString("tid") != "") { TopicAdmins.DeleteTopics(DNTRequest.GetString("tid"), false); this.RegisterStartupScript("", "<script>alert('提交成功');window.location.href='forum_auditingtopic.aspx';</script>"); } else { this.RegisterStartupScript("", "<script>alert('您未选择任何主题!');window.location.href='forum_auditingtopic.aspx';</script>"); } } #endregion }
private void AllDelete_Click(object sender, EventArgs e) { #region 全部删除 if (this.CheckCookie()) { string topiclist = ""; DataTable dt = Topics.GetAuditTopicList(ViewState["condition"].ToString()); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { topiclist += dr["tid"].ToString() + ","; } TopicAdmins.DeleteTopics(topiclist.TrimEnd(','), false); } this.RegisterStartupScript("", "<script>alert('提交成功');window.location.href='forum_auditingtopic.aspx';</script>"); } #endregion }
public void DeleteRecycle_Click(object sender, EventArgs e) { #region 回收站主题删除 if (this.CheckCookie()) { string topiclist = ""; //DataTable dt = DbHelper.ExecuteDataset("SELECT [tid] FROM [" + BaseConfigs.GetTablePrefix + "topics] WHERE [displayorder]=-1 AND [postdatetime]<='" + DateTime.Now.AddDays(-Convert.ToInt32(RecycleDay.Text)) + "'").Tables[0]; DataTable dt = DatabaseProvider.GetInstance().GetTidForModeratormanagelogByPostdatetime(DateTime.Now.AddDays(-Convert.ToInt32(RecycleDay.Text))); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { topiclist += dr["tid"].ToString() + ","; } TopicAdmins.DeleteTopics(topiclist.Substring(0, topiclist.Length - 1), 0, false); } base.RegisterStartupScript("PAGE", "window.location.href='forum_auditingtopic.aspx';"); } #endregion }
private void SelectDelete_Click(object sender, EventArgs e) { #region 对选中的帖子进行删除 if (this.CheckCookie()) { if (DNTRequest.GetString("pid") != "") { DataTable dt = new DataTable(); foreach (string pid in DNTRequest.GetString("pid").Split(',')) { if (pid.Trim() != "") { //dt = DbHelper.ExecuteDataset("SELECT TOP 1 * [layer],[tid] FROM [" + BaseConfigs.GetTablePrefix + "posts" + postlist.SelectedValue + "] WHERE [pid]=" + pid).Tables[0]; dt = DatabaseProvider.GetInstance().GetPostLayer(int.Parse(postlist.SelectedValue), int.Parse(pid)); if (dt.Rows.Count > 0) { if (dt.Rows[0]["layer"].ToString().Trim() == "0") { TopicAdmins.DeleteTopics(dt.Rows[0]["tid"].ToString(), false); } else { Posts.DeletePost(postlist.SelectedValue, Convert.ToInt32(pid), false, false); } } } } base.RegisterStartupScript("PAGE", "window.location.href='forum_auditpost.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_auditpost.aspx';</script>"); } } #endregion }
//private bool isModer = false; protected override void ShowPage() { if (postid == -1) { AddErrLine("无效的帖子ID"); return; } // 获取该帖子的信息 post = Posts.GetPostInfo(topicid, postid); if (post == null) { AddErrLine("不存在的帖子ID"); return; } // 获取该主题的信息 topic = Topics.GetTopicInfo(topicid); if (topic == null) { AddErrLine("不存在的主题ID"); return; } if (topicid != post.Tid) { AddErrLine("主题ID无效"); return; } topictitle = topic.Title; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); forumname = forum.Name; pagetitle = string.Format("删除{0}", post.Title); forumnav = ShowForumAspxRewrite(forum.Pathlist.Trim(), forumid, forumpageid); if (!CheckPermission(post, DNTRequest.GetInt("opinion", -1))) { return; } if (!allowDelPost) { AddErrLine("当前不允许删帖"); return; } // 通过验证的用户可以删除帖子,如果是主题帖则另处理 if (post.Layer == 0) { TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false); //重新统计论坛帖数 Forums.SetRealCurrentTopics(forum.Fid); ForumTags.DeleteTopicTags(topicid); } else { int reval; if (topic.Special == 4) { if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2) { AddErrLine("参数错误"); return; } reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true); Debates.DeleteDebatePost(topicid, DNTRequest.GetInt("opinion", -1), postid); } else { reval = Posts.DeletePost(Posts.GetPostTableId(topicid), postid, false, true); } // 删除主题游客缓存 ForumUtils.DeleteTopicCacheFile(topicid); //再次确保回复数精确 Topics.UpdateTopicReplyCount(topic.Tid); //更新指定版块的最新发帖数信息 Forums.UpdateLastPost(forum); if (reval > 0 && Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24) < 0) { UserCredits.UpdateUserCreditsByDeletePosts(post.Posterid); } } SetUrl(post.Layer == 0 ? base.ShowForumAspxRewrite(post.Fid, 0) : Urls.ShowTopicAspxRewrite(post.Tid, 1)); SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("删除帖子成功, 返回主题"); }
protected override void ShowPage() { // 获取帖子ID topicid = DNTRequest.GetInt("topicid", -1); postid = DNTRequest.GetInt("postid", -1); // 如果主题ID非数字 if (postid == -1) { AddErrLine("无效的帖子ID"); return; } // 获取该帖子的信息 post = Posts.GetPostInfo(topicid, postid); // 如果该帖子不存在 if (post == null) { AddErrLine("不存在的主题ID"); return; } // 获取该主题的信息 topic = Topics.GetTopicInfo(topicid); // 如果该主题不存在 if (topic == null) { AddErrLine("不存在的主题ID"); return; } if (topicid != post.Tid) { AddErrLine("主题ID无效"); return; } topictitle = topic.Title; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); forumname = forum.Name; pagetitle = "删除" + post.Title; forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname); int opinion = DNTRequest.GetInt("opinion", -1); if (!CheckPermission(post, opinion)) { return; } if (!allowdelpost) { AddErrLine("当前不允许删帖"); return; } int Losslessdel = Utils.StrDateDiffHours(post.Postdatetime, config.Losslessdel * 24); // 通过验证的用户可以删除帖子,如果是主题贴则另处理 if (post.Layer == 0) { TopicAdmins.DeleteTopics(topicid.ToString(), byte.Parse(forum.Recyclebin.ToString()), false); //重新统计论坛帖数 Forums.SetRealCurrentTopics(forum.Fid); ForumTags.DeleteTopicTags(topicid); } else { int reval; if (topic.Special == 4) { string opiniontext = ""; if (opinion != 1 && opinion != 2) { AddErrLine("参数错误"); return; } reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true); switch (opinion) { case 1: opiniontext = "positivediggs"; break; case 2: opiniontext = "negativediggs"; break; } Discuz.Data.DatabaseProvider.GetInstance().DeleteDebatePost(topicid, opiniontext, postid); } else { reval = Posts.DeletePost(Posts.GetPostTableID(topicid), postid, false, true); } // 删除主题游客缓存 ForumUtils.DeleteTopicCacheFile(topicid); //再次确保回复数精确 Topics.UpdateTopicReplies(topic.Tid); //更新指定版块的最新发帖数信息 Forums.UpdateLastPost(forum); if (reval > 0 && Losslessdel < 0) { UserCredits.UpdateUserCreditsByPosts(post.Posterid, -1); } } SetUrl(Urls.ShowTopicAspxRewrite(post.Tid, 1)); if (post.Layer == 0) { SetUrl(base.ShowForumAspxRewrite(post.Fid, 0)); } SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("删除帖子成功, 返回主题"); }
protected override void ShowPage() { if (this.postid == -1) { base.AddErrLine("无效的帖子ID"); return; } this.post = Post.FindByID(this.postid); if (this.post == null) { base.AddErrLine("不存在的帖子ID"); return; } this.topic = Topic.FindByID(this.topicid); if (this.topic == null) { base.AddErrLine("不存在的主题ID"); return; } if (this.topicid != this.post.Tid) { base.AddErrLine("主题ID无效"); return; } this.topictitle = this.topic.Title; this.forumid = this.topic.Fid; this.forum = Forums.GetForumInfo(this.forumid); this.forumname = this.forum.Name; this.pagetitle = string.Format("删除{0}", this.post.Title); this.forumnav = base.ShowForumAspxRewrite(this.forum.Pathlist.Trim(), this.forumid, this.forumpageid); if (!this.CheckPermission(this.post, DNTRequest.GetInt("opinion", -1))) { return; } if (!this.allowDelPost) { base.AddErrLine("当前不允许删帖"); return; } if (this.post.Layer == 0) { TopicAdmins.DeleteTopics(this.topicid.ToString(), forum.Recyclebin, false); XForum.SetRealCurrentTopics(this.forum.Fid); Tag.DeleteTopicTags(this.topicid); } else { if (this.topic.Special == 4) { if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2) { base.AddErrLine("参数错误"); return; } Posts.DeletePost(post, false, true); Debate.DeleteDebatePost(this.topicid, DNTRequest.GetInt("opinion", -1), this.postid); } else { Posts.DeletePost(post, false, true); } ForumUtils.DeleteTopicCacheFile(this.topicid); Topics.UpdateTopicReplyCount(this.topic.ID); //Forums.UpdateLastPost(this.forum); (forum as XForum).ResetLastPost(); } base.SetUrl((this.post.Layer == 0) ? base.ShowForumAspxRewrite(this.post.Fid, 0) : Urls.ShowTopicAspxRewrite(this.post.Tid, 1)); base.SetMetaRefresh(); base.SetShowBackLink(false); base.AddMsgLine("删除帖子成功, 返回主题"); }
private void SetTopicInfo_Click(object sender, EventArgs e) { #region 定的操作管理主题 if (this.CheckCookie()) { if (DNTRequest.GetString("tid") != "") { string tidlist = DNTRequest.GetString("tid"); switch (DNTRequest.GetString("operation")) { case "moveforum": { if (forumid.SelectedValue != "0") { //先找出当前主题列表中所属的FID //foreach (DataRow olddr in DbHelper.ExecuteDataset("SELECT distinct [fid] From [" + BaseConfigs.GetTablePrefix + "topics] WHERE [tid] IN(" + tidlist + ")").Tables[0].Rows) foreach (DataRow olddr in DatabaseProvider.GetInstance().GetTopicFidByTid(tidlist).Rows) { string oldtidlist = "0"; //以FID和列表为条件列出在当前FID下的主题列表 //foreach (DataRow mydr in DbHelper.ExecuteDataset("SELECT [tid] From [" + BaseConfigs.GetTablePrefix + "topics] WHERE [tid] IN(" + tidlist + ") AND [fid]=" + olddr["fid"]).Tables[0].Rows) foreach (DataRow mydr in DatabaseProvider.GetInstance().GetTopicTidByFid(tidlist, int.Parse(olddr["fid"].ToString())).Rows) { oldtidlist += "," + mydr["tid"].ToString(); } //调用前台操作函数 TopicAdmins.MoveTopics(oldtidlist, Convert.ToInt16(forumid.SelectedValue), Convert.ToInt16(olddr["fid"].ToString())); } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量移动主题", "主题ID:" + tidlist + " <br />目标论坛fid:" + forumid.SelectedValue); } break; } case "movetype": { if (typeid.SelectedValue != "0") { AdminTopics.SetTypeid(tidlist, Convert.ToInt16(typeid.SelectedValue)); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量修改主题类型", "主题ID:" + tidlist + " <br />类型tid:" + typeid.SelectedValue); } break; } case "delete": { if (nodeletepostnum.Checked) { TopicAdmins.DeleteTopics(tidlist, 0, false); } else { TopicAdmins.DeleteTopics(tidlist, 1, false); } Attachments.UpdateTopicAttachment(tidlist); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量删除主题", "主题ID:" + tidlist); break; } case "displayorder": { AdminTopics.SetDisplayorder(tidlist, Convert.ToInt16(DNTRequest.GetString("displayorder_level"))); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量置顶主题", "主题ID:" + tidlist + "<br /> 置顶级为:" + DNTRequest.GetString("displayorder_level")); break; } case "adddigest": { TopicAdmins.SetDigest(DNTRequest.GetString("tid").Replace("0 ", ""), (short)Convert.ToInt16(DNTRequest.GetString("digest_level"))); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量加精主题", "主题ID:" + tidlist + "<br /> 加精级为:" + DNTRequest.GetString("digest_level")); break; } case "deleteattach": { AdminTopicOperations.DeleteAttachmentByTid(DNTRequest.GetString("tid").Replace("0 ", "")); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除主题中的附件", "主题ID:" + tidlist); break; } } base.RegisterStartupScript("PAGE", "window.location.href='forum_topicsgrid.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('请选择相应的主题!');window.location.href='forum_topicsgrid.aspx';</script>"); } } #endregion }