public static Discuz.Common.Generic.List <PhotoInfo> GetSpacePhotosInfo(DataTable dt) { if (dt == null || dt.Rows.Count == 0) { return(new Discuz.Common.Generic.List <PhotoInfo>()); } Discuz.Common.Generic.List <PhotoInfo> photosinfoarray = new Discuz.Common.Generic.List <PhotoInfo>(); for (int i = 0; i < dt.Rows.Count; i++) { PhotoInfo photo = new PhotoInfo(); photo.Photoid = TypeConverter.ObjectToInt(dt.Rows[i]["photoid"]); photo.Filename = dt.Rows[i]["filename"].ToString(); photo.Attachment = dt.Rows[i]["attachment"].ToString(); photo.Filesize = TypeConverter.ObjectToInt(dt.Rows[i]["filesize"]); photo.Description = dt.Rows[i]["description"].ToString(); photo.Postdate = dt.Rows[i]["postdate"].ToString(); photo.Albumid = TypeConverter.ObjectToInt(dt.Rows[i]["albumid"]); photo.Userid = TypeConverter.ObjectToInt(dt.Rows[i]["userid"]); photo.Title = dt.Rows[i]["title"].ToString(); photo.Views = TypeConverter.ObjectToInt(dt.Rows[i]["views"]); photo.Commentstatus = (PhotoStatus)TypeConverter.ObjectToInt(dt.Rows[i]["commentstatus"]); photo.Tagstatus = (PhotoStatus)TypeConverter.ObjectToInt(dt.Rows[i]["tagstatus"]); photo.Comments = TypeConverter.ObjectToInt(dt.Rows[i]["comments"]); photosinfoarray.Add(photo); } dt.Dispose(); return(photosinfoarray); }
/// <summary> /// 获取主题签定集合项 /// </summary> /// <returns>主题签定集合项</returns> public static Discuz.Common.Generic.List <TopicIdentify> GetTopicIdentifyCollection() { DNTCache cache = DNTCache.GetCacheService(); Discuz.Common.Generic.List <TopicIdentify> topicidentifyList = cache.RetrieveObject("/Forum/TopicIdentifys") as Discuz.Common.Generic.List <TopicIdentify>; if (topicidentifyList == null) { topicidentifyList = new Discuz.Common.Generic.List <TopicIdentify>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = TypeConverter.ObjectToInt(reader["identifyid"]); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"], reader["filename"]); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/Forum/TopicIdentifys", topicidentifyList); cache.AddObject("/Forum/TopicIndentifysJsArray", jsArray.ToString()); } return(topicidentifyList); }
/// <summary> /// 获取需要审核的主题 /// </summary> /// <param name="fidList">版块ID列表</param> /// <param name="tpp">每页主题数</param> /// <param name="pageId">页数</param> /// <param name="filter">displayorder过滤器</param> /// <returns></returns> public static Discuz.Common.Generic.List <TopicInfo> GetUnauditNewTopic(string fidList, int tpp, int pageId, int filter) { Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetUnauditNewTopic(fidList, tpp, pageId, filter); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return(list); }
public static Discuz.Common.Generic.List <AlbumInfo> GetSpaceAlbumList(int userid, int albumcategoryid, int pageSize, int currentPage) { Discuz.Common.Generic.List <AlbumInfo> aic = new Discuz.Common.Generic.List <AlbumInfo>(); IDataReader reader = Data.DbProvider.GetInstance().SpaceAlbumsList(userid, albumcategoryid, pageSize, currentPage); while (reader.Read()) { aic.Add(GetAlbumEntity(reader)); } reader.Close(); return(aic); }
public static Discuz.Common.Generic.List <PhotoInfo> GetPhotosWithSameTag(int tagid, int pageid, int pagesize) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotosWithSameTag(tagid, pageid, pagesize); Discuz.Common.Generic.List <PhotoInfo> photolist = new Discuz.Common.Generic.List <PhotoInfo>(); while (reader.Read()) { photolist.Add(GetPhotoEntity(reader)); } reader.Close(); return(photolist); }
private static Discuz.Common.Generic.List<ThemeInfo> GetThemeInfoArray(IDataReader reader) { if (reader == null) return null; Discuz.Common.Generic.List<ThemeInfo> tic = new Discuz.Common.Generic.List<ThemeInfo>(); while (reader.Read()) { tic.Add(GetThemeEntity(reader)); } reader.Close(); return tic; }
public static List <TopicInfo> GetTopicListByViewsOrReplies(int fid, int pageSize, int pageIndex, int startNumber, string condition, string orderFields, int sortType) { Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsByViewsOrReplies(fid, pageSize, pageIndex, startNumber, condition, orderFields, sortType); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return(list); }
/// <summary> /// 按照用户Id获取主题列表 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static Discuz.Common.Generic.List <TopicInfo> GetTopicsByUserId(int userId, int pageIndex, int pageSize) { Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsByUserId(userId, pageIndex, pageSize); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return(list); }
private static Discuz.Common.Generic.List <ThemeInfo> GetThemeInfoArray(IDataReader reader) { if (reader == null) { return(null); } Discuz.Common.Generic.List <ThemeInfo> tic = new Discuz.Common.Generic.List <ThemeInfo>(); while (reader.Read()) { tic.Add(GetThemeEntity(reader)); } reader.Close(); return(tic); }
private static Discuz.Common.Generic.List <TabInfo> GetTabInfoArray(IDataReader reader) { if (reader == null) { return(null); } Discuz.Common.Generic.List <TabInfo> tabc = new Discuz.Common.Generic.List <TabInfo>(); while (reader.Read()) { tabc.Add(GetTabEntity(reader)); } reader.Close(); return(tabc.Count == 0 ? null : tabc); }
private static Discuz.Common.Generic.List <ModuleInfo> GetModuleInfoArray(IDataReader reader) { if (reader == null) { return(null); } Discuz.Common.Generic.List <ModuleInfo> mdic = new Discuz.Common.Generic.List <ModuleInfo>(); while (reader.Read()) { mdic.Add(GetModuleEntity(reader)); } reader.Close(); return(mdic.Count == 0 ? null : mdic); }
public static Discuz.Common.Generic.List <AlbumInfo> GetAlbumRankList(int albumcount) { Discuz.Common.Generic.List <AlbumInfo> aic = DNTCache.GetCacheService().RetrieveObject(string.Format("/Photo/AlbumRank{0}", albumcount)) as Discuz.Common.Generic.List <AlbumInfo>; if (aic == null) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotoRankList(3, albumcount); aic = new Discuz.Common.Generic.List <AlbumInfo>(); while (reader.Read()) { aic.Add(GetAlbumEntity(reader)); } reader.Close(); DNTCache.GetCacheService().AddObject(string.Format("/Photo/AlbumRank{0}", albumcount), (ICollection)aic); } return(aic); }
/// <summary> /// 返回在线用户列表 /// </summary> /// <param name="forumid">版块id</param> /// <returns></returns> public static Discuz.Common.Generic.List <OnlineUserInfo> GetForumOnlineUserCollection(int forumid) { Discuz.Common.Generic.List <OnlineUserInfo> coll = new Discuz.Common.Generic.List <OnlineUserInfo>(); if (appDBCache) { coll = IOnlineUserService.GetForumOnlineUserCollection(forumid); } else { IDataReader reader = DatabaseProvider.GetInstance().GetForumOnlineUserList(forumid); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); coll.Add(info); } reader.Close(); } //返回当前版块的在线用户表 return(coll); }
public static Discuz.Common.Generic.List <PhotoCommentInfo> GetPhotoCommentCollection(int photoid) { Discuz.Common.Generic.List <PhotoCommentInfo> comments = new Discuz.Common.Generic.List <PhotoCommentInfo>(); IDataReader reader = Data.DbProvider.GetInstance().GetPhotoCommentCollection(photoid); while (reader.Read()) { PhotoCommentInfo comment = new PhotoCommentInfo(); comment.Commentid = TypeConverter.ObjectToInt(reader["commentid"]); comment.Content = Utils.RemoveHtml(reader["content"].ToString()); comment.Ip = reader["ip"].ToString(); comment.Photoid = TypeConverter.ObjectToInt(reader["photoid"]); comment.Postdatetime = Convert.ToDateTime(reader["postdatetime"]); comment.Userid = TypeConverter.ObjectToInt(reader["userid"]); comment.Username = reader["username"].ToString(); comments.Add(comment); } reader.Close(); return(comments); }
/// <summary> /// 获得一般主题信息列表 /// </summary> /// <param name="fid">版块ID</param> /// <param name="pageSize">每页显示主题数</param> /// <param name="pageIndex">当前页数</param> /// <param name="startNumber">置顶帖数量</param> /// <param name="condition">条件</param> /// <returns>主题信息列表</returns> public static Discuz.Common.Generic.List <TopicInfo> GetTopicList(int fid, int pageSize, int pageIndex, int startNumber, string condition) { Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); if (string.IsNullOrEmpty(condition) && appDBCache) { list = ITopicService.GetTopicList(fid, pageSize, pageIndex, startNumber); if (list.Count > 0) { return(list); } } IDataReader reader = DatabaseProvider.GetInstance().GetTopics(fid, pageSize, pageIndex, startNumber, condition); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return(list); }
/// <summary> /// 对符合新帖,精华帖的页面显示进行查询的函数 /// </summary> /// <param name="pageSize">每个分页的主题数</param> /// <param name="pageIndex">分页页数</param> /// <param name="startNumber">置顶帖数量</param> /// <param name="condition">条件</param> /// <param name="orderFields">排序字段,以","间隔</param> /// <param name="sortType">升/降序,0为升序,非0为降序</param> /// <returns>主题列表</returns> public static Discuz.Common.Generic.List <TopicInfo> GetTopicListByCondition(int pageSize, int pageIndex, int startNumber, string condition, string orderFields, int sortType) { Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); IDataReader reader = null; if (orderFields == "") { reader = DatabaseProvider.GetInstance().GetTopicsByType(pageSize, pageIndex, startNumber, condition, sortType); } else { reader = DatabaseProvider.GetInstance().GetTopicsByTypeDate(pageSize, pageIndex, startNumber, condition, orderFields, sortType); } while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return(list); }
/// <summary> /// 获得图片排行图集合 /// </summary> /// <param name="type">排行方式,0浏览量,1评论数,2上传时间</param> /// <returns></returns> public static Discuz.Common.Generic.List <PhotoInfo> GetPhotoRankList(int type, int photocount) { Discuz.Common.Generic.List <PhotoInfo> pic = DNTCache.GetCacheService().RetrieveObject(string.Format("/Photo/PhotoRank{0}-{1}", type, photocount)) as Discuz.Common.Generic.List <PhotoInfo>; if (pic == null) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotoRankList(type, photocount); pic = new Discuz.Common.Generic.List <PhotoInfo>(); if (reader != null) { while (reader.Read()) { PhotoInfo pi = GetPhotoEntity(reader); pi.Filename = Globals.GetSquareImage(pi.Filename); pic.Add(pi); } reader.Close(); } DNTCache.GetCacheService().AddObject(string.Format("/Photo/PhotoRank{0}-{1}", type, photocount), (ICollection)pic); } return(pic); }
/// <summary> /// 返回在线用户列表 /// </summary> public static Discuz.Common.Generic.List <OnlineUserInfo> GetOnlineUserCollection() { Discuz.Common.Generic.List <OnlineUserInfo> coll = new Discuz.Common.Generic.List <OnlineUserInfo>(); if (appDBCache) { coll = IOnlineUserService.GetOnlineUserCollection(); } else { IDataReader reader = DatabaseProvider.GetInstance().GetOnlineUserList(); while (reader.Read()) { OnlineUserInfo onlineUserInfo = LoadSingleOnlineUser(reader); if (onlineUserInfo.Userid > 0 || (onlineUserInfo.Userid == -1 && GeneralConfigs.GetConfig().Whosonlinecontract == 0)) { onlineUserInfo.Actionname = UserAction.GetActionDescriptionByID((int)(onlineUserInfo.Action)); coll.Add(onlineUserInfo); } } reader.Close(); } //返回当前版块的在线用户表 return(coll); }
/// <summary> /// 获取置顶主题列表 /// </summary> /// <param name="fid">版块id</param> /// <param name="pageIndex">页号</param> /// <param name="pageSize">每页条数</param> /// <param name="tids">置顶主题Id列表</param> /// <returns></returns> public static Discuz.Common.Generic.List <TopicInfo> GetTopTopicList(int fid, int pageSize, int pageIndex, string tidList) { if (!Utils.IsNumericList(tidList)) { return(new List <TopicInfo>()); } Discuz.Common.Generic.List <TopicInfo> list = new Discuz.Common.Generic.List <TopicInfo>(); if (appDBCache) { list = ITopicService.GetTopTopicList(fid, pageSize, pageIndex, tidList); } if (list.Count == 0) { IDataReader reader = DatabaseProvider.GetInstance().GetTopTopics(fid, pageSize, pageIndex, tidList); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); } return(list); }
/// <summary> /// 对符合新帖,精华帖的页面显示进行查询的函数 /// </summary> /// <param name="pageSize">每个分页的主题数</param> /// <param name="pageIndex">分页页数</param> /// <param name="startNumber">置顶帖数量</param> /// <param name="condition">条件</param> /// <param name="orderFields">排序字段,以","间隔</param> /// <param name="sortType">升/降序,0为升序,非0为降序</param> /// <returns>主题列表</returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopicListByCondition(int pageSize, int pageIndex, int startNumber, string condition, string orderFields, int sortType) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = null; if (orderFields == "") reader = DatabaseProvider.GetInstance().GetTopicsByType(pageSize, pageIndex, startNumber, condition, sortType); else reader = DatabaseProvider.GetInstance().GetTopicsByTypeDate(pageSize, pageIndex, startNumber, condition, orderFields, sortType); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
public static List<TopicInfo> GetTopicListByViewsOrReplies(int fid, int pageSize, int pageIndex, int startNumber, string condition, string orderFields, int sortType) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsByViewsOrReplies(fid, pageSize, pageIndex, startNumber, condition, orderFields, sortType); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
/// <summary> /// 获得一般主题信息列表 /// </summary> /// <param name="fid">版块ID</param> /// <param name="pageSize">每页显示主题数</param> /// <param name="pageIndex">当前页数</param> /// <param name="startNumber">置顶帖数量</param> /// <param name="condition">条件</param> /// <returns>主题信息列表</returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopicList(int fid, int pageSize, int pageIndex, int startNumber, string condition) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); if (string.IsNullOrEmpty(condition) && appDBCache) { list = ITopicService.GetTopicList(fid, pageSize, pageIndex, startNumber); if (list.Count > 0) return list; } IDataReader reader = DatabaseProvider.GetInstance().GetTopics(fid, pageSize, pageIndex, startNumber, condition); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
/// <summary> /// 获得图片排行图集合 /// </summary> /// <param name="type">排行方式,0浏览量,1评论数,2上传时间</param> /// <returns></returns> public static Discuz.Common.Generic.List<PhotoInfo> GetPhotoRankList(int type, int photocount) { Discuz.Common.Generic.List<PhotoInfo> pic = DNTCache.GetCacheService().RetrieveObject(string.Format("/Photo/PhotoRank{0}-{1}", type, photocount)) as Discuz.Common.Generic.List<PhotoInfo>; if (pic == null) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotoRankList(type, photocount); pic = new Discuz.Common.Generic.List<PhotoInfo>(); if (reader != null) { while (reader.Read()) { PhotoInfo pi = GetPhotoEntity(reader); pi.Filename = Globals.GetSquareImage(pi.Filename); pic.Add(pi); } reader.Close(); } DNTCache.GetCacheService().AddObject(string.Format("/Photo/PhotoRank{0}-{1}", type, photocount), (ICollection)pic); } return pic; }
/// <summary> /// 返回在线用户列表 /// </summary> /// <param name="forumid">版块id</param> /// <returns></returns> public static List<OnlineUserInfo> GetForumOnlineUserCollection(int forumid) { Discuz.Common.Generic.List<OnlineUserInfo> coll = new Discuz.Common.Generic.List<OnlineUserInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetForumOnlineUserList(forumid); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); coll.Add(info); } reader.Close(); //返回当前版块的在线用户表 return coll; }
public static Discuz.Common.Generic.List<AlbumInfo> GetSpaceAlbumList(int userid, int albumcategoryid, int pageSize, int currentPage) { Discuz.Common.Generic.List<AlbumInfo> aic = new Discuz.Common.Generic.List<AlbumInfo>(); IDataReader reader = Data.DbProvider.GetInstance().SpaceAlbumsList(userid, albumcategoryid, pageSize, currentPage); while (reader.Read()) { aic.Add(GetAlbumEntity(reader)); } reader.Close(); return aic; }
public static Discuz.Common.Generic.List<PhotoCommentInfo> GetPhotoCommentCollection(int photoid) { Discuz.Common.Generic.List<PhotoCommentInfo> comments = new Discuz.Common.Generic.List<PhotoCommentInfo>(); IDataReader reader = Data.DbProvider.GetInstance().GetPhotoCommentCollection(photoid); while (reader.Read()) { PhotoCommentInfo comment = new PhotoCommentInfo(); comment.Commentid = TypeConverter.ObjectToInt(reader["commentid"]); comment.Content = Utils.RemoveHtml(reader["content"].ToString()); comment.Ip = reader["ip"].ToString(); comment.Photoid = TypeConverter.ObjectToInt(reader["photoid"]); comment.Postdatetime = Convert.ToDateTime(reader["postdatetime"]); comment.Userid = TypeConverter.ObjectToInt(reader["userid"]); comment.Username = reader["username"].ToString(); comments.Add(comment); } reader.Close(); return comments; }
public static Discuz.Common.Generic.List<IndexPageForumInfo> GetForumIndexCollection(int hideprivate, int usergroupid, int moderstyle, out int topiccount, out int postcount, out int todaycount) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); #endif topiccount = 0; postcount = 0; todaycount = 0; IDataReader reader = DatabaseProvider.GetInstance().GetForumIndexList(); if (reader != null) { int status = 0; int colcount = 1; while (reader.Read()) { IndexPageForumInfo info = new IndexPageForumInfo(); //赋值 info.Fid = Int32.Parse(reader["fid"].ToString()); info.Parentid = Int16.Parse(reader["parentid"].ToString()); info.Layer = Int16.Parse(reader["layer"].ToString()); info.Name = reader["name"].ToString(); info.Pathlist = reader["pathlist"].ToString(); info.Parentidlist = reader["parentidlist"].ToString(); info.Subforumcount = Int32.Parse(reader["subforumcount"].ToString()); info.Status = Int32.Parse(reader["status"].ToString()); info.Colcount = Int16.Parse(reader["colcount"].ToString()); info.Displayorder = Int32.Parse(reader["displayorder"].ToString()); info.Templateid = Int16.Parse(reader["templateid"].ToString()); info.Topics = Int32.Parse(reader["topics"].ToString()); info.CurrentTopics = Int32.Parse(reader["curtopics"].ToString()); info.Posts = Int32.Parse(reader["posts"].ToString()); info.Todayposts = Int32.Parse(reader["todayposts"].ToString()); info.Lastpost = reader["lastpost"].ToString(); info.Lastposter = reader["lastposter"].ToString(); info.Lasttid = Int32.Parse(reader["lasttid"].ToString()); info.Lastposterid = Int32.Parse(reader["lastposterid"].ToString()); info.Lasttitle = reader["lasttitle"].ToString(); info.Allowsmilies = Int32.Parse(reader["allowsmilies"].ToString()); info.Allowrss = Int32.Parse(reader["allowrss"].ToString()); info.Allowhtml = Int32.Parse(reader["allowhtml"].ToString()); info.Allowbbcode = Int32.Parse(reader["allowbbcode"].ToString()); info.Allowimgcode = Int32.Parse(reader["allowimgcode"].ToString()); info.Allowblog = Int32.Parse(reader["allowblog"].ToString()); info.Istrade = Int32.Parse(reader["istrade"].ToString()); info.Allowpostspecial = Int32.Parse(reader["allowpostspecial"].ToString()); info.Allowspecialonly = Int32.Parse(reader["allowspecialonly"].ToString()); info.Alloweditrules = Int32.Parse(reader["alloweditrules"].ToString()); info.Allowthumbnail = Int32.Parse(reader["allowthumbnail"].ToString()); info.Recyclebin = Int32.Parse(reader["recyclebin"].ToString()); info.Modnewposts = Int32.Parse(reader["modnewposts"].ToString()); info.Jammer = Int32.Parse(reader["jammer"].ToString()); info.Disablewatermark = Int32.Parse(reader["disablewatermark"].ToString()); info.Inheritedmod = Int32.Parse(reader["inheritedmod"].ToString()); info.Autoclose = Int16.Parse(reader["autoclose"].ToString()); info.Description = reader["description"].ToString(); info.Password = reader["password"].ToString(); info.Icon = reader["icon"].ToString(); info.Postcredits = reader["postcredits"].ToString(); info.Replycredits = reader["replycredits"].ToString(); info.Redirect = reader["redirect"].ToString(); info.Attachextensions = reader["attachextensions"].ToString(); info.Moderators = reader["moderators"].ToString(); info.Rules = reader["rules"].ToString(); info.Topictypes = reader["topictypes"].ToString(); info.Viewperm = reader["viewperm"].ToString(); info.Postperm = reader["postperm"].ToString(); info.Replyperm = reader["replyperm"].ToString(); info.Getattachperm = reader["getattachperm"].ToString(); info.Postattachperm = reader["postattachperm"].ToString(); info.Applytopictype = Int16.Parse(reader["applytopictype"] == DBNull.Value ? "0" : reader["applytopictype"].ToString()); info.Postbytopictype = Int16.Parse(reader["postbytopictype"] == DBNull.Value ? "0" : reader["postbytopictype"].ToString()); info.Viewbytopictype = Int16.Parse(reader["viewbytopictype"] == DBNull.Value ? "0" : reader["viewbytopictype"].ToString()); info.Topictypeprefix = Int16.Parse(reader["topictypeprefix"] == DBNull.Value ? "0" : reader["topictypeprefix"].ToString()); info.Permuserlist = reader["permuserlist"].ToString(); //扩展属性 info.Havenew = reader["havenew"].ToString(); //判断是否收起 if (info.Layer == 0 && Utils.GetCookie("discuz_collapse").IndexOf("_category_" + info.Fid + "_") > -1) { info.Collapse = "display: none;"; } // if (Int32.Parse(reader["status"].ToString()) > 0) { if (Int32.Parse(reader["parentid"].ToString()) == 0 && Int32.Parse(reader["subforumcount"].ToString()) > 0) { colcount = Int32.Parse(reader["colcount"].ToString()); status = colcount; info.Status = status + 1; } else { status++; info.Status = status; info.Colcount = colcount; } } System.Text.StringBuilder sb = new System.Text.StringBuilder(); //如果当前用户权限不够 string[] moderatorslist = Utils.SplitString(reader["moderators"].ToString(), ","); if (sb.Length > 0) { sb.Remove(0, sb.Length); } for (int i = 0; i < moderatorslist.Length; i++) { if (moderstyle == 0) { if (!moderatorslist[i].Trim().Equals("")) { if (!sb.ToString().Equals("")) { sb.Append(","); } sb.Append("<a href=\"userinfo.aspx?username="******"\" target=\"_blank\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</a>"); } } else { if (!moderatorslist[i].Trim().Equals("")) { sb.Append("<option value=\""); sb.Append(moderatorslist[i].Trim()); sb.Append("\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</option>"); } } } if (!sb.ToString().Equals("") && moderstyle == 1) { sb.Insert(0, "<select style=\"width: 100px;\" onchange=\"window.open('userinfo.aspx?username=' + escape(this.value));\">"); sb.Append("</select>"); } info.Moderators = sb.ToString(); if (reader["lastpost"].ToString().Equals("")) { info.Todayposts = 0; } else { if (Convert.ToDateTime(reader["lastpost"]).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) { info.Todayposts = 0; } } if (Utils.StrToInt(reader["layer"], 0) > 0) { topiccount = topiccount + Utils.StrToInt(reader["topics"], 0); postcount = postcount + Utils.StrToInt(reader["posts"], 0); todaycount = todaycount + info.Todayposts; } //判断是否为私密论坛 if (reader["viewperm"].ToString() != "" && !Utils.InArray(usergroupid.ToString(), reader["viewperm"].ToString())) { if (hideprivate == 1) { //不显示 } else { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; coll.Add(info); } } else { coll.Add(info); } } reader.Close(); Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); cache.AddObject("/NowStatistics", topiccount.ToString() + "," + postcount.ToString() + "," + todaycount.ToString()); } //return co return GetRealForumIndexCollection(coll); }
/// <summary> /// 获取首页版块列表集合 /// </summary> /// <param name="fid"></param> /// <param name="hideprivate">0为显示 1为不显示</param> /// <param name="usergroupid"></param> /// <param name="moderstyle">版主显示样式0为横排,1为下拉</param> /// <param name="topiccount"></param> /// <param name="postcount"></param> /// <param name="todaycount"></param> /// <returns></returns> public static Discuz.Common.Generic.List <IndexPageForumInfo> GetForumIndexCollection(int hidePrivate, int userGroupId, int moderStyle, out int topicCount, out int postCount, out int todayCount) { Discuz.Common.Generic.List <IndexPageForumInfo> coll = new Discuz.Common.Generic.List <IndexPageForumInfo>(); topicCount = 0; postCount = 0; todayCount = 0; int status = 0, colcount = 1; foreach (IndexPageForumInfo info in Discuz.Data.Forums.GetForumIndexList()) { //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(userGroupId.ToString(), info.Viewperm)) { //hideprivate:0为显示 1为不显示 if (hidePrivate == 0) { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; } else { continue; } } //判断是否收起 if (info.Layer == 0 && Utils.GetCookie("discuz_collapse").IndexOf("_category_" + info.Fid + "_") > -1) { info.Collapse = "display: none;"; } if (info.Status > 0) { if (info.Parentid == 0 && info.Subforumcount > 0) { colcount = info.Colcount; status = colcount; info.Status = status + 1; } else { info.Status = ++status; info.Colcount = colcount; } } info.Moderators = GetModerators(info, moderStyle); if (Utils.StrIsNullOrEmpty(info.Lastpost) || (TypeConverter.StrToDateTime(info.Lastpost).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) { info.Todayposts = 0; } //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(userGroupId.ToString(), info.Viewperm)) { //hideprivate:0为显示 1为不显示 if (hidePrivate == 0) { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; } } if (info.Layer > 0) { //更新缓存中的主题数,帖子数,今日发帖数 ForumInfo forumInfo = GetForumInfo(info.Fid, false); if (forumInfo != null) { forumInfo.Topics = info.Topics; forumInfo.Posts = info.Posts; forumInfo.Todayposts = info.Todayposts; } topicCount = topicCount + info.Topics; postCount = postCount + info.Posts; todayCount = todayCount + info.Todayposts; } coll.Add(info); } return(GetRealForumIndexCollection(coll)); }
public static Discuz.Common.Generic.List<PhotoInfo> GetSpacePhotosInfo(DataTable dt) { if (dt == null || dt.Rows.Count == 0) return new Discuz.Common.Generic.List<PhotoInfo>(); Discuz.Common.Generic.List<PhotoInfo> photosinfoarray = new Discuz.Common.Generic.List<PhotoInfo>(); for (int i = 0; i < dt.Rows.Count; i++) { PhotoInfo photo = new PhotoInfo(); photo.Photoid = TypeConverter.ObjectToInt(dt.Rows[i]["photoid"]); photo.Filename = dt.Rows[i]["filename"].ToString(); photo.Attachment = dt.Rows[i]["attachment"].ToString(); photo.Filesize = TypeConverter.ObjectToInt(dt.Rows[i]["filesize"]); photo.Description = dt.Rows[i]["description"].ToString(); photo.Postdate = dt.Rows[i]["postdate"].ToString(); photo.Albumid = TypeConverter.ObjectToInt(dt.Rows[i]["albumid"]); photo.Userid = TypeConverter.ObjectToInt(dt.Rows[i]["userid"]); photo.Title = dt.Rows[i]["title"].ToString(); photo.Views = TypeConverter.ObjectToInt(dt.Rows[i]["views"]); photo.Commentstatus = (PhotoStatus)TypeConverter.ObjectToInt(dt.Rows[i]["commentstatus"]); photo.Tagstatus = (PhotoStatus)TypeConverter.ObjectToInt(dt.Rows[i]["tagstatus"]); photo.Comments = TypeConverter.ObjectToInt(dt.Rows[i]["comments"]); photosinfoarray.Add(photo); } dt.Dispose(); return photosinfoarray; }
/// <summary> /// 获取需要审核的主题 /// </summary> /// <param name="fidList">版块ID列表</param> /// <param name="tpp">每页主题数</param> /// <param name="pageId">页数</param> /// <param name="filter">displayorder过滤器</param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetUnauditNewTopic(string fidList, int tpp, int pageId, int filter) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetUnauditNewTopic(fidList, tpp, pageId, filter); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
/// <summary> /// 获取置顶主题列表 /// </summary> /// <param name="fid">版块id</param> /// <param name="pageIndex">页号</param> /// <param name="pageSize">每页条数</param> /// <param name="tids">置顶主题Id列表</param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopTopicList(int fid, int pageSize, int pageIndex, string tidList) { if (!Utils.IsNumericList(tidList)) return new List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopTopics(fid, pageSize, pageIndex, tidList); Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); //if (reader != null) //{ // //SortedList<int, string> topicTypeArray = Caches.GetTopicTypeArray(); // StringBuilder closeid = new StringBuilder(); // object topicTypeName = null; // while (reader.Read()) // { // // // coll.SortAdd(info); // } // reader.Close(); // if (closeid.Length > 0) // { // TopicAdmins.SetClose(closeid.ToString(), 1); // } //} return list; }
/// <summary> /// 按照用户Id获取主题列表 /// </summary> /// <param name="userId"></param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopicsByUserId(int userId, int pageIndex, int pageSize) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsByUserId(userId, pageIndex, pageSize); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
/// <summary> /// 获得一般主题信息列表 /// </summary> /// <param name="fid">版块ID</param> /// <param name="pageSize">每页显示主题数</param> /// <param name="pageIndex">当前页数</param> /// <param name="startNumber">置顶帖数量</param> /// <param name="condition">条件</param> /// <returns>主题信息列表</returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopicList(int fid, int pageSize, int pageIndex, int startNumber, string condition) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopics(fid, pageSize, pageIndex, startNumber, condition); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
/// <summary> /// 返回在线用户列表 /// </summary> public static List<OnlineUserInfo> GetOnlineUserCollection() { Discuz.Common.Generic.List<OnlineUserInfo> coll = new Discuz.Common.Generic.List<OnlineUserInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetOnlineUserList(); while (reader.Read()) { OnlineUserInfo onlineUserInfo = LoadSingleOnlineUser(reader); if (onlineUserInfo.Userid > 0 || (onlineUserInfo.Userid == -1 && GeneralConfigs.GetConfig().Whosonlinecontract == 0)) { onlineUserInfo.Actionname = UserAction.GetActionDescriptionByID((int)(onlineUserInfo.Action)); coll.Add(onlineUserInfo); } } reader.Close(); //返回当前版块的在线用户表 return coll; }
/// <summary> /// 获取需要审核的主题 /// </summary> /// <param name="fidList">版块ID列表</param> /// <param name="tpp">每页主题数</param> /// <param name="pageId">页数</param> /// <param name="filter">displayorder过滤器</param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetUnauditNewTopic(string fidList, int tpp, int pageId, int filter) { Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetUnauditNewTopic(fidList, tpp, pageId, filter); while (reader.Read()) { //TopicInfo info = new TopicInfo(); //info.Title = reader["title"].ToString(); //info.Poster = reader["poster"].ToString(); //info.Posterid = Utils.StrToInt(reader["posterid"], 0); //info.Replies = Utils.StrToInt(reader["replies"], 0); //info.Views = Utils.StrToInt(reader["views"], 0); //info.Lastpost = reader["lastpost"].ToString(); //info.Lastposterid = Utils.StrToInt(reader["Lastposterid"], 0); //info.Lastposter = reader["lastposter"].ToString(); //info.Postdatetime = reader["postdatetime"].ToString(); //info.Tid = Utils.StrToInt(reader["tid"], 0); //info.Fid = Utils.StrToInt(reader["fid"], 0); //info.Forumname = Forums.GetForumInfo(Utils.StrToInt(reader["fid"], 0)).Name; list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); return list; }
public static Discuz.Common.Generic.List<AlbumInfo> GetAlbumRankList(int albumcount) { Discuz.Common.Generic.List<AlbumInfo> aic = DNTCache.GetCacheService().RetrieveObject(string.Format("/Photo/AlbumRank{0}", albumcount)) as Discuz.Common.Generic.List<AlbumInfo>; if (aic == null) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotoRankList(3, albumcount); aic = new Discuz.Common.Generic.List<AlbumInfo>(); while (reader.Read()) { aic.Add(GetAlbumEntity(reader)); } reader.Close(); DNTCache.GetCacheService().AddObject(string.Format("/Photo/AlbumRank{0}", albumcount), (ICollection)aic); } return aic; }
/// <summary> /// 获取置顶主题列表 /// </summary> /// <param name="fid">版块id</param> /// <param name="pageIndex">页号</param> /// <param name="pageSize">每页条数</param> /// <param name="tids">置顶主题Id列表</param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetTopTopicList(int fid, int pageSize, int pageIndex, string tidList) { if (!Utils.IsNumericList(tidList)) return new List<TopicInfo>(); Discuz.Common.Generic.List<TopicInfo> list = new Discuz.Common.Generic.List<TopicInfo>(); if (appDBCache) list = ITopicService.GetTopTopicList(fid, pageSize, pageIndex, tidList); if (list.Count == 0) { IDataReader reader = DatabaseProvider.GetInstance().GetTopTopics(fid, pageSize, pageIndex, tidList); while (reader.Read()) { list.Add(LoadSingleTopicInfo(reader)); } reader.Close(); } return list; }
/// <summary> /// 获取首页版块列表集合 /// </summary> /// <param name="fid"></param> /// <param name="hideprivate">0为显示 1为不显示</param> /// <param name="usergroupid"></param> /// <param name="moderstyle">版主显示样式0为横排,1为下拉</param> /// <param name="topiccount"></param> /// <param name="postcount"></param> /// <param name="todaycount"></param> /// <returns></returns> public static Discuz.Common.Generic.List<IndexPageForumInfo> GetForumIndexCollection(int hidePrivate, int userGroupId, int moderStyle, out int topicCount, out int postCount, out int todayCount) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); topicCount = 0; postCount = 0; todayCount = 0; int status = 0, colcount = 1; foreach (IndexPageForumInfo info in Discuz.Data.Forums.GetForumIndexList()) { //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(userGroupId.ToString(), info.Viewperm)) { //hideprivate:0为显示 1为不显示 if (hidePrivate == 0) { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; } else continue; } //判断是否收起 if (info.Layer == 0 && Utils.GetCookie("discuz_collapse").IndexOf("_category_" + info.Fid + "_") > -1) info.Collapse = "display: none;"; if (info.Status > 0) { if (info.Parentid == 0 && info.Subforumcount > 0) { colcount = info.Colcount; status = colcount; info.Status = status + 1; } else { info.Status = ++status; info.Colcount = colcount; } } info.Moderators = GetModerators(info, moderStyle); if (Utils.StrIsNullOrEmpty(info.Lastpost) || (TypeConverter.StrToDateTime(info.Lastpost).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) info.Todayposts = 0; //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(userGroupId.ToString(), info.Viewperm)) { //hideprivate:0为显示 1为不显示 if (hidePrivate == 0) { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; } } if (info.Layer > 0) { //更新缓存中的主题数,帖子数,今日发帖数 ForumInfo forumInfo = GetForumInfo(info.Fid, false); if (forumInfo != null) { forumInfo.Topics = info.Topics; forumInfo.Posts = info.Posts; forumInfo.Todayposts = info.Todayposts; } topicCount = topicCount + info.Topics; postCount = postCount + info.Posts; todayCount = todayCount + info.Todayposts; } coll.Add(info); } return GetRealForumIndexCollection(coll); }
/// <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; }
/// <summary> /// ��ȡ����ǩ�������� /// </summary> /// <returns>����ǩ��������</returns> public static Discuz.Common.Generic.List<TopicIdentify> GetTopicIdentifyCollection() { DNTCache cache = DNTCache.GetCacheService(); Discuz.Common.Generic.List<TopicIdentify> topicidentifyList = cache.RetrieveObject("/Forum/TopicIdentifys") as Discuz.Common.Generic.List<TopicIdentify>; if (topicidentifyList == null) { topicidentifyList = new Discuz.Common.Generic.List<TopicIdentify>(); IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = TypeConverter.ObjectToInt(reader["identifyid"]); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"], reader["filename"]); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/Forum/TopicIdentifys", topicidentifyList); cache.AddObject("/Forum/TopicIndentifysJsArray", jsArray.ToString()); } return topicidentifyList; }
private static Discuz.Common.Generic.List<ModuleInfo> GetModuleInfoArray(IDataReader reader) { if (reader == null) return null; Discuz.Common.Generic.List<ModuleInfo> mdic = new Discuz.Common.Generic.List<ModuleInfo>(); while (reader.Read()) { mdic.Add(GetModuleEntity(reader)); } reader.Close(); return mdic.Count == 0 ? null : mdic; }
public static Discuz.Common.Generic.List<IndexPageForumInfo> GetSubForumCollection(int fid, int colcount, int hideprivate, int usergroupid, int moderstyle) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); #endif if (fid <= 0) { return coll; } IDataReader reader = DatabaseProvider.GetInstance().GetSubForumReader(fid); if (reader != null) { while (reader.Read()) { IndexPageForumInfo info = new IndexPageForumInfo(); //赋值 info.Fid = Int32.Parse(reader["fid"].ToString()); info.Parentid = Int16.Parse(reader["parentid"].ToString()); info.Layer = Int16.Parse(reader["layer"].ToString()); info.Name = reader["name"].ToString(); info.Pathlist = reader["pathlist"].ToString(); info.Parentidlist = reader["parentidlist"].ToString(); info.Subforumcount = Int32.Parse(reader["subforumcount"].ToString()); info.Status = Int32.Parse(reader["status"].ToString()); if (colcount > 0) { info.Colcount = colcount; } else { info.Colcount = Int16.Parse(reader["colcount"].ToString()); } info.Displayorder = Int32.Parse(reader["displayorder"].ToString()); info.Templateid = Int16.Parse(reader["templateid"].ToString()); info.Topics = Int32.Parse(reader["topics"].ToString()); info.CurrentTopics = Int32.Parse(reader["curtopics"].ToString()); info.Posts = Int32.Parse(reader["posts"].ToString()); info.Todayposts = Int32.Parse(reader["todayposts"].ToString()); info.Lastpost = reader["lastpost"].ToString(); info.Lastposter = reader["lastposter"].ToString(); info.Lasttid = Int32.Parse(reader["lasttid"].ToString()); info.Lastposterid = Int32.Parse(reader["lastposterid"].ToString()); info.Lasttitle = reader["lasttitle"].ToString(); info.Allowsmilies = Int32.Parse(reader["allowsmilies"].ToString()); info.Allowrss = Int32.Parse(reader["allowrss"].ToString()); info.Allowhtml = Int32.Parse(reader["allowhtml"].ToString()); info.Allowbbcode = Int32.Parse(reader["allowbbcode"].ToString()); info.Allowimgcode = Int32.Parse(reader["allowimgcode"].ToString()); info.Allowblog = Int32.Parse(reader["allowblog"].ToString()); info.Istrade = Int32.Parse(reader["istrade"].ToString()); info.Allowpostspecial = Int32.Parse(reader["allowpostspecial"].ToString()); info.Allowspecialonly = Int32.Parse(reader["allowspecialonly"].ToString()); info.Alloweditrules = Int32.Parse(reader["alloweditrules"].ToString()); info.Allowthumbnail = Int32.Parse(reader["allowthumbnail"].ToString()); info.Recyclebin = Int32.Parse(reader["recyclebin"].ToString()); info.Modnewposts = Int32.Parse(reader["modnewposts"].ToString()); info.Jammer = Int32.Parse(reader["jammer"].ToString()); info.Disablewatermark = Int32.Parse(reader["disablewatermark"].ToString()); info.Inheritedmod = Int32.Parse(reader["inheritedmod"].ToString()); info.Autoclose = Int16.Parse(reader["autoclose"].ToString()); info.Description = reader["description"].ToString(); info.Password = reader["password"].ToString(); info.Icon = reader["icon"].ToString(); info.Postcredits = reader["postcredits"].ToString(); info.Replycredits = reader["replycredits"].ToString(); info.Redirect = reader["redirect"].ToString(); info.Attachextensions = reader["attachextensions"].ToString(); info.Moderators = reader["moderators"].ToString(); info.Rules = reader["rules"].ToString(); info.Topictypes = reader["topictypes"].ToString(); info.Viewperm = reader["viewperm"].ToString(); info.Postperm = reader["postperm"].ToString(); info.Replyperm = reader["replyperm"].ToString(); info.Getattachperm = reader["getattachperm"].ToString(); info.Postattachperm = reader["postattachperm"].ToString(); info.Applytopictype = Int16.Parse(reader["applytopictype"].ToString()); info.Postbytopictype = Int16.Parse(reader["postbytopictype"].ToString()); info.Viewbytopictype = Int16.Parse(reader["viewbytopictype"].ToString()); info.Topictypeprefix = Int16.Parse(reader["topictypeprefix"].ToString()); info.Permuserlist = reader["permuserlist"].ToString(); //扩展属性 info.Havenew = reader["havenew"].ToString(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); string[] moderatorslist = Utils.SplitString(reader["moderators"].ToString(), ","); if (sb.Length > 0) { sb.Remove(0, sb.Length); } for (int i = 0; i < moderatorslist.Length; i++) { if (moderstyle == 0) { if (!moderatorslist[i].Trim().Equals("")) { if (!sb.ToString().Equals("")) { sb.Append(","); } sb.Append("<a href=\"userinfo.aspx?username="******"\" target=\"_blank\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</a>"); } } else { if (!moderatorslist[i].Trim().Equals("")) { sb.Append("<option value=\""); sb.Append(moderatorslist[i].Trim()); sb.Append("\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</option>"); } } } if (!sb.ToString().Equals("") && moderstyle == 1) { sb.Insert(0, "<select style=\"width: 100px;\" onchange=\"window.open('userinfo.aspx?username=' + escape(this.value));\">"); sb.Append("</select>"); } info.Moderators = sb.ToString(); if (reader["lastpost"].ToString().Equals("")) { info.Todayposts = 0; } else { if (Convert.ToDateTime(reader["lastpost"]).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) { info.Todayposts = 0; } } if (reader["viewperm"].ToString() != "" && !Utils.InArray(usergroupid.ToString(), reader["viewperm"].ToString())) { if (hideprivate == 1) { //不显示 } else { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; coll.Add(info); } } else { coll.Add(info); } } reader.Close(); } return coll; }
private static Discuz.Common.Generic.List<TabInfo> GetTabInfoArray(IDataReader reader) { if (reader == null) return null; Discuz.Common.Generic.List<TabInfo> tabc = new Discuz.Common.Generic.List<TabInfo>(); while (reader.Read()) { tabc.Add(GetTabEntity(reader)); } reader.Close(); return tabc.Count == 0 ? null : tabc; }
public static Discuz.Common.Generic.List<PhotoInfo> GetPhotosWithSameTag(int tagid, int pageid, int pagesize) { IDataReader reader = Data.DbProvider.GetInstance().GetPhotosWithSameTag(tagid, pageid, pagesize); Discuz.Common.Generic.List<PhotoInfo> photolist = new Discuz.Common.Generic.List<PhotoInfo>(); while (reader.Read()) { photolist.Add(GetPhotoEntity(reader)); } reader.Close(); return photolist; }
/// <summary> /// 获得子版块列表 /// </summary> /// <param name="fid">版块id</param> /// <param name="colcount">每行显示几个版块</param> /// <param name="hideprivate">是否显示无权限的版块</param> /// <param name="usergroupid">用户组id</param> /// <param name="moderstyle">版主显示样式</param> /// <returns></returns> public static Discuz.Common.Generic.List<IndexPageForumInfo> GetSubForumCollection(int fid, int colcount, int hideprivate, int usergroupid, int moderstyle) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); Discuz.Common.Generic.List<IndexPageForumInfo> returncoll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); if (fid > 0) { coll = Discuz.Data.Forums.GetSubForumList(fid, colcount); foreach (IndexPageForumInfo info in coll) { info.Moderators = GetModerators(info, moderstyle); if (Utils.StrIsNullOrEmpty(info.Lastpost) || (TypeConverter.StrToDateTime(info.Lastpost).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) info.Todayposts = 0; //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(usergroupid.ToString(), info.Viewperm)) { //hideprivate:1为显示 0为不显示 if (hideprivate == 1) { returncoll.Add(info); } } else { returncoll.Add(info); } } } return returncoll; }