Example #1
0
        public static void ParsePostListExtraInfo(PostpramsInfo postpramsInfo, List<Attachment> attachList, bool isModer, List<Post> postList)
        {
            int hide = postpramsInfo.Hide;
            int allowGetAttachValue = Posts.GetAllowGetAttachValue(postpramsInfo);
            var guest = UserGroup.Guest;
            //var topicInfo = postpramsInfo.Topicinfo;
            //if (postpramsInfo.Topicinfo == null) topicInfo = Topic.FindByID(postpramsInfo.Tid);
            var topicInfo = Topic.FindByID(postpramsInfo.Tid);

            string stringarray = string.Empty;
            if (topicInfo.Special == 4 && !guest.AllowDiggs)
            {
                stringarray = Debatedigg.GetUesrDiggs(postpramsInfo.Tid, postpramsInfo.CurrentUserid);
            }
            foreach (var pi in postList)
            {
                Posts.LoadPostMessage(postpramsInfo, attachList, isModer, allowGetAttachValue, hide, pi);
                if (topicInfo.Special == 4)
                {
                    if (guest.AllowDiggs)
                    {
                        pi.Digged = Debates.IsDigged(pi.ID, postpramsInfo.CurrentUserid);
                    }
                    else
                    {
                        pi.Digged = Utils.InArray(pi.ID.ToString(), stringarray);
                    }
                }
            }
        }
Example #2
0
        private static List <Post> GetDebatePostList(PostpramsInfo pi, out List <Attachment> attachList, bool isModer, int debateOpinion, PostOrderType postOrderType)
        {
            var sb = new StringBuilder();
            //var list = BBX.Data.Debates.GetDebatePostList(pi, debateOpinion, postOrderType);
            var list = Post.SearchDebate(pi.Tid, debateOpinion, (pi.Pageindex - 1) * pi.Pagesize, pi.Pagesize);

            if (list.Count == 0 && pi.Pageindex > 1)
            {
                //var count = BBX.Data.Debates.GetRealDebatePostCount(pi.Tid, debateOpinion);
                var count = Post.SearchDebateCount(pi.Tid, debateOpinion);
                pi.Pageindex = ((count % pi.Pagesize == 0) ? (count / pi.Pagesize) : (count / pi.Pagesize + 1));
                //list = BBX.Data.Debates.GetDebatePostList(pi, debateOpinion, postOrderType);
                list = Post.SearchDebate(pi.Tid, debateOpinion, (pi.Pageindex - 1) * pi.Pagesize, pi.Pagesize);
            }
            var list2 = list.ToList();
            // 设置楼层
            var start = (pi.Pageindex - 1) * pi.Pagesize;
            var db    = Debate.FindByTid(pi.Tid);

            foreach (var item in list2)
            {
                item.Id = ++start;

                if (db != null)
                {
                    db.CastTo(item);
                }
            }

            var sb2           = new StringBuilder();
            int inPostAdCount = Advertisement.GetInPostAdCount("", pi.Fid);

            foreach (var item in list2)
            {
                Posts.LoadExtraPostInfo(item, inPostAdCount);
                sb.AppendFormat("{0},", item.ID);
                if (item.Attachment > 0)
                {
                    sb2.AppendFormat("{0},", item.ID);
                }
            }
            attachList = Attachments.GetAttachmentList(pi, sb2.ToString().TrimEnd(','));
            var postDiggs = Debates.GetPostDiggs(sb.ToString().Trim(','));

            foreach (var item in list2)
            {
                if (postDiggs.ContainsKey(item.ID))
                {
                    item.Diggs = postDiggs[item.ID];
                }
            }
            Posts.ParsePostListExtraInfo(pi, attachList, isModer, list2);
            return(list2);
        }
Example #3
0
        public static StringBuilder CommentDabetas(int tid, string message, bool ispost)
        {
            var sb = Debates.IsValidDebates(tid, message, ispost);

            if (!sb.ToString().Contains("<error>"))
            {
                sb.Append("<message>" + message + "</message>");
                //BBX.Data.Debates.CommentDabetas(tid, TypeConverter.ObjectToInt(TableList.GetPostTableId(tid)), Utils.HtmlEncode(ForumUtils.BanWordFilter(message)));
                var pi = Post.FindByTid(tid);
                pi.Message += Utils.HtmlEncode(ForumUtils.BanWordFilter(message));
                pi.Update();
            }
            return(sb);
        }