Exemple #1
0
        public static EntityList<Post> GetPagedLastPost(PostpramsInfo ppi)
        {
            var list = Post.GetPagedLastPost(ppi);
            var random = new Random((int)DateTime.Now.Ticks);
            int inPostAdCount = Advertisement.GetInPostAdCount("", ppi.Fid);
            foreach (var pi in list)
            {
                ppi.Smileyoff = pi.SmileyOff;
                ppi.BBCode = pi.BBCodeOff < 1;
                ppi.Parseurloff = pi.ParseUrlOff;
                ppi.Allowhtml = pi.HtmlOn;
                ppi.Pid = pi.ID;

                var msg = pi.Message;
                ppi.Sdetail = msg;
                if (ppi.Price > 0 && pi.Layer == 0)
                {
                    var ue = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
                    msg = string.Format("<div class=\"paystyle\">此帖为交易帖,要付 {0} <span class=\"bold\">{1}</span>{2} 才可查看</div>", ue.Name, ppi.Price, ue.Unit);
                }
                else
                {
                    if (!ppi.Ubbmode)
                        msg = UBB.UBBToHTML(ppi);
                    else
                        msg = Utils.HtmlEncode(msg);
                }
                pi.Adindex = random.Next(0, inPostAdCount);
                if (ppi.Jammer == 1) msg = ForumUtils.AddJammer(msg);
                pi.Html = msg;

                if (!pi["showemail"].ToBoolean())
                {
                    pi["email"] = "";
                }
            }
            return list;
        }
Exemple #2
0
        private static void LoadPostMessage(PostpramsInfo postpramsInfo, List<Attachment> attachList, bool isModer, int allowGetAttach, int originalHideStatus, Post pi)
        {
            bool flag = !Utils.InArray(pi.PostUser.GroupID + "", "4,5,6") && pi.Invisible == 0;
            var msg = pi.Message;
            if (pi.Invisible == 1)
            {
                msg = "<div class='hintinfo'>该帖子尚未通过审核, 您是发帖者, 以下是帖子内容</div>" + msg;
            }
            else if (!flag)
            {
                if (isModer)
                {
                    msg = "<div class='hintinfo'>该用户帖子内容已被屏蔽, 您拥有管理权限, 以下是帖子内容</div>" + msg;
                }
                else
                {
                    msg = "<div class='hintinfo'>该用户帖子内容已被屏蔽</div>";
                    var list = new List<Attachment>();
                    foreach (var att in attachList)
                    {
                        if (att.Pid == pi.ID)
                        {
                            list.Add(att);
                        }
                    }
                    foreach (var current2 in list)
                    {
                        attachList.Remove(current2);
                    }
                }
            }
            if (flag || isModer)
            {
                postpramsInfo.Smileyoff = pi.SmileyOff;
                postpramsInfo.BBCode = pi.BBCodeOff == 0;
                postpramsInfo.Parseurloff = pi.ParseUrlOff;
                postpramsInfo.Allowhtml = pi.HtmlOn;
                postpramsInfo.Sdetail = msg;
                postpramsInfo.Pid = pi.ID;
                var user = pi.PostUser;
                if (user != null && user.Group != null && !user.Group.AllowHideCode)
                    postpramsInfo.Hide = 0;

                if (!postpramsInfo.Ubbmode)
                    msg = UBB.UBBToHTML(postpramsInfo);
                else
                    msg = Utils.HtmlEncode(msg);

                if (postpramsInfo.Jammer == 1) msg = ForumUtils.AddJammer(msg);

                string text = msg;
                if (pi.Attachment > 0 || Posts.regexAttach.IsMatch(text) || Posts.regexAttachImg.IsMatch(text))
                {
                    string[] hiddenAttachIdList = Posts.GetHiddenAttachIdList(postpramsInfo.Sdetail, postpramsInfo.Hide);
                    var list2 = new List<Attachment>();
                    foreach (var item in attachList)
                    {
                        text = Attachments.GetMessageWithAttachInfo(postpramsInfo, allowGetAttach, hiddenAttachIdList, pi.ID, pi.PosterID, item, text);
                        if (item.Inserted || Utils.InArray(item.ID.ToString(), hiddenAttachIdList))
                        {
                            list2.Add(item);
                        }
                    }
                    foreach (var item in list2)
                    {
                        attachList.Remove(item);
                    }
                }
                msg = text;
                postpramsInfo.Hide = originalHideStatus;
            }
            pi.Html = msg;
        }