public static List <IXForum> GetSubForumCollection(int fid, int colcount, int hideprivate, int usergroupid, int moderstyle) { var list = new List <IXForum>(); if (fid > 0) { //list = BBX.Data.Forums.GetSubForumList(fid, colcount); list = XForum.GetSubForumList(fid, colcount); foreach (var forum in list) { forum.Description = UBB.ParseSimpleUBB(forum.Description); //forum.Moderators = Forums.GetModerators(forum, moderstyle); if (forum.ModeratorsHtml == null) { forum.ModeratorsHtml = forum.GetModerators(moderstyle); } if (forum.LastPost <= DateTime.MinValue || forum.LastPost.Date != DateTime.Now.Date) { forum.TodayPosts = 0; } //if (!forum.Viewperm.IsNullOrEmpty() && !Utils.InArray(usergroupid.ToString(), forum.Viewperm) && hideprivate == 0) //{ // forum.LastTitle = ""; // forum.LastPoster = ""; // forum.Status = -1; //} } } return(list); }
public static int CopyTopics(string topiclist, int fid) { if (!Utils.IsNumericList(topiclist)) { return(-1); } int num = 0; string[] array = topiclist.Split(','); for (int i = 0; i < array.Length; i++) { string str = array[i]; var tp_ = Topic.FindByID(str.ToInt()); if (tp_ != null) { var tp = new Topic(); tp.CopyFrom(tp_); tp.Fid = fid; tp.ReadPerm = 0; tp.Price = 0; //tp.Postdatetime = Utils.GetDateTime(); //tp.Lastpost = Utils.GetDateTime(); //tp.Lastposter = Utils.GetDateTime(); tp.Views = 0; tp.Replies = 0; tp.DisplayOrder = 0; tp.Highlight = ""; tp.Digest = 0; tp.Rate = 0; tp.Hide = 0; tp.Special = 0; tp.Attachment = 0; tp.Moderated = 0; tp.Closed = 0; var pi_ = Post.FindByTid(tp.ID); var pi = new Post(); pi.CopyFrom(pi_); pi.Fid = tp.Fid; //pi.Tid = num2; pi.ParentID = 0; pi.Layer = 0; //pi.Postdatetime = Utils.GetDateTime(); pi.Invisible = 0; pi.Attachment = 0; pi.Rate = 0; pi.RateTimes = 0; pi.Message = UBB.ClearAttachUBB(pi.Message); pi.Title = tp.Title; tp.Create(pi); } } return(num); }
public static EntityList<Post> GetPostTree(int tid, int hide, int userCredit) { var list = Post.GetPostTree(tid); foreach (var pi in list) { pi["spaces"] = Utils.GetSpacesString(pi.Layer); var msg = pi.Message; var msg2 = Utils.CutString(Utils.HtmlEncode(msg), 0, 50); if (hide != -1) msg2 = UBB.HideDetail(msg2, hide, userCredit); pi.Message = msg2; if (!String.IsNullOrEmpty(msg)) pi.Title = msg; } return list; }
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; }
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; }