Exemplo n.º 1
0
        protected override string OnAttachCreated(Discuz.Entity.AttachmentInfo[] attachs, int usergroupid, int userid, string username)
        {
            if (attachs == null)
            {
                return "";
            }
            string[] albumsid = DNTRequest.GetString("albums") == "" ? null : DNTRequest.GetString("albums").Split(',');
            if (albumsid == null)
                return "";
            int maxphotosize = UserGroups.GetUserGroupInfo(usergroupid).Maxspacephotosize;
            int currentphotisize = DbProvider.GetInstance().GetPhotoSizeByUserid(userid);

            if (attachs.Length + 2 == albumsid.Length)//验证提交上来的albums数据是否是合法可用数据,因为albums数据提交逗号数组头尾各有一个0,则合法数据位附件list长度加2==albums元素个数
            {
                for (int i = 0; i < attachs.Length; i++)
                {
                    if (attachs[i].Filename != "" && (attachs[i].Filetype == "image/pjpeg") || (attachs[i].Filetype == "image/gif") || (attachs[i].Filetype == "image/x-png"))
                    {
                        //由于提交上来的albums数据是头尾各含有一个值为0的元素的数组,则和第一个附件对应的相册ID其实是第二个值
                        string aid = albumsid[i + 1];
                        if (aid != "0")
                        {
                            if ((maxphotosize - currentphotisize - (int)attachs[i].Filesize) > 0)
                            {
                                string filename = Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/" + attachs[i].Filename.Replace('\\', '/'));
                                string extension = Path.GetExtension(filename);
                                Common.Thumbnail.MakeThumbnailImage(filename, filename.Replace(extension, "_thumbnail" + extension), 150, 150);
                                Common.Thumbnail.MakeSquareImage(filename, filename.Replace(extension, "_square" + extension), 100);
                                PhotoInfo photoinfo = new PhotoInfo();
                                photoinfo.Filename = "upload/" + attachs[i].Filename.Replace('\\', '/');
                                photoinfo.Attachment = attachs[i].Attachment;
                                photoinfo.Filesize = (int)attachs[i].Filesize;
                                photoinfo.Title = attachs[i].Attachment.Remove(attachs[i].Attachment.IndexOf("."));
                                photoinfo.Description = attachs[i].Description;
                                photoinfo.Albumid = int.Parse(aid);
                                photoinfo.Userid = userid;
                                photoinfo.Username = username;
                                photoinfo.Views = 0;
                                photoinfo.Commentstatus = 0;
                                photoinfo.Tagstatus = 0;
                                photoinfo.Comments = 0;
                                photoinfo.IsAttachment = 1;
                                DbProvider.GetInstance().AddSpacePhoto(photoinfo);
                                AlbumInfo albumInfo = DTOProvider.GetAlbumInfo(Convert.ToInt32(aid));
                                albumInfo.Imgcount = DbProvider.GetInstance().GetSpacePhotoCountByAlbumId(int.Parse(aid));
                                DbProvider.GetInstance().SaveSpaceAlbum(albumInfo);
                                currentphotisize += (int)attachs[i].Filesize;
                            }
                            else
                            {
                                return "相册空间不足,可能有图片未能加入相册";
                            }
                        }
                    }
                }
            }
            return "";
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获得单个帖子的信息, 包括发帖人的一般资料
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>帖子的信息</returns>
        public static ShowtopicPagePostInfo GetSinglePost(PostpramsInfo postPramsInfo, out Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo> attachmentList, bool ismoder)
        {
            //此代码已被移至showdebate.aspx.cs页面
            //UserInfo userInfo = Users.GetUserInfo(postPramsInfo.CurrentUserid);
            //postPramsInfo.Usercredits = userInfo == null ? 0 : userInfo.Credits;

            ShowtopicPagePostInfo postInfo = Discuz.Data.Posts.GetPostInfoWithAttachments(postPramsInfo, out attachmentList);
            if (postInfo != null)
            {
                int allowGetAttach = GetAllowGetAttachValue(postPramsInfo);
                Attachments.CheckPurchasedAttachments(attachmentList, postPramsInfo.CurrentUserid);
                int adcount = Advertisements.GetInPostAdCount("", postInfo.Fid);
                postInfo.Id = 1;
                LoadExtraPostInfo(postInfo, adcount);
                LoadPostMessage(postPramsInfo, attachmentList, ismoder, allowGetAttach, postPramsInfo.Hide, postInfo);
            }
            return postInfo;
        }
Exemplo n.º 3
0
        private static XmlNode GetTopicInDataTable(PostInfo[] posts, DataTable dt, Discuz.Common.Xml.XmlDocumentExtender doc, string tid)
        {
            foreach (DataRow dr in dt.Rows)
            {
                if (dr["tid"].ToString() != tid)
                    continue;
                PostInfo newpost = null;
                foreach (PostInfo post in posts)
                {
                    if (post.Tid.ToString() == dr["tid"].ToString())
                        newpost = post;
                }
                //创建Topic节点
                XmlElement topic = doc.CreateElement("Topic");
                doc.AppendChildElementByDataRow(ref topic, dt.Columns, dr, "tid,message");
                doc.AppendChildElementByNameValue(ref topic, "topicid", dr["tid"].ToString());
                string tempubbstr = UBB.ClearUBB(dr["message"].ToString());
                if (tempubbstr.Length > 200)
                    tempubbstr = tempubbstr.Substring(0, 200) + "...";

                if (newpost != null)
                    tempubbstr = newpost.Message;

                doc.AppendChildElementByNameValue(ref topic, "shortdescription", tempubbstr, true);
                doc.AppendChildElementByNameValue(ref topic, "fulldescription", UBB.ClearUBB(dr["message"].ToString()), true);
                ForumInfo forumInfo = Forums.GetForumInfo(TypeConverter.ObjectToInt(dr["fid"]));
                if (forumInfo != null)
                {
                    doc.AppendChildElementByNameValue(ref topic, "forumname", forumInfo.Name);
                    doc.AppendChildElementByNameValue(ref topic, "forumnamerewritename", forumInfo.Rewritename);
                }
                else
                {
                    doc.AppendChildElementByNameValue(ref topic, "forumname", "");
                    doc.AppendChildElementByNameValue(ref topic, "forumnamerewritename", "");
                }
                return topic;
            }
            return null;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得用户的默认TabID
        /// </summary>
        /// <param name="spaceConfig">用户的空间设置</param>
        /// <param name="tc">Tab集合</param>
        /// <returns>TabID</returns>
        public static int GetDefaultTabId(SpaceConfigInfo spaceConfig, Discuz.Common.Generic.List<TabInfo> tc)
		{
			if (tc == null)
				return 0;

			int defaulttabid = 0;
			if (tc.Count > 0)
				defaulttabid = tc[tc.Count - 1].TabID;

			foreach (TabInfo tab in tc)
			{
				if (tab.TabID == spaceConfig.DefaultTab)
				{
					defaulttabid = tab.TabID;
					break;
				}
			}
			return defaulttabid;
		}
Exemplo n.º 5
0
 public void Delete(Discuz.Entity.PostInfo post)
 {
     OnPostDeleted(post);
 }
Exemplo n.º 6
0
 public void UnBan(Discuz.Entity.PostInfo post)
 {
     OnPostUnBanned(post);
 }
Exemplo n.º 7
0
 public void Edit(Discuz.Entity.PostInfo post)
 {
     OnPostEdited(post);
 }
Exemplo n.º 8
0
 public void CreatePost(Discuz.Entity.PostInfo post)
 {
     OnPostCreated(post);
 }
Exemplo n.º 9
0
        private string GetMultipleSelectedValue(Discuz.Control.ListBox lb)
        {
            string result = string.Empty;
            foreach (ListItem li in lb.Items)
            {
                if (li.Selected && li.Value != "-1")
                    result += li.Value + ",";
            }

            if (result.Length > 0)
                result = result.Substring(0, result.Length - 1);

            return result;
        }
Exemplo n.º 10
0
 /// <summary>
 /// 加载主题列表附加信息
 /// </summary>
 /// <param name="fid">板块ID</param>
 /// <param name="autocloseTime">自动关闭时间</param>
 /// <param name="topicTypePrefix">主题分类前缀</param>
 /// <param name="list">主题列表</param>
 private static void LoadTopicListExtraInfo(int autoCloseTime, int topicTypePrefix, Discuz.Common.Generic.List<TopicInfo> list)
 {
     LoadTopicListExtraInfo(autoCloseTime, topicTypePrefix, 600, 0, list);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 加载置顶主题列表附加信息
        /// </summary>
        /// <param name="topicTypePrefix">主题分类前缀</param>
        /// <param name="newMinutes"></param>
        /// <param name="hotReplyNumber"></param>
        /// <param name="list">主题列表</param>
        private static void LoadTopTopicListExtraInfo(int topicTypePrefix, int newMinutes, int hotReplyNumber, Discuz.Common.Generic.List<TopicInfo> list)
        {
            SortedList<int, string> topicTypeList = Caches.GetTopicTypeArray();
            StringBuilder closedIds = new StringBuilder();
            foreach (TopicInfo topic in list)
            {
                ForumInfo forumInfo = Forums.GetForumInfo(topic.Fid);

                if (topic.Closed == 0 && forumInfo.Autoclose > 0 && Utils.StrDateDiffHours(topic.Postdatetime, forumInfo.Autoclose * 24) > 0)
                {
                    closedIds.Append(topic.Tid.ToString());
                    closedIds.Append(",");
                }
                LoadTopicFolder(forumInfo.Autoclose, newMinutes, hotReplyNumber, topic);
                LoadTopicHighlightTitle(topic);
                LoadTopicType(topicTypePrefix, topicTypeList, topic);
            }

            if (closedIds.Length > 0)
                TopicAdmins.SetClose(closedIds.ToString().TrimEnd(','), 1);
        }
Exemplo n.º 12
0
		/// <summary>
		/// 合并所有模块的html
		/// </summary>
		/// <param name="mc">模块集合</param>
		/// <param name="template">版式内容</param>
		/// <returns></returns>
        private string ParseModules(Discuz.Common.Generic.List<ModuleInfo> mc, string template)
  		{
			string hiddenDiv = "<div style='width: 100%'>&nbsp;</div>";
			if (mc == null || mc.Count < 1)
			{
				template = template.Replace("{pane1}", hiddenDiv);
				template = template.Replace("{pane2}", hiddenDiv);
				template = template.Replace("{pane3}", hiddenDiv);
				template = template.Replace("{pane4}", hiddenDiv);
                return template + "<script type='text/javascript'>var currentTabModule = new Array();</script>";
			}
	
			Hashtable htPane = new Hashtable();
			string paneName = "pane1";//mc[0].PaneName;
	
			//先塞到ht
			string currentKey = Guid.NewGuid().ToString();
			string firstKey = currentKey;
            string currentTabModule = "<script type='text/javascript'>var currentTabModule = new Array({0});</script>";
            string[] currentTabModuleArray = new string[mc.Count];
			template = template.Replace("{" + paneName + "}", currentKey);
			htPane.Add(currentKey, string.Empty);

            for (int i = 0; i < mc.Count; i++)
            {
                ModuleBase desktopModule = Spaces.SetModuleBase(mc[i]);
                desktopModule.UserID = this.userid;
                desktopModule.SpaceConfig = spaceConfig;
                currentTabModuleArray[i] = string.Format("'{0}'", mc[i].ModuleUrl);

                if (template.IndexOf(mc[i].PaneName) == -1 && paneName != mc[i].PaneName)
                {
                    htPane[firstKey] = htPane[firstKey] + desktopModule.GetModuleHtml();
                }
                else
                {
                    if (paneName != mc[i].PaneName)
                    {
                        currentKey = Guid.NewGuid().ToString();
                        template = template.Replace("{" + mc[i].PaneName + "}", currentKey);
                        htPane.Add(currentKey, string.Empty);

                        paneName = mc[i].PaneName;
                    }
                    htPane[currentKey] = htPane[currentKey] + desktopModule.GetModuleHtml();
                }
            }

            currentTabModule = string.Format(currentTabModule, string.Join(",", currentTabModuleArray));
			template = template.Replace("{pane1}", hiddenDiv);
			template = template.Replace("{pane2}", hiddenDiv);
			template = template.Replace("{pane3}", hiddenDiv);
			template = template.Replace("{pane4}", hiddenDiv);
	
			foreach (DictionaryEntry de in htPane)
			{
				template = template.Replace(de.Key.ToString(), de.Value.ToString() + hiddenDiv);
			}

            template += currentTabModule;
			return template;
		}
Exemplo n.º 13
0
        public virtual void AddObject(string xpath, Discuz.Common.Generic.SortedList<int, object> __sortedlist)
#endif
        {
            lock (lockHelper)
            {
                if (__sortedlist.Count > 0)
                {
                    AddObject(xpath + "flag", CacheFlag.CacheHaveData);
                }
                else
                {
                    AddObject(xpath + "flag", CacheFlag.CacheNoData);
                }
                AddObject(xpath, (object)__sortedlist);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// 获得单个帖子的信息, 包括发帖人的一般资料
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>帖子的信息</returns>
        public static ShowtopicPagePostInfo GetSinglePost(PostpramsInfo postpramsinfo, out Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo> attcoll, bool ismoder)
        {
            ShowtopicPagePostInfo info = null;
            IDataReader attachments = null;
            attcoll = new Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo>();


            ///得到帖子对应主题的所有附件
            IDataReader reader = DatabaseProvider.GetInstance().GetSinglePost(out attachments, postpramsinfo, GetPostTableID(postpramsinfo.Tid));
            int allowGetAttach = 0;


            if (reader != null)
            {

                if (postpramsinfo.Getattachperm.Equals("") || postpramsinfo.Getattachperm == null)
                {
                    allowGetAttach = postpramsinfo.CurrentUserGroup.Allowgetattach;
                }
                else
                {
                    if (Forums.AllowGetAttach(postpramsinfo.Getattachperm, postpramsinfo.Usergroupid))
                    {
                        allowGetAttach = 1;
                    }

                }
                if (attachments != null)
                {
                    while (attachments.Read())
                    {
                        ShowtopicPageAttachmentInfo attinfo = new ShowtopicPageAttachmentInfo();
                        //info.Uid = Int32.Parse(reader["uid"].ToString());
                        attinfo.Aid = Int32.Parse(attachments["aid"].ToString());
                        attinfo.Tid = Int32.Parse(attachments["tid"].ToString());
                        attinfo.Pid = Int32.Parse(attachments["pid"].ToString());
                        attinfo.Postdatetime = attachments["postdatetime"].ToString();
                        attinfo.Readperm = Int32.Parse(attachments["readperm"].ToString());
                        attinfo.Filename = attachments["filename"].ToString();
                        attinfo.Description = attachments["description"].ToString();
                        attinfo.Filetype = attachments["filetype"].ToString();
                        attinfo.Filesize = Int32.Parse(attachments["filesize"].ToString());
                        attinfo.Attachment = attachments["attachment"].ToString();
                        attinfo.Downloads = Int32.Parse(attachments["downloads"].ToString());
                        attcoll.Add(attinfo);
                    }
                }
                else
                {
                    while (reader.Read())
                    {
                        ShowtopicPageAttachmentInfo attinfo = new ShowtopicPageAttachmentInfo();
                        //info.Uid = Int32.Parse(reader["uid"].ToString());
                        attinfo.Aid = Int32.Parse(reader["aid"].ToString());
                        attinfo.Tid = Int32.Parse(reader["tid"].ToString());
                        attinfo.Pid = Int32.Parse(reader["pid"].ToString());
                        attinfo.Postdatetime = reader["postdatetime"].ToString();
                        attinfo.Readperm = Int32.Parse(reader["readperm"].ToString());
                        attinfo.Filename = reader["filename"].ToString();
                        attinfo.Description = reader["description"].ToString();
                        attinfo.Filetype = reader["filetype"].ToString();
                        attinfo.Filesize = Int32.Parse(reader["filesize"].ToString());
                        attinfo.Attachment = reader["attachment"].ToString();
                        attinfo.Downloads = Int32.Parse(reader["downloads"].ToString());
                        attcoll.Add(attinfo);
                    }
                }
            }

            bool next = false;
            if (attachments != null)
            {
                next = true & reader.Read();

            }
            else
            {
                next = reader.NextResult() && reader.Read();
            }

            //当帖子中的posterid字段为0时, 表示该数据出现异常
            if (reader["posterid"].ToString() == "0")
            {
                reader.Close();
                return null;
            }

            if (next)
            {

                //取帖间广告
                Random random = new Random(unchecked((int)DateTime.Now.Ticks));
                int fid = Int32.Parse(reader["fid"].ToString());
                int adcount = Advertisements.GetInPostAdCount("", fid);

                //用户组
                UserGroupInfo tmpGroupInfo;

                info = new ShowtopicPagePostInfo();

                info.Pid = Int32.Parse(reader["pid"].ToString());
                info.Fid = fid;
                info.Title = reader["title"].ToString().Trim();
                info.Layer = Int32.Parse(reader["layer"].ToString());
                info.Message = reader["message"].ToString().Trim();
                info.Lastedit = reader["lastedit"].ToString().Trim();
                info.Postdatetime = reader["postdatetime"].ToString().Trim();
                info.Attachment = Int32.Parse(reader["attachment"].ToString());
                info.Poster = reader["poster"].ToString().Trim();
                info.Posterid = Int32.Parse(reader["posterid"].ToString());
                info.Invisible = Int32.Parse(reader["invisible"].ToString());
                info.Usesig = Int32.Parse(reader["usesig"].ToString());
                info.Htmlon = Int32.Parse(reader["htmlon"].ToString());
                info.Smileyoff = Int32.Parse(reader["smileyoff"].ToString());
                info.Parseurloff = Int32.Parse(reader["parseurloff"].ToString());
                info.Bbcodeoff = Int32.Parse(reader["bbcodeoff"].ToString());
                info.Rate = Int32.Parse(reader["rate"].ToString());
                info.Ratetimes = Int32.Parse(reader["ratetimes"].ToString());
                if (info.Posterid > 0)
                {
                    info.Nickname = reader["nickname"].ToString().Trim();
                    info.Username = reader["username"].ToString().Trim();
                    info.Groupid = Utils.StrToInt(reader["groupid"], 0);
                    info.Spaceid = Utils.StrToInt(reader["spaceid"], 0);
                    info.Gender = Utils.StrToInt(reader["gender"], 2);
                    info.Bday = reader["bday"].ToString().Trim();
                    info.Showemail = Utils.StrToInt(reader["showemail"], 0);
                    info.Digestposts = Utils.StrToInt(reader["digestposts"], 0);
                    info.Credits = Utils.StrToInt(reader["credits"], 0);
                    info.Extcredits1 = reader["extcredits1"] == DBNull.Value ? 0 : float.Parse(reader["extcredits1"].ToString());
                    info.Extcredits2 = reader["extcredits2"] == DBNull.Value ? 0 : float.Parse(reader["extcredits2"].ToString());
                    info.Extcredits3 = reader["extcredits3"] == DBNull.Value ? 0 : float.Parse(reader["extcredits3"].ToString());
                    info.Extcredits4 = reader["extcredits4"] == DBNull.Value ? 0 : float.Parse(reader["extcredits4"].ToString());
                    info.Extcredits5 = reader["extcredits5"] == DBNull.Value ? 0 : float.Parse(reader["extcredits5"].ToString());
                    info.Extcredits6 = reader["extcredits6"] == DBNull.Value ? 0 : float.Parse(reader["extcredits6"].ToString());
                    info.Extcredits7 = reader["extcredits7"] == DBNull.Value ? 0 : float.Parse(reader["extcredits7"].ToString());
                    info.Extcredits8 = reader["extcredits8"] == DBNull.Value ? 0 : float.Parse(reader["extcredits8"].ToString());
                    info.Posts = Utils.StrToInt(reader["posts"], 0);
                    info.Joindate = reader["joindate"].ToString().Trim();
                    info.Lastactivity = reader["lastactivity"].ToString().Trim();
                    info.Userinvisible = Int32.Parse(reader["invisible"].ToString());
                    info.Avatar = reader["avatar"].ToString();
                    info.Avatarwidth = Utils.StrToInt(reader["avatarwidth"], 0);
                    info.Avatarheight = Utils.StrToInt(reader["avatarheight"], 0);
                    info.Medals = reader["medals"].ToString();
                    info.Signature = reader["signature"].ToString();
                    info.Location = reader["location"].ToString();
                    info.Customstatus = reader["customstatus"].ToString();
                    info.Website = reader["website"].ToString();
                    info.Icq = reader["icq"].ToString();
                    info.Qq = reader["qq"].ToString();
                    info.Msn = reader["msn"].ToString();
                    info.Yahoo = reader["yahoo"].ToString();
                    info.Skype = reader["skype"].ToString();
                    //部分属性需要根据不同情况来赋值

                    //根据用户自己的设置决定是否显示邮箱地址
                    if (info.Showemail == 0)
                    {
                        info.Email = "";
                    }
                    else
                    {
                        info.Email = reader["email"].ToString().Trim();
                    }


                    // 最后活动时间50分钟内的为在线, 否则不在线
                    if (Utils.StrDateDiffMinutes(info.Lastactivity, 50) < 0)
                    {
                        info.Onlinestate = 1;
                    }
                    else
                    {
                        info.Onlinestate = 0;
                    }


                    //作者ID为-1即表明作者为游客, 为了区分会直接公开显示游客发帖时的IP, 这里将IP最后一位修改为*
                    info.Ip = reader["ip"].ToString().Trim();

                    // 勋章
                    if (info.Medals == "")
                    {
                        info.Medals = "";
                    }
                    else
                    {
                        info.Medals = Caches.GetMedalsList(info.Medals);
                    }

                    tmpGroupInfo = UserGroups.GetUserGroupInfo(info.Groupid);
                    info.Stars = tmpGroupInfo.Stars;
                    if (tmpGroupInfo.Color.Equals(""))
                    {
                        info.Status = tmpGroupInfo.Grouptitle;
                    }
                    else
                    {
                        info.Status = string.Format("<span style=\"color:{0}>{1}</span>", tmpGroupInfo.Color, tmpGroupInfo.Grouptitle);
                    }
                }
                else
                {
                    info.Nickname = "游客";
                    info.Username = "******";
                    info.Groupid = 7;
                    info.Showemail = 0;
                    info.Digestposts = 0;
                    info.Credits = 0;
                    info.Extcredits1 = 0;
                    info.Extcredits2 = 0;
                    info.Extcredits3 = 0;
                    info.Extcredits4 = 0;
                    info.Extcredits5 = 0;
                    info.Extcredits6 = 0;
                    info.Extcredits7 = 0;
                    info.Extcredits8 = 0;
                    info.Posts = 0;
                    info.Joindate = "2006-9-1 1:1:1";
                    info.Lastactivity = "2006-9-1 1:1:1"; ;
                    info.Userinvisible = 0;
                    info.Avatar = "";
                    info.Avatarwidth = 0;
                    info.Avatarheight = 0;
                    info.Medals = "";
                    info.Signature = "";
                    info.Location = "";
                    info.Customstatus = "";
                    info.Website = "";
                    info.Icq = "";
                    info.Qq = "";
                    info.Msn = "";
                    info.Yahoo = "";
                    info.Skype = "";
                    //部分属性需要根据不同情况来赋值
                    info.Email = "";
                    info.Onlinestate = 1;
                    info.Medals = "";

                    info.Ip = reader["ip"].ToString().Trim();
                    if (info.Ip.IndexOf('.') > -1)
                    {
                        info.Ip = info.Ip.Substring(0, info.Ip.LastIndexOf(".") + 1) + "*";
                    }

                    tmpGroupInfo = UserGroups.GetUserGroupInfo(7);
                    info.Stars = tmpGroupInfo.Stars;
                    info.Status = "游客";
                }
                //扩展属性
                info.Id = 1;
                info.Adindex = random.Next(0, adcount);

                if (!Utils.InArray(info.Groupid.ToString(), "4,5,6"))
                {
                    //处理帖子内容
                    postpramsinfo.Smileyoff = info.Smileyoff;
                    postpramsinfo.Bbcodeoff = info.Bbcodeoff;
                    postpramsinfo.Parseurloff = info.Parseurloff;
                    postpramsinfo.Allowhtml = info.Htmlon;
                    postpramsinfo.Sdetail = info.Message;
                    postpramsinfo.Pid = info.Pid;
                    //校正hide处理
                    if (tmpGroupInfo.Allowhidecode == 0)
                    {
                        postpramsinfo.Hide = 0;
                    }

                    //先简单判断是否是动网兼容模式
                    if (!postpramsinfo.Ubbmode)
                    {
                        info.Message = UBB.UBBToHTML(postpramsinfo);
                    }
                    else
                    {
                        info.Message = Utils.HtmlEncode(info.Message);
                    }

                    if (postpramsinfo.Jammer == 1)
                    {
                        info.Message = ForumUtils.AddJammer(info.Message);
                    }

                    string message = info.Message;
                    if (info.Attachment > 0 || regexAttach.IsMatch(message) || regexAttachImg.IsMatch(message))
                    {


                        //获取在[hide]标签中的附件id
                        string[] attHidArray = GetHiddenAttachIdList(postpramsinfo.Sdetail, postpramsinfo.Hide);

                        List<ShowtopicPageAttachmentInfo> delattlist = new List<ShowtopicPageAttachmentInfo>();

                        foreach (ShowtopicPageAttachmentInfo attach in attcoll)
                        {
                            message = GetMessageWithAttachInfo(postpramsinfo, allowGetAttach, attHidArray, info, attach, message);
                            if (Utils.InArray(attach.Aid.ToString(), attHidArray) || attach.Pid == 0)
                            {
                                delattlist.Add(attach);
                            }
                        }

                        foreach (ShowtopicPageAttachmentInfo attach in delattlist)
                        {
                            attcoll.Remove(attach);
                        }

                        info.Message = message;

                    }
                }
                else//禁言的发帖人
                {
                    if (ismoder)
                    {
                        info.Message = "<div class='hintinfo'>该用户帖子内容已被屏蔽, 您拥有管理权限, 以下是帖子内容</div>" + info.Message;
                    }
                    else
                    {
                        info.Message = "该用户帖子内容已被屏蔽";
                        List<ShowtopicPageAttachmentInfo> delattlist = new List<ShowtopicPageAttachmentInfo>();

                        foreach (ShowtopicPageAttachmentInfo attach in attcoll)
                        {
                            if (attach.Pid == info.Pid)
                            {
                                delattlist.Add(attach);
                            }
                        }

                        foreach (ShowtopicPageAttachmentInfo attach in delattlist)
                        {
                            attcoll.Remove(attach);
                        }

                    }
                }

            }

            reader.Close();
            if (attachments != null)
            {
                attachments.Close();
            }

            return info;
        }
Exemplo n.º 15
0
        /// <summary>
        /// 获取指定条件的帖子DataSet
        /// </summary>
        /// <param name="_postpramsinfo">参数列表</param>
        /// <returns>指定条件的帖子DataSet</returns>
        public static Discuz.Common.Generic.List<ShowtopicPagePostInfo> GetPostList(PostpramsInfo postpramsinfo, out Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo> attcoll, bool ismoder)
        {

            Discuz.Common.Generic.List<ShowtopicPagePostInfo> postcoll = new Discuz.Common.Generic.List<ShowtopicPagePostInfo>();
            attcoll = new Discuz.Common.Generic.List<ShowtopicPageAttachmentInfo>();

            IDataReader reader;
            StringBuilder pidlist = new StringBuilder();
            if (!postpramsinfo.Condition.Equals(""))
            {
                reader = DatabaseProvider.GetInstance().GetPostListByCondition(postpramsinfo, GetPostTableName(postpramsinfo.Tid));
            }
            else
            {
                reader = DatabaseProvider.GetInstance().GetPostList(postpramsinfo, GetPostTableName(postpramsinfo.Tid));
            }



            return ParsePostList(postpramsinfo, attcoll, ismoder, postcoll, reader, pidlist);
        }