Exemplo n.º 1
0
 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);
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = ppp; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = topic.Hide >= 1 ? (ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : topic.Hide) : topic.Hide;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : postpramsInfo.Hide;
            hide = postpramsInfo.Hide;
            postpramsInfo.Condition     = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, posterid);
            postpramsInfo.TemplateWidth = Templates.GetTemplateWidth(templatepath);//获取当前模版的宽度
            postpramsInfo.Usercredits   = userInfo == null ? 0 : userInfo.Credits;
            postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            }

            if (postlist.Count > 0)
            {
                this.Context.MaskUserName(postlist, oluserinfo);
            }

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
        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
        }
Exemplo n.º 4
0
 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>");
     }
 }
Exemplo n.º 5
0
 private void SelectDelete_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         if (Request["tid"] != "")
         {
             TopicAdmins.DeleteTopicsWithoutChangingCredits(Request["tid"], false);
             base.RegisterStartupScript("", "<script>window.location='forum_auditnewtopic.aspx';</script>");
             return;
         }
         base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location='forum_auditnewtopic.aspx';</script>");
     }
 }
Exemplo n.º 6
0
        private bool DoIndentifyOperation()
        {
            int identify = DNTRequest.GetInt("selectidentify", 0);

            if (identify > 0 || identify == -1)
            {
                TopicAdmins.IdentifyTopic(goodslist, identify);
                return(true);
            }
            else
            {
                AddErrLine("错误的参数");
                return(false);
            }
        }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
 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 AudioSelectTopic_Click(object sender, EventArgs e)
        {
            #region 恢复选中的帖子

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("tid") != "")
                {
                    TopicAdmins.RestoreTopics(DNTRequest.GetString("tid"));
                    base.RegisterStartupScript("", "<script>alert('提交成功');window.location.href='forum_auditingtopic.aspx';</script>");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选择任何主题!');window.location.href='forum_auditingtopic.aspx';</script>");
                }
            }

            #endregion
        }
Exemplo n.º 10
0
        private void SelectDelete_Click(object sender, EventArgs e)
        {
            #region 对选中的主题进行删除

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("tid") != "")
                {
                    //TopicAdmins.DeleteTopics(DNTRequest.GetString("tid"), 0, false);
                    TopicAdmins.DeleteTopicsWithoutChangingCredits(DNTRequest.GetString("tid"), false);
                    base.RegisterStartupScript("", "<script>window.location='forum_auditnewtopic.aspx';</script>");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location='forum_auditnewtopic.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
        }
Exemplo n.º 12
0
        private void AllAudioPass_Click(object sender, EventArgs e)
        {
            #region 全部恢复

            if (this.CheckCookie())
            {
                //彻底删除
                string    topiclist = "";
                DataTable dt        = DatabaseProvider.GetInstance().AuditTopicBind(ViewState["condition"].ToString());
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        topiclist += dr["tid"].ToString() + ",";
                    }
                    TopicAdmins.RestoreTopics(topiclist.Substring(0, topiclist.Length - 1));
                }
                base.RegisterStartupScript("", "<script>alert('提交成功');window.location.href='forum_auditingtopic.aspx';</script>");
            }

            #endregion
        }
Exemplo n.º 13
0
        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
        }
Exemplo n.º 14
0
        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
        }
Exemplo n.º 15
0
        //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("删除帖子成功, 返回主题");
        }
Exemplo n.º 16
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            //未结束的悬赏
            if (topic.Special != 3)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + ShowTopicAspxRewrite(topic.Tid, 1));
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));

            //得到广告列表
            GetForumAds(forum.Fid);

            //检查是否具有版主的身份
            IsModer();

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            bonuslogs   = Bonus.GetLogs(topic);

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            if (newpmcount > 0)
            {
                pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);
            }

            score     = Scoresets.GetValidScoreName();
            scoreunit = Scoresets.GetValidScoreUnit();

            GetPostAds(GetPostPramsInfo(), postlist.Count);

            if (postlist.Count <= 0)
            {
                AddErrLine("读取信息失败");
                return;
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(postlist[0].Message));

            //更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);

            BindDownloadAttachmentTip();

            ForumUtils.WriteCookie("referer", string.Format("showbonus.aspx?topicid={0}", topicid.ToString()));
        }
Exemplo n.º 17
0
        /// <summary>
        /// 获取帖子参数信息(PostPramsInfo)
        /// </summary>
        /// <param name="price"></param>
        /// <returns></returns>
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            //获取当前页主题列表
            PostpramsInfo postpramsInfo = new PostpramsInfo();

            postpramsInfo.Fid                    = forum.Fid;
            postpramsInfo.Tid                    = topicid;
            postpramsInfo.Jammer                 = forum.Jammer;
            postpramsInfo.Pagesize               = ppp; // 得到Ppp设置
            postpramsInfo.Pageindex              = pageid;
            postpramsInfo.Getattachperm          = forum.Getattachperm;
            postpramsInfo.Usergroupid            = usergroupid;
            postpramsInfo.Attachimgpost          = config.Attachimgpost;
            postpramsInfo.Showattachmentpath     = config.Showattachmentpath;
            postpramsInfo.Price                  = price;
            postpramsInfo.Usergroupreadaccess    = (ismoder == 1) ? int.MaxValue : usergroupinfo.Readaccess;
            postpramsInfo.CurrentUserid          = userid;
            postpramsInfo.Showimages             = forum.Allowimgcode;
            postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsInfo.Smiliesmax             = config.Smiliesmax;
            postpramsInfo.Bbcodemode             = config.Bbcodemode;
            postpramsInfo.CurrentUserGroup       = usergroupinfo;
            postpramsInfo.Topicinfo              = topic;
            //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容
            //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见
            postpramsInfo.Hide = topic.Hide >= 1 ? (ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : topic.Hide) : topic.Hide;
            //postpramsInfo.Hide = ismoder == 1 || Posts.IsReplier(topicid, userid) ? -1 : 1;
            postpramsInfo.Hide = topic.Posterid == userid ? -2 : postpramsInfo.Hide;
            hide = postpramsInfo.Hide;
            postpramsInfo.Condition     = Posts.GetPostPramsInfoCondition(onlyauthor, topicid, posterid);
            postpramsInfo.TemplateWidth = Templates.GetTemplateWidth(templatepath);//获取当前模版的宽度
            postpramsInfo.Usercredits   = userInfo == null ? 0 : userInfo.Credits;
            postpramsInfo.Invisible     = invisible;
            switch (stand)
            {
            case 0:
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 1:
                postlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;

            case 2:
                postlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);
                break;
            }
            if (topic.Special == 4)
            {
                string pidList = "";
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    pidList += post.Pid + ",";
                }
                Dictionary <int, int> postdiggs = Debates.GetPostDiggs(pidList.Trim(','));
                foreach (ShowtopicPagePostInfo post in postlist)
                {
                    if (postdiggs.ContainsKey(post.Pid))
                    {
                        post.Diggs = postdiggs[post.Pid];
                    }
                }
            }
            if (postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(topicid.ToString());
                topic = GetTopicInfo();
                BindPageCountAndId();
                postpramsInfo.Pageindex = pagecount;
                postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1);
            }

            foreach (ShowtopicPageAttachmentInfo showtopicpageattachinfo in attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid))
                {
                    showtopicpageattachinfo.Getattachperm = 1;
                    showtopicpageattachinfo.Allowread     = 1;
                }
            }
            BindDownloadAttachmentTip();

            return(postpramsInfo);
        }
Exemplo n.º 18
0
 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("删除帖子成功, 返回主题");
 }
Exemplo n.º 19
0
        public PostpramsInfo GetPostPramsInfo(int price)
        {
            var pi = new PostpramsInfo();

            pi.Fid                    = this.forum.Fid;
            pi.Tid                    = this.topicid;
            pi.Jammer                 = this.forum.Jammer;
            pi.Pagesize               = this.ppp;
            pi.Pageindex              = this.pageid;
            pi.Getattachperm          = this.forum.Getattachperm;
            pi.Usergroupid            = this.usergroupid;
            pi.Attachimgpost          = this.config.Attachimgpost;
            pi.Showattachmentpath     = this.config.Showattachmentpath;
            pi.Price                  = price;
            pi.Usergroupreadaccess    = ((this.ismoder == 1) ? 0x7FFFFFFF : this.usergroupinfo.Readaccess);
            pi.CurrentUserid          = this.userid;
            pi.Showimages             = this.forum.Allowimgcode;
            pi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            pi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            pi.Smiliesmax             = this.config.Smiliesmax;
            pi.Bbcodemode             = this.config.Bbcodemode;
            pi.CurrentUserGroup       = this.usergroupinfo;
            //pi.Topicinfo = this.topic.Cast<TopicInfo>();
            pi.Hide          = ((this.topic.Hide >= 1) ? ((this.ismoder == 1 || Post.IsReplier(this.topicid, this.userid)) ? -1 : this.topic.Hide) : this.topic.Hide);
            pi.Hide          = ((this.topic.PosterID == this.userid) ? -2 : pi.Hide);
            this.hide        = pi.Hide;
            pi.Condition     = Posts.GetPostPramsInfoCondition(this.onlyauthor, this.topicid, this.posterid);
            pi.TemplateWidth = Template.GetWidth(this.templatepath);
            pi.Usercredits   = ((this.userInfo == null) ? 0 : this.userInfo.Credits);
            pi.Invisible     = this.invisible;
            switch (this.stand)
            {
            case 0:
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 1:
                this.postlist = Debates.GetPositivePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;

            case 2:
                this.postlist = Debates.GetNegativePostList(pi, out this.attachmentlist, this.ismoder == 1);
                break;
            }
            if (this.topic.Special == 4)
            {
                string text = "";
                foreach (var item in this.postlist)
                {
                    text = text + item.ID + ",";
                }
                var postDiggs = Debates.GetPostDiggs(text.Trim(','));
                foreach (var item in this.postlist)
                {
                    if (postDiggs.ContainsKey(item.ID))
                    {
                        item.Diggs = postDiggs[item.ID];
                    }
                }
            }
            if (this.postlist.Count == 0)
            {
                TopicAdmins.RepairTopicList(this.topicid.ToString());
                this.topic = base.GetTopicInfo();
                this.BindPageCountAndId();
                pi.Pageindex  = this.pagecount;
                this.postlist = Posts.GetPostList(pi, out this.attachmentlist, this.ismoder == 1);
            }
            foreach (var current3 in this.attachmentlist)
            {
                if (Forums.AllowGetAttachByUserID(this.forum.Permuserlist, this.userid))
                {
                    current3.Getattachperm = 1;
                    current3.AllowRead     = true;
                }
            }
            base.BindDownloadAttachmentTip();
            return(pi);
        }
Exemplo n.º 20
0
        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("删除帖子成功, 返回主题");
        }
Exemplo n.º 21
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));
            ///得到广告列表
            GetForumAds(forum.Fid);

            // 检查是否具有版主的身份
            if (useradminid != 0)
            {
                ismoder   = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息
                if (admininfo != null)
                {
                    disablepostctrl = admininfo.Disablepostctrl;
                }
            }

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0;
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            usesig      = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;

            int price = 0;

            if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示
            {
                HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return;
            }

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            // 获取帖子总数
            onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor;

            // 获取分页相关信息
            BindPageCountAndId();

            PostpramsInfo postpramsInfo = GetPostPramsInfo(price);

            //获取当前正反方列表
            positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
            negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);

            GetPostAds(postpramsInfo, positivepostlist.Count);

            //辩论帖
            if (topic.Special == 4)
            {
                GetDebateInfo(postpramsInfo);
            }

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag)
            {
                relatedtopics = Topics.GetRelatedTopicList(topicid, 5);
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message));

            ///更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);
            BindDownloadAttachmentTip();
        }
Exemplo n.º 22
0
        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
        }