public static int RepairTopicList(string topicList) { if (!Utils.IsNumericList(topicList)) { return(0); } int num = 0; //string[] postTableIdArray = Posts.GetPostTableIdArray(topicList); string[] array = topicList.Split(','); for (int i = 0; i < array.Length; i++) { //int num2 = TopicAdmins.RepairTopics(array[i], BaseConfigs.GetTablePrefix + "posts" + postTableIdArray[i].ToInt()); var tp = Topic.FindByID(array[i].ToInt()); int num2 = tp.Repair(); if (num2 > 0) { num = num2 + num; Attachments.UpdateTopicAttachment(topicList); } } return(num); }
public static void BatchDeleteTopics(string tidList, bool isChagePostNumAndCredits, int adminUid, string adminUserName, int adminUserGroupId, string adminUserGroupTitle, string adminIp) { TopicAdmins.DeleteTopics(tidList, isChagePostNumAndCredits ? 1 : 0, false); Attachments.UpdateTopicAttachment(tidList); AdminVisitLog.InsertLog(adminUid, adminUserName, adminUserGroupId, adminUserGroupTitle, adminIp, "批量删除主题", "主题ID:" + tidList); }
private static string ParseImageAttachContent(PostpramsInfo postPramsInfo, Attachment att, string fileSize) { string empty = string.Empty; string forumpath = BaseConfigInfo.Current.Forumpath; string text = string.Format("<span style=\"position: absolute; display: none;\" onmouseover=\"showMenu(this.id, 0, 1)\" id=\"attach_{0}\"><img border=\"0\" src=\"{1}images/attachicons/attachimg.gif\" /></span>", att.ID, forumpath); string str = string.Format("<dt><img src=\"{0}images/attachicons/{1}\" alt=\"\"></dt>", forumpath, "image.gif"); string str2 = string.Format("<em class=\"xg1\">(<script type=\"text/javascript\">ShowFormatBytesStr({0});</script>, 下载次数:{1})</em>", att.FileSize, att.Downloads); bool flag = GeneralConfigInfo.Current.Showimgattachmode == 0; string format = flag ? "{0}<img imageid=\"{2}\" src=\"{1}\" onmouseover=\"attachimginfo(this, 'attach_{2}', 1);attachimg(this, 'mouseover')\" onclick=\"zoom(this);\" onmouseout=\"attachimginfo(this, 'attach_{2}', 0, event)\" {7} /><div id=\"attach_{2}_menu\" style=\"display: none;\" class=\"t_attach\"><img border=\"0\" alt=\"\" class=\"absmiddle\" src=\"{3}images/attachicons/image.gif\" /><a target=\"_blank\" href=\"{1}\"><strong>{4}</strong></a>({5})<br/><div class=\"t_smallfont\">{6}</div></div>" : "{0}<img alt=\"点击加载图片\" imageid=\"{2}\" inpost=\"1\" src=\"/images/common/imgloading.png\" newsrc=\"{1}\" onload=\"{8}attachimg(this, 'load');\" onclick=\"loadImg(this);\" onmouseout=\"attachimginfo(this, 'attach_{2}', 0, event)\" {7} /><div id=\"attach_{2}_menu\" style=\"display: none;\" class=\"t_attach\"><img border=\"0\" alt=\"\" class=\"absmiddle\" src=\"{3}images/attachicons/image.gif\" /><a target=\"_blank\" onclick=\"return ShowDownloadTip({9});\" href=\"{1}\"><strong>{4}</strong></a>({5})<br/><div class=\"t_smallfont\">{6}</div></div>"; string text2 = flag ? Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width) : ""; //att.Attachimgpost = 1; if (postPramsInfo.Showattachmentpath == 1) { if (postPramsInfo.Isforspace == 1) { if (att.IsLocal) { return(string.Format("<img src=\"{0}\" {1} {2}/>", att.FileName, Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width), Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true))); } return(string.Format("<img src=\"{0}upload/{1}\" {2} {3}/>", new object[] { forumpath, att.FileName, Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width), Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true) })); } else { if (postPramsInfo.CurrentUserGroup.Is管理团队 || postPramsInfo.CurrentUserid == att.Uid || att.AttachPrice <= 0 || att.IsBought) { if (att.IsLocal) { return(string.Format(format, new object[] { text, att.FileName, att.ID, forumpath, att.Name.Trim(), fileSize, att.PostDateTime, text2, Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false), att.Uid })); } return(string.Format(format, new object[] { text, forumpath + "upload/" + att.FileName, att.ID, forumpath, att.Name.Trim(), fileSize, att.PostDateTime, text2, Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false), att.Uid })); } else { string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", att.Name + str2 + string.Format("<p>售价({0}):<strong>{1} </strong>[<a onclick=\"loadattachpaymentlog({2});\" href=\"javascript:void(0);\">记录</a>] [<a onclick=\"loadbuyattach({2});\" href=\"javascript:void(0);\">购买</a>]</p>", Scoresets.GetTopicAttachCreditsTransName(), att.AttachPrice, att.ID))); } } } if (postPramsInfo.Isforspace == 1) { return(string.Format("<img src=\"{0}attachment.aspx?attachmentid={1}\" {2} {3}/>", new object[] { forumpath, att.ID, Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width), Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true) })); } if (postPramsInfo.CurrentUserGroup.Is管理团队 || postPramsInfo.CurrentUserid == att.Uid || att.AttachPrice <= 0 || att.IsBought) { return(string.Format(format, new object[] { text, forumpath + "attachment.aspx?attachmentid=" + att.ID, att.ID, forumpath, att.Name.Trim(), fileSize, att.PostDateTime, text2, Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false), att.Uid })); } return(string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", att.Name + str2 + string.Format("<p>售价({0}):<strong>{1} </strong>[<a onclick=\"loadattachpaymentlog({2});\" href=\"javascript:void(0);\">记录</a>] [<a onclick=\"loadbuyattach({2});\" href=\"javascript:void(0);\">购买</a>]</p>", Scoresets.GetTopicAttachCreditsTransName(), att.AttachPrice, att.ID)))); }
private static void CreateTopicAttThumbnail(string attPhyCachePath, ThumbnailType type, string attPhyPath, int theMaxsize) { if (!attPhyPath.StartsWith("http://")) { attPhyPath = Utils.GetMapPath(attPhyPath); } if (!attPhyPath.StartsWith("http://") && !File.Exists(attPhyPath)) { return; } string mapPath = Utils.GetMapPath(BaseConfigs.GetForumPath + "cache/thumbnail/"); if (!Directory.Exists(mapPath)) { try { Utils.CreateDir(mapPath); } catch { throw new Exception("请检查程序目录下cache文件夹的用户权限!"); } } FileInfo[] files = new DirectoryInfo(mapPath).GetFiles(); if (files.Length > 1500) { Attachments.QuickSort(files, 0, files.Length - 1); for (int i = files.Length - 1; i >= 1400; i--) { try { files[i].Delete(); } catch { } } } try { switch (type) { case ThumbnailType.Square: if (attPhyPath.StartsWith("http://")) { Thumbnail.MakeRemoteSquareImage(attPhyPath, attPhyCachePath, theMaxsize); } else { Thumbnail.MakeSquareImage(attPhyPath, attPhyCachePath, theMaxsize); } break; case ThumbnailType.Thumbnail: if (attPhyPath.StartsWith("http://")) { Thumbnail.MakeRemoteThumbnailImage(attPhyPath, attPhyCachePath, theMaxsize, theMaxsize); } else { Thumbnail.MakeThumbnailImage(attPhyPath, attPhyCachePath, theMaxsize, theMaxsize); } break; default: if (attPhyPath.StartsWith("http://")) { Thumbnail.MakeRemoteSquareImage(attPhyPath, attPhyCachePath, theMaxsize); } else { Thumbnail.MakeSquareImage(attPhyPath, attPhyCachePath, theMaxsize); } break; } } catch { } }
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; }