protected override void ShowPage() { if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } pagetitle = "图片排行"; announcementlist = Announcements.GetAnnouncementList(Utils.GetDateTime(), "2999-01-01 00:00:00"); if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } type = type < 0 ? 0 : type; type = type > 3 ? 3 : type; if (type < 3) { photolist = DTOProvider.GetPhotoRankList(type, photocount); } else { albumlist = DTOProvider.GetAlbumRankList(photocount); } //一周热图总排行 weekhotphotolist = AggregationFacade.AlbumAggregation.GetWeekHotPhotoList(photoconfig.Weekhot); //相册分类 albumcategorylist = DTOProvider.GetAlbumCategory(); recentupdatespaceList = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); }
/// <summary> /// 获得指定用户的短信息列表 /// </summary> /// <param name="userid">用户ID</param> /// <param name="folder">短信息类型(0:收件箱,1:发件箱,2:草稿箱)</param> /// <param name="pagesize">每页显示短信息数</param> /// <param name="pageindex">当前要显示的页数</param> /// <param name="strwhere">筛选条件</param> /// <returns>短信息列表</returns> public static Discuz.Common.Generic.List <PrivateMessageInfo> GetPrivateMessageCollection(int userid, int folder, int pagesize, int pageindex, int inttype) { Discuz.Common.Generic.List <PrivateMessageInfo> coll = new Discuz.Common.Generic.List <PrivateMessageInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetPrivateMessageList(userid, folder, pagesize, pageindex, inttype); if (reader != null) { while (reader.Read()) { PrivateMessageInfo info = new PrivateMessageInfo(); info.Pmid = int.Parse(reader["pmid"].ToString()); info.Msgfrom = reader["msgfrom"].ToString(); info.Msgfromid = int.Parse(reader["msgfromid"].ToString()); info.Msgto = reader["msgto"].ToString(); info.Msgtoid = int.Parse(reader["msgtoid"].ToString()); info.Folder = Int16.Parse(reader["folder"].ToString()); info.New = int.Parse(reader["new"].ToString()); info.Subject = reader["subject"].ToString(); info.Postdatetime = reader["postdatetime"].ToString(); info.Message = reader["message"].ToString(); coll.Add(info); } reader.Close(); } return(coll); }
/// <summary> /// 返回在线用户列表 /// </summary> /// <param name="totaluser">全部用户数</param> /// <param name="guest">游客数</param> /// <param name="user">登录用户数</param> /// <param name="invisibleuser">隐身会员数</param> /// <returns></returns> public static Discuz.Common.Generic.List <OnlineUserInfo> GetForumOnlineUserCollection(int forumid, out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List <OnlineUserInfo> coll = Discuz.Data.OnlineUsers.GetForumOnlineUserCollection(forumid); //在线游客 guest = 0; //在线隐身用户 invisibleuser = 0; //当前版块在线总用户数 totaluser = coll.Count; foreach (OnlineUserInfo onlineUserInfo in coll) { if (onlineUserInfo.Userid == -1) { guest++; } if (onlineUserInfo.Invisible == 1) { invisibleuser++; } } //统计用户 user = totaluser - guest; //返回当前版块的在线用户表 return(coll); }
protected override void ShowPage() { if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } pagetitle = "图片排行"; announcementlist = Announcements.GetAnnouncementList(Utils.GetDateTime(), "2999-01-01 00:00:00"); if (announcementlist != null) announcementcount = announcementlist.Rows.Count; type = type < 0 ? 0 : type; type = type > 3 ? 3 : type; if (type < 3) photolist = DTOProvider.GetPhotoRankList(type, photocount); else albumlist = DTOProvider.GetAlbumRankList(photocount); //一周热图总排行 weekhotphotolist = AggregationFacade.AlbumAggregation.GetWeekHotPhotoList(photoconfig.Weekhot); //相册分类 albumcategorylist = DTOProvider.GetAlbumCategory(); recentupdatespaceList = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); }
/// <summary> /// 检查ip地址是否合法 /// </summary> /// <param name="ip"></param> private static void CheckIp(string ip) { string errmsg = ""; //判断IP地址是否合法,需要重构 Discuz.Common.Generic.List <IpInfo> list = Caches.GetBannedIpList(); foreach (IpInfo ipinfo in list) { if (ip == (string.Format("{0}.{1}.{2}.{3}", ipinfo.Ip1, ipinfo.Ip2, ipinfo.Ip3, ipinfo.Ip4))) { errmsg = "您的ip被封,于" + ipinfo.Expiration + "后解禁"; break; } if (ipinfo.Ip4.ToString() == "*") { if ((TypeConverter.StrToInt(ip.Split('.')[0], -1) == ipinfo.Ip1) && (TypeConverter.StrToInt(ip.Split('.')[1], -1) == ipinfo.Ip2) && (TypeConverter.StrToInt(ip.Split('.')[2], -1) == ipinfo.Ip3)) { errmsg = "您所在的ip段被封,于" + ipinfo.Expiration + "后解禁"; break; } } } if (errmsg != string.Empty) { HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "tools/error.htm?forumpath=" + BaseConfigs.GetForumPath + "&templatepath=default&msg=" + Utils.UrlEncode(errmsg)); } }
public moregadgets() { if (this.userid < 1) { HttpContext.Current.Response.Redirect(forumurlnopage + "/login.aspx?reurl=space"); return; } GetOnlineUserInfo(); #if NET1 TabInfoCollection tc = Spaces.GetTabInfoCollectionByUserID(this.userid); #else Discuz.Common.Generic.List <TabInfo> tc = Spaces.GetTabInfoCollectionByUserID(this.userid); #endif currentUserSpaceConfig = Spaces.GetSpaceConfigByUserId(this.userid); int defaultTabId = Spaces.GetDefaultTabId(currentUserSpaceConfig, tc); string html = StaticFileProvider.GetContent(templatePath + "moregadgets.htm"); TemplateEngine te = new TemplateEngine(); te.Init(html, templatePath); te.Put("tabid", defaultTabId); te.Put("forumpath", BaseConfigs.GetForumPath); te.Put("config", currentUserSpaceConfig); te.Put("username", this.olusername); te.Put("userid", this.oluserid); te.Put("userkey", oluserkey); te.Put("forumurlnopage", forumurlnopage); double processtime = new TimeSpan(DateTime.Now.Ticks).Subtract(begints).Duration().TotalSeconds; te.Put("processtime", processtime); html = te.MergeTemplate(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(html); HttpContext.Current.Response.End(); }
/// <summary> /// 获得推荐图片列表 /// </summary> /// <param name="nodename">节点名称</param> /// <returns></returns> public Discuz.Common.Generic.List <PhotoInfo> GetRecommandPhotoList(string nodeName) { //当文件未被修改时将直接返回相关记录 if (__recommandPhotoList != null) { return(__recommandPhotoList); } __recommandPhotoList = new Discuz.Common.Generic.List <PhotoInfo>(); XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/" + nodeName + "_photolist/Photo"); foreach (XmlNode xmlnode in xmlnodelist) { PhotoInfo recommandPhoto = new PhotoInfo(); recommandPhoto.Photoid = (xmlDoc.GetSingleNodeValue(xmlnode, "photoid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "photoid")); recommandPhoto.Filename = (xmlDoc.GetSingleNodeValue(xmlnode, "filename") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "filename"); recommandPhoto.Attachment = (xmlDoc.GetSingleNodeValue(xmlnode, "attachment") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "attachment"); recommandPhoto.Filesize = (xmlDoc.GetSingleNodeValue(xmlnode, "filesize") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "filesize")); recommandPhoto.Description = (xmlDoc.GetSingleNodeValue(xmlnode, "description") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "description"); recommandPhoto.Postdate = (xmlDoc.GetSingleNodeValue(xmlnode, "postdate") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "postdate"); recommandPhoto.Albumid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumid")); recommandPhoto.Userid = (xmlDoc.GetSingleNodeValue(xmlnode, "userid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "userid")); recommandPhoto.Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title"); recommandPhoto.Views = (xmlDoc.GetSingleNodeValue(xmlnode, "views") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "views")); recommandPhoto.Commentstatus = (xmlDoc.GetSingleNodeValue(xmlnode, "commentstatus") == null) ? PhotoStatus.Owner : (PhotoStatus)Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "commentstatus")); recommandPhoto.Tagstatus = (xmlDoc.GetSingleNodeValue(xmlnode, "tagstatus") == null) ? PhotoStatus.Owner : (PhotoStatus)Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "tagstatus")); recommandPhoto.Comments = (xmlDoc.GetSingleNodeValue(xmlnode, "comments") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "comments")); recommandPhoto.Username = (xmlDoc.GetSingleNodeValue(xmlnode, "username") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "username"); __recommandPhotoList.Add(recommandPhoto); } return(__recommandPhotoList); }
protected void DeleteApply_Click(object sender, EventArgs e) { #region ɾ³ýÏà²á string albumid = DNTRequest.GetString("albumid"); if (albumid.Trim() == "") { return; } foreach (string id in albumid.Split(',')) { #if NET1 PhotoInfoCollection _spacephotoinfoarray = BlogProvider.GetSpacePhotosInfo(DbProvider.GetInstance().GetSpacePhotoByAlbumID(int.Parse(id))); #else Discuz.Common.Generic.List <PhotoInfo> _spacephotoinfoarray = DTOProvider.GetSpacePhotosInfo(DbProvider.GetInstance().GetSpacePhotoByAlbumID(int.Parse(id))); #endif string photoidList = ""; int uid = DbProvider.GetInstance().GetUidByAlbumid(int.Parse(id)); if (_spacephotoinfoarray != null) { foreach (PhotoInfo _s in _spacephotoinfoarray) { photoidList += _s.Photoid + ","; } } if (photoidList != "") { photoidList = photoidList.Substring(0, photoidList.Length - 1); DbProvider.GetInstance().DeleteSpacePhotoByIDList(photoidList, int.Parse(id), uid); } DbProvider.GetInstance().DeleteSpaceAlbum(int.Parse(id), uid); } Response.Redirect("album_manage.aspx"); #endregion }
private void LoadInfo() { string fids = ""; XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode fidlist = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist"); if (fidlist == null) { return; } fids = fidlist.InnerText; string strJson = ""; Discuz.Common.Generic.List <ForumInfo> lists = Discuz.Forum.Forums.GetForumList(); foreach (string fid in fids.Split(',')) { foreach (ForumInfo foruminfo in lists) { if (foruminfo.Fid.ToString() == fid) { strJson += "{'fid':'" + foruminfo.Fid + "','forumtitle':'" + foruminfo.Name + "'},"; break; } } } if (strJson != "") { strJson = strJson.TrimEnd(','); } strJson = "<script type='text/javascript'>\r\nvar fidlist = [" + strJson + "];\r\nfor(var i = 0 ; i < fidlist.length ; i++)\r\n{\r\nvar no = new Option();\r\nno.value = fidlist[i]['fid'];\r\nno.text = fidlist[i]['forumtitle'];\r\nForm1.list2.options[Form1.list2.options.length] = no;\r\n}\r\n</script>"; base.RegisterStartupScript("", strJson); }
/// <summary> /// 相册相关页面的弹出导航菜单HTML内容 /// </summary> /// <returns></returns> public static string GetPhotoListMenuDivCache() { string val = DNTCache.GetCacheService().RetrieveObject("/Photo/AlbumCategoryMenu") as string; if (val != null) { return(val); } StringBuilder sb = new StringBuilder(); Discuz.Common.Generic.List <AlbumCategoryInfo> acic = DTOProvider.GetAlbumCategory(); if (acic.Count > 0) { sb.Append("<div id=\"NavHome_menu\" class=\"NavHomeMenu\" style=\"display:none\"><div id=\"NavHomeWindow\"><ul>"); foreach (AlbumCategoryInfo aci in acic) { sb.AppendLine("<li><a href=\"showalbumlist.aspx?cate="); sb.AppendLine(aci.Albumcateid.ToString()); sb.Append("\">"); sb.AppendLine(aci.Title); sb.AppendLine("</a></li>"); } sb.Append("</ul></div></div>"); } DNTCache.GetCacheService().AddObject("/Photo/AlbumCategoryMenu", sb.ToString()); return(sb.ToString()); }
public static Discuz.Common.Generic.List <OnlineUserInfo> GetForumOnlineUserCollection(int forumid, out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List <OnlineUserInfo> coll = new Discuz.Common.Generic.List <OnlineUserInfo>(); #endif //在线游客 guest = 0; //在线隐身用户 invisibleuser = 0; //用户总数 totaluser = 0; IDataReader reader = DatabaseProvider.GetInstance().GetForumOnlineUserList(forumid); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); //当前版块在线总用户数 totaluser++; if (info.Userid == -1) { guest++; } if (info.Invisible == 1) { invisibleuser++; } coll.Add(info); } reader.Close(); //统计用户 user = totaluser - guest; //返回当前版块的在线用户表 return(coll); }
public static Discuz.Common.Generic.List <OnlineUserInfo> GetOnlineUserCollection(out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List <OnlineUserInfo> coll = new Discuz.Common.Generic.List <OnlineUserInfo>(); #endif //在线注册用户数 user = 0; //在线隐身用户数 invisibleuser = 0; //在线总用户数 totaluser = 0; IDataReader reader = DatabaseProvider.GetInstance().GetOnlineUserList(); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); // if (info.Userid > 0) { user++; } if (info.Invisible == 1) { invisibleuser++; } totaluser++; if (info.Userid > 0 || (info.Userid == -1 && GeneralConfigs.GetConfig().Whosonlinecontract == 0)) { info.Actionname = UserAction.GetActionDescriptionByID((int)(info.Action)); coll.Add(info); } } reader.Close(); int highestonlineusercount = Utils.StrToInt(Statistics.GetStatisticsRowItem("highestonlineusercount"), 1); if (totaluser > highestonlineusercount) { if (Statistics.UpdateStatistics("highestonlineusercount", totaluser) > 0) { Statistics.UpdateStatistics("highestonlineusertime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Statistics.ReSetStatisticsCache(); } } //统计游客 if (totaluser > user) { guest = totaluser - user; } else { guest = 0; } //返回当前版块的在线用户集合 return(coll); }
/// <summary> /// 获得推荐相册列表 /// </summary> /// <param name="nodename">节点名称</param> /// <returns></returns> public Discuz.Common.Generic.List <AlbumInfo> GetRecommandAlbumList(string nodeName) { Discuz.Common.Generic.List <AlbumInfo> __recommandAlbumList = null; switch (nodeName) { case "Website": __recommandAlbumList = __recommandAlbumListForWebSite; break; case "Spaceindex": __recommandAlbumList = __recommandAlbumListForSpaceIndex; break; case "Albumindex": __recommandAlbumList = __recommandAlbumListForAlbumIndex; break; default: __recommandAlbumList = __recommandAlbumListForWebSite; break; } //当文件未被修改时将直接返回相关记录 if (__recommandAlbumList != null) { return(__recommandAlbumList); } __recommandAlbumList = new Discuz.Common.Generic.List <AlbumInfo>(); XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/" + nodeName + "_albumlist/Album"); foreach (XmlNode xmlnode in xmlnodelist) { AlbumInfo album = new AlbumInfo(); album.Albumid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumid")); album.Userid = (xmlDoc.GetSingleNodeValue(xmlnode, "userid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "userid")); album.Username = (xmlDoc.GetSingleNodeValue(xmlnode, "username") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "username"); album.Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title"); album.Description = (xmlDoc.GetSingleNodeValue(xmlnode, "description") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "description"); album.Logo = (xmlDoc.GetSingleNodeValue(xmlnode, "logo") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "logo"); album.Password = (xmlDoc.GetSingleNodeValue(xmlnode, "password") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "password"); album.Imgcount = (xmlDoc.GetSingleNodeValue(xmlnode, "imgcount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "imgcount")); album.Views = (xmlDoc.GetSingleNodeValue(xmlnode, "views") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "views")); album.Type = (xmlDoc.GetSingleNodeValue(xmlnode, "type") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "type")); album.Createdatetime = (xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime"); album.Albumcateid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid")); __recommandAlbumList.Add(album); } switch (nodeName) { case "Website": __recommandAlbumListForWebSite = __recommandAlbumList; break; case "Spaceindex": __recommandAlbumListForSpaceIndex = __recommandAlbumList; break; case "Albumindex": __recommandAlbumListForAlbumIndex = __recommandAlbumList; break; default: __recommandAlbumListForWebSite = __recommandAlbumList; break; } return(__recommandAlbumList); }
protected override void ShowPage() { pagetitle = "日志列表"; if (config.Enablespace != 1) { AddErrLine("个人空间功能已被关闭"); return; } newtopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.PostDateTime, false, false); hottopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.Views, false, false); recentupdatespacelist = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } rotatepicdata = AggregationFacade.BaseAggregation.GetRotatePicData(); currentpage = DNTRequest.GetInt("page", 1); blogsCount = AggregationFacade.SpaceAggregation.GetSpacePostsCount(); pagecount = blogsCount % pageSize == 0 ? blogsCount / pageSize : blogsCount / pageSize + 1; if (pagecount == 0) { pagecount = 1; } if (currentpage < 1) { currentpage = 1; } if (currentpage > pagecount) { currentpage = pagecount; } spacepostlist = AggregationFacade.SpaceAggregation.GetSpacePostList("Spaceindex"); pagenumbers = Utils.GetPageNumbers(currentpage, pagecount, "bloglist.aspx", 8); postslist = AggregationFacade.SpaceAggregation.SpacePostsList(pageSize, currentpage); if (config.Enablealbum == 1) { recommendalbumlist = AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Spaceindex"); } topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments(); }
/// <summary> /// 清空数据绑定 /// </summary> public override void ClearDataBind() { __recommandAlbumListForWebSite = null; __recommandAlbumListForSpaceIndex = null; __recommandAlbumListForAlbumIndex = null; __focusAlbumList = null; __focusPhotoList = null; __recommandPhotoList = null; __albumRotatepic = null; __weekHotPhotoList = null; }
/// <summary> /// 清空数据绑定 /// </summary> public override void ClearDataBind() { __recommandAlbumListForWebSite = null; __recommandAlbumListForSpaceIndex = null; __recommandAlbumListForAlbumIndex = null; __focusAlbumList = null; __focusPhotoList = null; __recommandPhotoList = null; __albumRotatepic = null; __weekHotPhotoList = null; }
/// <summary> /// 获取用户拥有的邀请码列表(封闭) /// </summary> /// <param name="creatorid"></param> /// <param name="pageindex"></param> /// <param name="pagesize"></param> /// <returns></returns> public static Discuz.Common.Generic.List <InviteCodeInfo> GetUserInviteCodeList(int creatorId, int pageIndex) { Discuz.Common.Generic.List <InviteCodeInfo> list = new Discuz.Common.Generic.List <InviteCodeInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetUserInviteCodeList(creatorId, pageIndex); while (reader.Read()) { list.Add(LoadInviteCode(reader)); } reader.Close(); return(list); }
/// <summary> /// 返回短标题的收件箱短消息列表 /// </summary> /// <param name="userid">用户ID</param> /// <param name="pagesize">每页显示短信息数</param> /// <param name="pageindex">当前要显示的页数</param> /// <param name="strwhere">筛选条件</param> /// <returns>收件箱短消息列表</returns> public static Discuz.Common.Generic.List <PrivateMessageInfo> GetPrivateMessageCollectionForIndex(int userid, int pagesize, int pageindex, int inttype) { Discuz.Common.Generic.List <PrivateMessageInfo> coll = GetPrivateMessageCollection(userid, 0, pagesize, pageindex, inttype); if (coll.Count > 0) { for (int i = 0; i < coll.Count; i++) { coll[i].Message = Utils.GetSubString(coll[i].Message, 20, "..."); } } return(coll); }
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> /// <returns>附件类型列表</returns> public static Discuz.Common.Generic.List <AttachmentType> AttachTypeList() { Discuz.Common.Generic.List <AttachmentType> list = new Discuz.Common.Generic.List <AttachmentType>(); foreach (AttachmentType act in MyAttachmentsTypeConfigs.GetConfig().AttachmentType) { AttachmentType MyAttachmentType = new AttachmentType(); MyAttachmentType.TypeId = act.TypeId; MyAttachmentType.TypeName = act.TypeName; MyAttachmentType.ExtName = act.ExtName; list.Add(MyAttachmentType); } return(list); }
/// <summary> /// 获取符合查询条件的订单 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="status">订单状态(0:未付款 1:已付款,卖家未发货 2:交易成功)</param> /// <param name="orderId">订单id</param> /// <param name="tradeNo">支付宝订单号</param> /// <param name="buyer">买家用户名</param> /// <param name="submitStartTime">查询提交开始时间</param> /// <param name="submitLastTime">查询提交结束时间</param> /// <param name="confirmStartTime">查询确认开始时间</param> /// <param name="confirmLastTime">查询确认结束时间</param> /// <returns></returns> public static Discuz.Common.Generic.List<CreditOrderInfo> GetCreditOrderList(int pageIndex, int status, int orderId, string tradeNo, string buyer, string submitStartTime, string submitLastTime, string confirmStartTime, string confirmLastTime) { Discuz.Common.Generic.List<CreditOrderInfo> list = new Discuz.Common.Generic.List<CreditOrderInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetCreditOrderList(pageIndex, status, orderId, tradeNo, buyer, submitStartTime, submitLastTime, confirmStartTime, confirmLastTime); if (reader != null) { while (reader.Read()) { list.Add(LoadCreditOrderInfo(reader)); } reader.Close(); } return list; }
/// <summary> /// 输出主题 /// </summary> /// <returns></returns> private string OutPutTheme() { #if NET1 ThemeInfoCollection tic = SpaceProvider.GetThemeInfos(); ThemeInfoCollection ticCategory = new ThemeInfoCollection(); ThemeInfoCollection ticResult = new ThemeInfoCollection(); #else Discuz.Common.Generic.List <ThemeInfo> tic = SpaceProvider.GetThemeInfos(); Discuz.Common.Generic.List <ThemeInfo> ticCategory = new Discuz.Common.Generic.List <ThemeInfo>(); Discuz.Common.Generic.List <ThemeInfo> ticResult = new Discuz.Common.Generic.List <ThemeInfo>(); #endif StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \r\n"); foreach (ThemeInfo ti in tic) //把分类级的ThemeInfo捡出来 { if (ti.Type != 0) { break; } ticCategory.Add(ti); } sb.Append("<Skin> \r\n"); foreach (ThemeInfo ti in ticCategory) //根据每个分类找其下属主题 { sb.AppendFormat("<Category name=\"{0}\" themeid=\"{1}\"> \r\n", ti.Name, ti.ThemeId); ticResult.Add(ti); foreach (ThemeInfo t in tic) { if (t.Type == ti.ThemeId) { sb.AppendFormat("<Theme themeid=\"{0}\" name=\"{1}\" directory=\"{2}\" createdate=\"{3}\" copyright=\"{4}\" author=\"{5}\" /> \r\n", t.ThemeId, t.Name, t.Directory, t.CreateDate, t.CopyRight, t.Author); } } sb.Append("</Category> \r\n"); } // foreach (ThemeInfo ti in ticResult) // { // sb.AppendFormat("<Theme themeid=\"{0}\" name=\"{1}\" directory=\"{2}\" createdate=\"{3}\" copyright=\"{4}\" author=\"{5}\"> \r\n", ti.ThemeId, ti.Name, ti.Directory, ti.CreateDate, ti.CopyRight, ti.Author); // if (ti.Type == 0) // sb.AppendFormat("<Category name=\"{0}\" /> \r\n", ti.Name); // sb.Append("</Theme> \r\n"); // } sb.Append("</Skin> \r\n"); return(sb.ToString()); }
/// <summary> /// 根据主题的Tag获取相关主题(游客可见级别的) /// </summary> /// <param name="topicid">主题Id</param> /// <returns></returns> public static Discuz.Common.Generic.List<TopicInfo> GetRelatedTopicList(int topicId, int count) { IDataReader reader = DatabaseProvider.GetInstance().GetRelatedTopics(topicId, count); Discuz.Common.Generic.List<TopicInfo> topics = new Discuz.Common.Generic.List<TopicInfo>(); while (reader.Read()) { TopicInfo topic = new TopicInfo(); topic.Tid = TypeConverter.ObjectToInt(reader["linktid"]); topic.Title = reader["linktitle"].ToString(); topics.Add(topic); } reader.Close(); return topics; }
/// <summary> /// 根据主题的Tag获取相关主题(游客可见级别的) /// </summary> /// <param name="topicid">主题Id</param> /// <returns></returns> public static Discuz.Common.Generic.List <TopicInfo> GetRelatedTopicList(int topicId, int count) { IDataReader reader = DatabaseProvider.GetInstance().GetRelatedTopics(topicId, count); Discuz.Common.Generic.List <TopicInfo> topics = new Discuz.Common.Generic.List <TopicInfo>(); while (reader.Read()) { TopicInfo topic = new TopicInfo(); topic.Tid = TypeConverter.ObjectToInt(reader["linktid"]); topic.Title = reader["linktitle"].ToString(); topics.Add(topic); } reader.Close(); return(topics); }
/// <summary> /// 获取符合查询条件的订单 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="status">订单状态(0:未付款 1:已付款,卖家未发货 2:交易成功)</param> /// <param name="orderId">订单id</param> /// <param name="tradeNo">支付宝订单号</param> /// <param name="buyer">买家用户名</param> /// <param name="submitStartTime">查询提交开始时间</param> /// <param name="submitLastTime">查询提交结束时间</param> /// <param name="confirmStartTime">查询确认开始时间</param> /// <param name="confirmLastTime">查询确认结束时间</param> /// <returns></returns> public static Discuz.Common.Generic.List <CreditOrderInfo> GetCreditOrderList(int pageIndex, int status, int orderId, string tradeNo, string buyer, string submitStartTime, string submitLastTime, string confirmStartTime, string confirmLastTime) { Discuz.Common.Generic.List <CreditOrderInfo> list = new Discuz.Common.Generic.List <CreditOrderInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetCreditOrderList(pageIndex, status, orderId, tradeNo, buyer, submitStartTime, submitLastTime, confirmStartTime, confirmLastTime); if (reader != null) { while (reader.Read()) { list.Add(LoadCreditOrderInfo(reader)); } reader.Close(); } return(list); }
/// <summary> /// 返回在线用户列表 /// </summary> /// <param name="totaluser">全部用户数</param> /// <param name="guest">游客数</param> /// <param name="user">登录用户数</param> /// <param name="invisibleuser">隐身会员数</param> /// <returns></returns> public static Discuz.Common.Generic.List <OnlineUserInfo> GetOnlineUserCollection(out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List <OnlineUserInfo> coll = Discuz.Data.OnlineUsers.GetOnlineUserCollection(); //在线注册用户数 user = 0; //在线隐身用户数 invisibleuser = 0; //当在线列表不隐藏游客时,意味'GetOnlineUserCollection()'方法返回了在线表中所有记录 if (GeneralConfigs.GetConfig().Whosonlinecontract == 0) { totaluser = coll.Count; } else { totaluser = OnlineUsers.GetOnlineAllUserCount();//否则需要重新获取全部用户数 } foreach (OnlineUserInfo onlineUserInfo in coll) { if (onlineUserInfo.Userid > 0) { user++; } if (onlineUserInfo.Invisible == 1) { invisibleuser++; } } if (totaluser > TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestonlineusercount"), 1)) { if (Statistics.UpdateStatistics("highestonlineusercount", totaluser.ToString()) > 0) { Statistics.UpdateStatistics("highestonlineusertime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Statistics.ReSetStatisticsCache(); } } //统计游客 guest = totaluser > user ? totaluser - user : 0; //返回当前版块的在线用户集合 return(coll); }
/// <summary> /// 输出主题 /// </summary> /// <returns></returns> private string OutPutTheme() { #if NET1 ThemeInfoCollection tic = SpaceProvider.GetThemeInfos(); ThemeInfoCollection ticCategory = new ThemeInfoCollection(); ThemeInfoCollection ticResult = new ThemeInfoCollection(); #else Discuz.Common.Generic.List<ThemeInfo> tic = SpaceProvider.GetThemeInfos(); Discuz.Common.Generic.List<ThemeInfo> ticCategory = new Discuz.Common.Generic.List<ThemeInfo>(); Discuz.Common.Generic.List<ThemeInfo> ticResult = new Discuz.Common.Generic.List<ThemeInfo>(); #endif StringBuilder sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \r\n"); foreach (ThemeInfo ti in tic) //把分类级的ThemeInfo捡出来 { if (ti.Type != 0) break; ticCategory.Add(ti); } sb.Append("<Skin> \r\n"); foreach (ThemeInfo ti in ticCategory) //根据每个分类找其下属主题 { sb.AppendFormat("<Category name=\"{0}\" themeid=\"{1}\"> \r\n", ti.Name, ti.ThemeId); ticResult.Add(ti); foreach (ThemeInfo t in tic) { if (t.Type == ti.ThemeId) sb.AppendFormat("<Theme themeid=\"{0}\" name=\"{1}\" directory=\"{2}\" createdate=\"{3}\" copyright=\"{4}\" author=\"{5}\" /> \r\n", t.ThemeId, t.Name, t.Directory, t.CreateDate, t.CopyRight, t.Author); } sb.Append("</Category> \r\n"); } // foreach (ThemeInfo ti in ticResult) // { // sb.AppendFormat("<Theme themeid=\"{0}\" name=\"{1}\" directory=\"{2}\" createdate=\"{3}\" copyright=\"{4}\" author=\"{5}\"> \r\n", ti.ThemeId, ti.Name, ti.Directory, ti.CreateDate, ti.CopyRight, ti.Author); // if (ti.Type == 0) // sb.AppendFormat("<Category name=\"{0}\" /> \r\n", ti.Name); // sb.Append("</Theme> \r\n"); // } sb.Append("</Skin> \r\n"); return sb.ToString(); }
protected override void ShowPage() { pagetitle = "日志列表"; if (config.Enablespace != 1) { AddErrLine("个人空间功能已被关闭"); return; } newtopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.PostDateTime, false, false); hottopiclist = AggregationFacade.ForumAggregation.GetForumTopicList(10, 0, 0, TopicTimeType.All, TopicOrderType.Views, false, false); recentupdatespacelist = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) announcementcount = announcementlist.Rows.Count; rotatepicdata = AggregationFacade.BaseAggregation.GetRotatePicData(); currentpage = DNTRequest.GetInt("page", 1); blogsCount = AggregationFacade.SpaceAggregation.GetSpacePostsCount(); pagecount = blogsCount % pageSize == 0 ? blogsCount / pageSize : blogsCount / pageSize + 1; if (pagecount == 0) pagecount = 1; if (currentpage < 1) currentpage = 1; if (currentpage > pagecount) currentpage = pagecount; spacepostlist = AggregationFacade.SpaceAggregation.GetSpacePostList("Spaceindex"); pagenumbers = Utils.GetPageNumbers(currentpage, pagecount, "bloglist.aspx", 8); postslist = AggregationFacade.SpaceAggregation.SpacePostsList(pageSize, currentpage); if (config.Enablealbum == 1) recommendalbumlist = AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Spaceindex"); topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments(); }
protected override void ShowPage() { pagetitle = config.Albumname + "首页"; if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } if (config.Rssstatus == 1) { AddLinkRss("tools/photorss.aspx", "最新图片"); } announcementlist = Announcements.GetAnnouncementList(Utils.GetDateTime(), "2999-01-01 00:00:00"); if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } //轮显图片 rotatepicdata = AggregationFacade.AlbumAggregation.GetRotatePicData(); //推荐图片 recommendphotolist = AggregationFacade.AlbumAggregation.GetRecommandPhotoList("Albumindex"); //焦点图片 focusphotolist = AggregationFacade.AlbumAggregation.GetFocusPhotoList(photoconfig.Focusphotoshowtype, photoconfig.Focusphotocount, photoconfig.Focusphotodays); //推荐相册 recommendalbumlist = AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Albumindex"); //焦点相册 focusalbumlist = AggregationFacade.AlbumAggregation.GetAlbumList(photoconfig.Focusalbumshowtype, photoconfig.Focusalbumcount, photoconfig.Focusalbumdays); //一周热图总排行 weekhotphotolist = AggregationFacade.AlbumAggregation.GetWeekHotPhotoList(photoconfig.Weekhot); //相册分类 albumcategorylist = DTOProvider.GetAlbumCategory(); if (config.Enablespace == 1) { recentupdatespaceList = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); } }
/// <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 Discuz.Common.Generic.List <AlbumCategoryInfo> GetAlbumCategory() { string commandText = string.Format("SELECT * FROM [{0}albumcategories] ORDER BY [displayorder]", BaseConfigs.GetTablePrefix); IDataReader reader = DbHelper.ExecuteReader(CommandType.Text, commandText); Discuz.Common.Generic.List <AlbumCategoryInfo> acic = new Discuz.Common.Generic.List <AlbumCategoryInfo>(); while (reader.Read()) { AlbumCategoryInfo aci = new AlbumCategoryInfo(); aci.Albumcateid = TypeConverter.ObjectToInt(reader["albumcateid"], 0); aci.Albumcount = TypeConverter.ObjectToInt(reader["albumcount"], 0); aci.Description = reader["description"].ToString(); aci.Displayorder = TypeConverter.ObjectToInt(reader["displayorder"], 0); aci.Title = reader["title"].ToString(); acic.Add(aci); } reader.Close(); return(acic); }
private void DeleteSapceInfo(string spaceid) { int uid = int.Parse(DbProvider.GetInstance().GetUidBySpaceid(spaceid)); //删除附件 string aidlist = DbProvider.GetInstance().GetSpaceattachmentsAidListByUid(uid); if (aidlist != "") { DbProvider.GetInstance().DeleteSpaceAttachmentByIDList(aidlist, uid); } //删除主题分类 DbProvider.GetInstance().DeleteSpaceCategory(uid); //删除评论 DbProvider.GetInstance().DeleteSpaceComments(uid); //删除友情链接 DbProvider.GetInstance().DeleteSpaceLink(uid); ////删除模块 #if NET1 ModuleInfoCollection milist = Spaces.GetModuleCollectionByUserId(uid); #else Discuz.Common.Generic.List <ModuleInfo> milist = Spaces.GetModuleCollectionByUserId(uid); #endif if (milist != null) { foreach (ModuleInfo mi in milist) { ISpaceCommand isc = Spaces.SetModuleBase(mi); isc.RemoveModule(); } } //删除日志 DbProvider.GetInstance().DeleteSpacePosts(uid); //删除版块 DbProvider.GetInstance().DeleteTab(uid); //删除个人空间记录 DbProvider.GetInstance().DeleteSpaceByUid(uid); //重置User表中的个人空间 DatabaseProvider.GetInstance().ClearUserSpace(uid); }
/// <summary> /// 获得焦点相册列表 /// </summary> /// <param name="type">类型</param> /// <param name="focusphotocount">返回记录条数</param> /// <param name="vaildDays">有效天数</param> /// <returns></returns> public Discuz.Common.Generic.List <AlbumInfo> GetAlbumList(int type, int focusPhotoCount, int vaildDays) { //当文件未被修改时将直接返回相关记录 if (__focusAlbumList != null) { return(__focusAlbumList); } IDataReader reader = AlbumPluginProvider.GetInstance().GetAlbumListByCondition(type, focusPhotoCount, vaildDays); __focusAlbumList = new Discuz.Common.Generic.List <AlbumInfo>(); if (reader != null) { while (reader.Read()) { __focusAlbumList.Add(AlbumPluginProvider.GetInstance().GetAlbumEntity(reader)); } reader.Close(); } return(__focusAlbumList); }
public static Discuz.Common.Generic.List <MyAttachmentInfo> GetAttachmentByUid(int uid, int typeid, int pageIndex, int pageSize) { Discuz.Common.Generic.List <MyAttachmentInfo> myattachment = new Discuz.Common.Generic.List <MyAttachmentInfo>(); if (pageIndex <= 0) { return(myattachment); } else { IDataReader reader; if (typeid == 0) { reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, pageIndex, pageSize); } else { reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, SetExtNamelist(typeid), pageIndex, pageSize); } while (reader.Read()) { MyAttachmentInfo info = new MyAttachmentInfo(); info.Uid = Int32.Parse(reader["uid"].ToString()); info.Aid = Int32.Parse(reader["aid"].ToString()); info.Postdatetime = reader["postdatetime"].ToString(); info.Filename = reader["filename"].ToString().StartsWith("http://") ? reader["filename"].ToString() : "upload/" + reader["filename"].ToString().Replace("\\", "/"); info.Description = reader["description"].ToString(); info.Attachment = reader["attachment"].ToString(); info.SimpleName = Utils.ConvertSimpleFileName(reader["attachment"].ToString(), "...", 6, 3, 15); info.Downloads = Int32.Parse(reader["downloads"].ToString()); myattachment.Add(info); } reader.Close(); return(myattachment); } }
public static Discuz.Common.Generic.List <TopicIdentify> GetTopicIdentifyCollection() #endif { Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); #if NET1 TopicIdentifyCollection topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as TopicIdentifyCollection; #else Discuz.Common.Generic.List <TopicIdentify> topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as Discuz.Common.Generic.List <TopicIdentify>; #endif if (topicidentifyList == null) { #if NET1 topicidentifyList = new TopicIdentifyCollection(); #else topicidentifyList = new Discuz.Common.Generic.List <TopicIdentify>(); #endif IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = Int32.Parse(reader["identifyid"].ToString()); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"].ToString(), reader["filename"].ToString()); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/TopicIdentifys", topicidentifyList); cache.AddObject("/TopicIndentifysJsArray", jsArray.ToString()); } return(topicidentifyList); }
/// <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); }
public static Discuz.Common.Generic.List<TopicIdentify> GetTopicIdentifyCollection() #endif { Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); #if NET1 TopicIdentifyCollection topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as TopicIdentifyCollection; #else Discuz.Common.Generic.List<TopicIdentify> topicidentifyList = cache.RetrieveObject("/TopicIdentifys") as Discuz.Common.Generic.List<TopicIdentify>; #endif if (topicidentifyList == null) { #if NET1 topicidentifyList = new TopicIdentifyCollection(); #else topicidentifyList = new Discuz.Common.Generic.List<TopicIdentify>(); #endif IDataReader reader = DatabaseProvider.GetInstance().GetTopicsIdentifyItem(); StringBuilder jsArray = new StringBuilder("<script type='text/javascript'>var topicidentify = { "); while (reader.Read()) { TopicIdentify topic = new TopicIdentify(); topic.Identifyid = Int32.Parse(reader["identifyid"].ToString()); topic.Name = reader["name"].ToString(); topic.Filename = reader["filename"].ToString(); topicidentifyList.Add(topic); jsArray.AppendFormat("'{0}':'{1}',", reader["identifyid"].ToString(), reader["filename"].ToString()); } reader.Close(); jsArray.Remove(jsArray.Length - 1, 1); jsArray.Append("};</script>"); cache.AddObject("/TopicIdentifys", topicidentifyList); cache.AddObject("/TopicIndentifysJsArray", jsArray.ToString()); } return topicidentifyList; }
protected override void ShowPage() { pagetitle = config.Albumname + "首页"; if (config.Enablealbum != 1) { AddErrLine("相册功能已被关闭"); return; } if (config.Rssstatus == 1) AddLinkRss("tools/photorss.aspx", "最新图片"); announcementlist = Announcements.GetAnnouncementList(Utils.GetDateTime(), "2999-01-01 00:00:00"); if (announcementlist != null) announcementcount = announcementlist.Rows.Count; //轮显图片 rotatepicdata = AggregationFacade.AlbumAggregation.GetRotatePicData(); //推荐图片 recommendphotolist = AggregationFacade.AlbumAggregation.GetRecommandPhotoList("Albumindex"); //焦点图片 focusphotolist = AggregationFacade.AlbumAggregation.GetFocusPhotoList(photoconfig.Focusphotoshowtype, photoconfig.Focusphotocount, photoconfig.Focusphotodays); //推荐相册 recommendalbumlist = AggregationFacade.AlbumAggregation.GetRecommandAlbumList("Albumindex"); //焦点相册 focusalbumlist = AggregationFacade.AlbumAggregation.GetAlbumList(photoconfig.Focusalbumshowtype, photoconfig.Focusalbumcount, photoconfig.Focusalbumdays); //一周热图总排行 weekhotphotolist = AggregationFacade.AlbumAggregation.GetWeekHotPhotoList(photoconfig.Weekhot); //相册分类 albumcategorylist = DTOProvider.GetAlbumCategory(); if (config.Enablespace == 1) recentupdatespaceList = AggregationFacade.SpaceAggregation.GetRecentUpdateSpaceList(AggregationConfig.GetConfig().RecentUpdateSpaceAggregationListCount); }
public static Discuz.Common.Generic.List<MyAttachmentInfo> GetAttachmentByUid(int uid, int typeid, int pageIndex, int pageSize) { Discuz.Common.Generic.List<MyAttachmentInfo> myattachment = new Discuz.Common.Generic.List<MyAttachmentInfo>(); if (pageIndex <= 0) { return myattachment; } else { IDataReader reader; if (typeid == 0) { reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, pageIndex, pageSize); } else { reader = DatabaseProvider.GetInstance().GetAttachmentByUid(uid, SetExtNamelist(typeid), pageIndex, pageSize); } while (reader.Read()) { MyAttachmentInfo info = new MyAttachmentInfo(); info.Uid = Int32.Parse(reader["uid"].ToString()); info.Aid = Int32.Parse(reader["aid"].ToString()); info.Postdatetime = reader["postdatetime"].ToString(); info.Filename = reader["filename"].ToString().StartsWith("http://") ? reader["filename"].ToString() : "upload/" + reader["filename"].ToString().Replace("\\", "/"); info.Description = reader["description"].ToString(); info.Attachment = reader["attachment"].ToString(); info.SimpleName = Utils.ConvertSimpleFileName(reader["attachment"].ToString(), "...", 6, 3, 15); info.Downloads = Int32.Parse(reader["downloads"].ToString()); myattachment.Add(info); } reader.Close(); return myattachment; } }
public showtopic() { // 获取主题ID int topicid = DNTRequest.GetInt("topicid", -1); // 如果主题ID非数字 if (topicid == -1) { ShowMsg("无效的主题ID"); return; } // 获取该主题的信息 TopicInfo topic = Topics.GetTopicInfo(topicid); // 如果该主题不存在 if (topic == null || topic.Closed > 1) { ShowMsg("不存在的主题ID"); return; } if (topic.Displayorder == -1) { ShowMsg("此主题已被删除!"); return; } if (topic.Readperm > usergroupinfo.Readaccess && topic.Posterid != userid) { ShowMsg(string.Format("本主题阅读权限为: {0}, 您当前的身份 \"{1}\" 阅读权限不够", topic.Readperm, usergroupinfo.Grouptitle)); return; } ForumInfo forum = Forums.GetForumInfo(topic.Fid); if (Utils.StrIsNullOrEmpty(forum.Viewperm))//当板块权限为空时,按照用户组权限 { if (usergroupinfo.Allowvisit != 1) { ShowMsg("您当前的身份 \"" + usergroupinfo.Grouptitle + "\" 没有浏览该版块的权限"); return; } } else//当板块权限不为空,按照板块权限 { if (!Forums.AllowView(forum.Viewperm, usergroupinfo.Groupid)) { ShowMsg("您没有浏览该版块的权限"); return; } } if (forum.Password != "") { ShowMsg("简洁版本无法浏览设置了密码的版块"); return; } //验证用户是否为本版版主 int ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0; //购买帖子操作 //判断是否为回复可见帖, price=0为非购买可见(正常), price>0 为购买可见, price=-1为购买可见但当前用户已购买 int price = 0; if (topic.Price > 0 && userid != topic.Posterid && ismoder != 1) { price = topic.Price; //时间乘以-1是因为当Configs.GetMaxChargeSpan()==0时,帖子始终为购买帖 if (PaymentLogs.IsBuyer(topicid, userid) || (Utils.StrDateDiffHours(topic.Postdatetime, Scoresets.GetMaxChargeSpan()) > 0 && Scoresets.GetMaxChargeSpan() != 0))//判断当前用户是否已经购买 { price = -1; } } if (price > 0) { ShowMsg(string.Format("此帖需转到完整版处购买后才可查看.<a href=\"{0}buytopic.aspx?topicid={1}\">点击购买</a>", BaseConfigs.GetForumPath, topic.Tid)); return; } // 获取帖子总数 int postcount = topic.Replies + 1; int pageid = 1; // 得到Tpp设置 int ppp = 30; //获取总页数 int pagecount = postcount % ppp == 0 ? postcount / ppp : postcount / ppp + 1; if (pagecount == 0) pagecount = 1; // 得到当前用户请求的页数 if (DNTRequest.GetString("page").ToLower().Equals("end")) pageid = pagecount; else pageid = DNTRequest.GetInt("page", 1); //修正请求页数中可能的错误 if (pageid < 1) pageid = 1; if (pageid > pagecount) pageid = pagecount; int hide = 1; if (topic.Hide == 1 && (Posts.IsReplier(topicid, userid) || ismoder == 1)) hide = -1; //获取当前页主题列表 PostpramsInfo postpramsInfo = new PostpramsInfo(); postpramsInfo.Fid = forum.Fid; postpramsInfo.Tid = topicid; postpramsInfo.Jammer = forum.Jammer; postpramsInfo.Pagesize = ppp; postpramsInfo.Pageindex = pageid; postpramsInfo.Getattachperm = forum.Getattachperm; postpramsInfo.Usergroupid = usergroupinfo.Groupid; postpramsInfo.Attachimgpost = config.Attachimgpost; postpramsInfo.Showattachmentpath = config.Showattachmentpath; postpramsInfo.Hide = hide; postpramsInfo.Price = topic.Price; postpramsInfo.Usergroupreadaccess = usergroupinfo.Readaccess; postpramsInfo.CurrentUserid = userid; postpramsInfo.Showimages = forum.Allowimgcode; // 简洁版本中关闭表情符的解析 postpramsInfo.Smileyoff = 1; postpramsInfo.Smiliesmax = 0; postpramsInfo.Smiliesinfo = null; postpramsInfo.Customeditorbuttoninfo = null; postpramsInfo.Bbcodemode = 0; // 简洁版本中关闭ubb转换 postpramsInfo.Bbcodeoff = 1; postpramsInfo.CurrentUserGroup = usergroupinfo; postpramsInfo.Onlinetimeout = config.Onlinetimeout; UserInfo userInfo = Users.GetUserInfo(userid); postpramsInfo.Usercredits = userInfo == null ? 0 : userInfo.Credits; postlist = Posts.GetPostList(postpramsInfo, out attachmentlist, ismoder == 1); if (postlist.Count <= 0) { ShowMsg("读取信息失败"); return; } ShowTitle(topic.Title); ShowBody(); HttpContext.Current.Response.Write("<h1>" + config.Forumtitle + "</h1>"); HttpContext.Current.Response.Write("<div class=\"forumnav\">"); HttpContext.Current.Response.Write("<a href=\"index.aspx\">首页</a> » "); if (config.Aspxrewrite == 1) HttpContext.Current.Response.Write(string.Format("{0} » <a href=\"showtopic-{1}{2}\">{3}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("</a><", "</a> » <"), topicid.ToString(), config.Extname, topic.Title)); else HttpContext.Current.Response.Write(string.Format("{0} » <a href=\"showtopic.aspx?topicid={1}\">{2}</a>", ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), "aspx").Replace("</a><", "</a> » <"), topicid.ToString(), topic.Title)); HttpContext.Current.Response.Write("</div>\r\n"); foreach (ShowtopicPagePostInfo postinfo in postlist) { HttpContext.Current.Response.Write("<div class=\"postitem\">\r\n"); HttpContext.Current.Response.Write("\t<div class=\"postitemtitle\">\r\n"); HttpContext.Current.Response.Write(Utils.HtmlEncode(postinfo.Poster) + " - " + postinfo.Postdatetime); HttpContext.Current.Response.Write("</div><div class=\"postitemcontent\">"); HttpContext.Current.Response.Write(postinfo.Message); foreach (ShowtopicPageAttachmentInfo attinfo in attachmentlist) { if (attinfo.Pid == postinfo.Pid) { HttpContext.Current.Response.Write(string.Format("<br /><br />附件: <a href=\"../attachment.aspx?attachmentid={0}\">{1}</a>", attinfo.Aid, Utils.HtmlEncode(attinfo.Attachment))); } } HttpContext.Current.Response.Write("\t</div>\r\n</div>\r\n"); } //得到页码链接 HttpContext.Current.Response.Write("<div class=\"pagenumbers\">"); if (config.Aspxrewrite == 1) HttpContext.Current.Response.Write(Utils.GetStaticPageNumbers(pageid, pagecount, "showtopic-" + topicid, config.Extname, 8)); else HttpContext.Current.Response.Write(Utils.GetPageNumbers(pageid, pagecount, "showtopic.aspx?topicid=" + topicid, 8, "page")); HttpContext.Current.Response.Write("</div>\r\n"); //更新查看次数 TopicStats.Track(topicid, 1); if (config.Aspxrewrite == 1) HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic-{0}{1}\">{2}</a></div>\r\n", topicid, config.Extname, topic.Title)); else HttpContext.Current.Response.Write(string.Format("<div class=\"fullversion\">查看完整版本: <a href=\"../showtopic.aspx?topicid={0}\">{1}</a></div>\r\n", topicid, topic.Title)); ShowFooter(); //HttpContext.Current.Response.End(); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
/// <summary> /// 获取用户拥有的邀请码列表(封闭) /// </summary> /// <param name="creatorid"></param> /// <param name="pageindex"></param> /// <param name="pagesize"></param> /// <returns></returns> public static Discuz.Common.Generic.List<InviteCodeInfo> GetUserInviteCodeList(int creatorId, int pageIndex) { Discuz.Common.Generic.List<InviteCodeInfo> list = new Discuz.Common.Generic.List<InviteCodeInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetUserInviteCodeList(creatorId, pageIndex); while (reader.Read()) { list.Add(LoadInviteCode(reader)); } reader.Close(); return list; }
public static Discuz.Common.Generic.List<OnlineUserInfo> GetOnlineUserCollection(out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List<OnlineUserInfo> coll = new Discuz.Common.Generic.List<OnlineUserInfo>(); #endif //在线注册用户数 user = 0; //在线隐身用户数 invisibleuser = 0; //在线总用户数 totaluser = 0; IDataReader reader = DatabaseProvider.GetInstance().GetOnlineUserList(); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); // if (info.Userid > 0) { user++; } if (info.Invisible == 1) { invisibleuser++; } totaluser++; if (info.Userid > 0 || (info.Userid == -1 && GeneralConfigs.GetConfig().Whosonlinecontract == 0)) { info.Actionname = UserAction.GetActionDescriptionByID((int)(info.Action)); coll.Add(info); } } reader.Close(); int highestonlineusercount = Utils.StrToInt(Statistics.GetStatisticsRowItem("highestonlineusercount"), 1); if (totaluser > highestonlineusercount) { if (Statistics.UpdateStatistics("highestonlineusercount", totaluser) > 0) { Statistics.UpdateStatistics("highestonlineusertime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); Statistics.ReSetStatisticsCache(); } } //统计游客 if (totaluser > user) { guest = totaluser - user; } else { guest = 0; } //返回当前版块的在线用户集合 return coll; }
public static Discuz.Common.Generic.List<OnlineUserInfo> GetForumOnlineUserCollection(int forumid, out int totaluser, out int guest, out int user, out int invisibleuser) { Discuz.Common.Generic.List<OnlineUserInfo> coll = new Discuz.Common.Generic.List<OnlineUserInfo>(); #endif //在线游客 guest = 0; //在线隐身用户 invisibleuser = 0; //用户总数 totaluser = 0; IDataReader reader = DatabaseProvider.GetInstance().GetForumOnlineUserList(forumid); while (reader.Read()) { OnlineUserInfo info = LoadSingleOnlineUser(reader); //当前版块在线总用户数 totaluser++; if (info.Userid == -1) { guest++; } if (info.Invisible == 1) { invisibleuser++; } coll.Add(info); } reader.Close(); //统计用户 user = totaluser - guest; //返回当前版块的在线用户表 return coll; }
/// <summary> /// 一周热图总排行 /// </summary> /// <param name="focusphotocount">返回的记录数</param> /// <returns></returns> public Discuz.Common.Generic.List<PhotoInfo> GetWeekHotPhotoList(int focusPhotoCount) { //当文件未被修改时将直接返回相关记录 if (__weekHotPhotoList != null) { return __weekHotPhotoList; } __weekHotPhotoList = new Discuz.Common.Generic.List<PhotoInfo>(); IDataReader reader = AlbumPluginProvider.GetInstance().GetFocusPhotoList(0, focusPhotoCount, 7); if (reader != null) { while (reader.Read()) { PhotoInfo pi = AlbumPluginProvider.GetInstance().GetPhotoEntity(reader); pi.Filename = AlbumPluginProvider.GetInstance().GetThumbnailImage(pi.Filename); pi.Title = pi.Title.Trim(); __weekHotPhotoList.Add(pi); } reader.Close(); } return __weekHotPhotoList; }
/// <summary> /// 获得焦点相册列表 /// </summary> /// <param name="type">类型</param> /// <param name="focusphotocount">返回记录条数</param> /// <param name="vaildDays">有效天数</param> /// <returns></returns> public Discuz.Common.Generic.List<AlbumInfo> GetAlbumList(int type, int focusPhotoCount, int vaildDays) { //当文件未被修改时将直接返回相关记录 if (__focusAlbumList != null) return __focusAlbumList; IDataReader reader = AlbumPluginProvider.GetInstance().GetAlbumListByCondition(type, focusPhotoCount, vaildDays); __focusAlbumList = new Discuz.Common.Generic.List<AlbumInfo>(); if (reader != null) { while (reader.Read()) { __focusAlbumList.Add(AlbumPluginProvider.GetInstance().GetAlbumEntity(reader)); } reader.Close(); } return __focusAlbumList; }
/// <summary> /// 输出页面 /// </summary> private void OutputSpacePage() { string root = BaseConfigs.GetForumPath; string user = DNTRequest.GetQueryString("user"); int currentuid = DNTRequest.GetQueryInt("uid", -1); if (currentuid < 1) { if (user != string.Empty) currentuid = Users.GetUserIdByRewriteName(user); if (currentuid < 1) currentuid = this.userid; } if (userid > 0) { isLogged = true; if (userid == currentuid) spaceEditable = true; } if (currentuid < 1 && this.userid < 1) HttpContext.Current.Response.Redirect(forumurlnopage + "login.aspx?reurl=space"); else//对用户空间访问量加1 Data.DbProvider.GetInstance().CountUserSpaceVisitedTimesByUserID(currentuid); int currenttabid = DNTRequest.GetQueryInt("tab", 0); spaceConfig = Spaces.GetSpaceConfigByUserId(currentuid); ShortUserInfo sui = Users.GetShortUserInfo(currentuid); if (spaceConfig == null || sui == null || spaceConfig.Status != SpaceStatusType.Natural || sui.Spaceid <= 0) { if (userid == currentuid && userid > 0) HttpContext.Current.Response.Redirect(forumurlnopage + "spaceregister.aspx"); else { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write("<script>alert('当前用户未开通" + spacename + "!');document.location = '" + forumurl + "';</script>"); HttpContext.Current.Response.End(); } return; } Discuz.Common.Generic.List<TabInfo> tc = Spaces.GetTabInfoCollectionByUserID(currentuid); if (tc == null) tc = new Discuz.Common.Generic.List<TabInfo>(); int defaulttabid = 0; if (tc.Count > 0) { //此处修改为始终显示第一个tab //defaulttabid = tc[tc.Count - 1].TabID; defaulttabid = tc[0].TabID; spaceConfig.DefaultTab = defaulttabid; } StringBuilder tabsHtml = new StringBuilder(); TabInfo currentTab = null; foreach (TabInfo tab in tc) { if (tab.TabID == (currenttabid == 0 ? spaceConfig.DefaultTab : currenttabid)) { defaulttabid = tab.TabID; break; } } foreach (TabInfo tab in tc) { tabsHtml.Append("<li class=\"tab unselectedtab_l\"> </li>"); if (tab.TabID == defaulttabid) { currentTab = tab; string tabformat = ""; if (spaceEditable) { tabformat += @"<li id=""tab{0}_edit"" class=""tab edittab selectedtab"" style=""display:none"" onclick=""_gel('tab{0}_title').focus();"" onmouseover=""_disable_onblur=true;"" onmouseout=""_disable_onblur=false;""><script>_disable_onblur = false;</script><form id=""tab{0}_rename_form"" name=""tab{0}_rename_form"" onsubmit=""return _renameTab();""><span><input id=""tab{0}_title"" name=""tab_title"" value=""{1}"" onblur=""_disable_onblur ? void(0) : _renameTab();"">"; if (tc.Count > 1) tabformat += @"<a href=""#"" onclick=""if (confirm('您确定要删除 "TAB_NAME" 页面及其所有内容吗?'.replace('TAB_NAME', _editedTabName()))) {{_dlsetp('dt={0}');}}return false;""><img src=""" + BaseConfigs.GetForumPath + "space/images/clear.gif\" border=\"0\" /></a>"; tabformat += "</span></form></li>"; } tabformat += @"<li id=""tab{0}_view"" class=""tab selectedtab"" style=""display:block"" "; if (spaceEditable) tabformat += @"onclick=""_editTab('{0}')"" title=""单击修改页面名称"""; tabformat += @"><span id=""tab{0}_view_title"">{1}</span></li>"; tabsHtml.AppendFormat(tabformat, tab.TabID, tab.TabName); } else { string tabformat = "<li id=\"tab{0}_view\" class=\"tab unselectedtab\" style=\"display:block\" onclick=\""; tabformat += "document.location=ds_i()+'tab={0}'"; tabformat += "\"><span id=\"tab{0}_view_title\">{1}</span></li>"; tabsHtml.AppendFormat(/*"<li id=\"tab{0}_view\" class=\"tab unselectedtab\" style=\"display:block\" onclick=\"_dlsetp('ct={0}')\"><span id=\"tab{0}_view_title\">{1}</span></li>"*/tabformat, tab.TabID, tab.TabName); } tabsHtml.Append("<li class=\"tab unselectedtab_r\"> </li>"); } // for test use the specific template string template = ""; string tempPath = ""; if (currentTab != null && currentTab.Template != string.Empty) tempPath = Utils.GetMapPath(root + "/space/skins/templates/" + currentTab.Template + ""); if (currentTab == null || currentTab.Template == string.Empty || !File.Exists(tempPath)) template = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" id=\"t_1\"><tr><td style=\"width: 67%;\" id=\"col_1\" class=\"col\">{pane1}</td></tr></table><script>alert('您选择的板式不存在或者已经被删除,请重新选择板式。');</script>"; else template = StaticFileProvider.GetContent(tempPath); Discuz.Common.Generic.List<ModuleInfo> mc = Spaces.GetModuleCollectionByTabId(defaulttabid, currentuid); template = ParseModules(mc, template); Hashtable ht = new Hashtable(); ht.Add("modules", template); ht.Add("islogged", isLogged); ht.Add("editable", spaceEditable); ht.Add("userkey", this.userkey); ht.Add("username", this.username); ht.Add("userid", this.userid); ht.Add("config", spaceConfig); ht.Add("tabs", tabsHtml.ToString()); if (currentTab != null) ht.Add("currenttab", currentTab); ht.Add("tabid", defaulttabid); ht.Add("tabcount", tc.Count); ht.Add("can_be_added", tc.Count < 5 && spaceEditable); ht.Add("footer", SpaceActiveConfigs.GetConfig().SpaceFooterInfo); ht.Add("forumpath", BaseConfigs.GetForumPath); //在模板中设置相册名称变量 ht.Add("spacename", spacename); ht.Add("albumname", albumname); if (configspaceurl.ToLower().IndexOf("http://") < 0) { configspaceurl = forumurlnopage + configspaceurl; } ht.Add("configspaceurl", configspaceurl); if (configspaceurl.ToLower().IndexOf("http://") < 0) configspaceurlnopage = forumurlnopage; else configspaceurlnopage = configspaceurl.Substring(0, configspaceurl.LastIndexOf('/')) + "/"; ht.Add("configspaceurlnopage", configspaceurlnopage); //获取配置文件中的space空间路径 string spaceurl = GeneralConfigs.GetConfig().Spaceurl; if (spaceurl.ToLower().IndexOf("http://") == 0) spaceurl = spaceurl.Substring(0, spaceurl.LastIndexOf('/')) + "/space/" ; else { //从当前的URL请求中获取相关站点及(虚拟)路径信息 spaceurl = HttpContext.Current.Request.Url.ToString(); spaceurl = spaceurl.Substring(0, spaceurl.LastIndexOf('/')) + "/"; } if (config.Enablespacerewrite > 0 && spaceConfig.Rewritename != string.Empty) spaceurl += spaceConfig.Rewritename; else spaceurl += "?uid=" + spaceConfig.UserID; ht.Add("spaceurl", spaceurl); if (configalbumurl.ToLower().IndexOf("http://") < 0) configalbumurl = forumurlnopage + configalbumurl; ht.Add("configalbumurl", configalbumurl); ht.Add("forumurl", forumurl); ht.Add("forumurlnopage", forumurlnopage); ht.Add("editbar", EditbarTemplate.Instance.GetHtml(ht)); string content = MainTemplate.Instance.GetHtml(ht); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(content.Replace("IG_", "DS_").Replace("ig_", "dnt_")); HttpContext.Current.Response.End(); }
/// <summary> /// 获得推荐相册列表 /// </summary> /// <param name="nodename">节点名称</param> /// <returns></returns> public Discuz.Common.Generic.List<AlbumInfo> GetRecommandAlbumList(string nodeName) { Discuz.Common.Generic.List<AlbumInfo> __recommandAlbumList = null; switch (nodeName) { case "Website": __recommandAlbumList = __recommandAlbumListForWebSite; break; case "Spaceindex": __recommandAlbumList = __recommandAlbumListForSpaceIndex; break; case "Albumindex": __recommandAlbumList = __recommandAlbumListForAlbumIndex; break; default: __recommandAlbumList = __recommandAlbumListForWebSite; break; } //当文件未被修改时将直接返回相关记录 if (__recommandAlbumList != null) return __recommandAlbumList; __recommandAlbumList = new Discuz.Common.Generic.List<AlbumInfo>(); XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/" + nodeName + "_albumlist/Album"); foreach (XmlNode xmlnode in xmlnodelist) { AlbumInfo album = new AlbumInfo(); album.Albumid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumid")); album.Userid = (xmlDoc.GetSingleNodeValue(xmlnode, "userid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "userid")); album.Username = (xmlDoc.GetSingleNodeValue(xmlnode, "username") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "username"); album.Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title"); album.Description = (xmlDoc.GetSingleNodeValue(xmlnode, "description") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "description"); album.Logo = (xmlDoc.GetSingleNodeValue(xmlnode, "logo") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "logo"); album.Password = (xmlDoc.GetSingleNodeValue(xmlnode, "password") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "password"); album.Imgcount = (xmlDoc.GetSingleNodeValue(xmlnode, "imgcount") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "imgcount")); album.Views = (xmlDoc.GetSingleNodeValue(xmlnode, "views") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "views")); album.Type = (xmlDoc.GetSingleNodeValue(xmlnode, "type") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "type")); album.Createdatetime = (xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "createdatetime"); album.Albumcateid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumcateid")); __recommandAlbumList.Add(album); } switch (nodeName) { case "Website": __recommandAlbumListForWebSite = __recommandAlbumList; break; case "Spaceindex":__recommandAlbumListForSpaceIndex = __recommandAlbumList; break; case "Albumindex":__recommandAlbumListForAlbumIndex = __recommandAlbumList; break; default: __recommandAlbumListForWebSite = __recommandAlbumList; break; } return __recommandAlbumList; }
/// <summary> /// 获取附件类型列表 /// </summary> /// <returns>附件类型列表</returns> public static Discuz.Common.Generic.List<AttachmentType> AttachTypeList() { Discuz.Common.Generic.List<AttachmentType> list = new Discuz.Common.Generic.List<AttachmentType>(); foreach (AttachmentType act in MyAttachmentsTypeConfigs.GetConfig().AttachmentType) { AttachmentType MyAttachmentType = new AttachmentType(); MyAttachmentType.TypeId = act.TypeId; MyAttachmentType.TypeName = act.TypeName; MyAttachmentType.ExtName = act.ExtName; list.Add(MyAttachmentType); } return list; }
/// <summary> /// 获得推荐图片列表 /// </summary> /// <param name="nodename">节点名称</param> /// <returns></returns> public Discuz.Common.Generic.List<PhotoInfo> GetRecommandPhotoList(string nodeName) { //当文件未被修改时将直接返回相关记录 if (__recommandPhotoList != null) { return __recommandPhotoList; } __recommandPhotoList = new Discuz.Common.Generic.List<PhotoInfo>(); XmlNodeList xmlnodelist = xmlDoc.DocumentElement.SelectNodes("/Aggregationinfo/Aggregationpage/" + nodeName + "/" + nodeName + "_photolist/Photo"); foreach (XmlNode xmlnode in xmlnodelist) { PhotoInfo recommandPhoto = new PhotoInfo(); recommandPhoto.Photoid = (xmlDoc.GetSingleNodeValue(xmlnode, "photoid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "photoid")); recommandPhoto.Filename = (xmlDoc.GetSingleNodeValue(xmlnode, "filename") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "filename"); recommandPhoto.Attachment = (xmlDoc.GetSingleNodeValue(xmlnode, "attachment") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "attachment"); recommandPhoto.Filesize = (xmlDoc.GetSingleNodeValue(xmlnode, "filesize") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "filesize")); recommandPhoto.Description = (xmlDoc.GetSingleNodeValue(xmlnode, "description") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "description"); recommandPhoto.Postdate = (xmlDoc.GetSingleNodeValue(xmlnode, "postdate") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "postdate"); recommandPhoto.Albumid = (xmlDoc.GetSingleNodeValue(xmlnode, "albumid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "albumid")); recommandPhoto.Userid = (xmlDoc.GetSingleNodeValue(xmlnode, "userid") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "userid")); recommandPhoto.Title = (xmlDoc.GetSingleNodeValue(xmlnode, "title") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "title"); recommandPhoto.Views = (xmlDoc.GetSingleNodeValue(xmlnode, "views") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "views")); recommandPhoto.Commentstatus = (xmlDoc.GetSingleNodeValue(xmlnode, "commentstatus") == null) ? PhotoStatus.Owner : (PhotoStatus)Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "commentstatus")); recommandPhoto.Tagstatus = (xmlDoc.GetSingleNodeValue(xmlnode, "tagstatus") == null) ? PhotoStatus.Owner : (PhotoStatus)Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "tagstatus")); recommandPhoto.Comments = (xmlDoc.GetSingleNodeValue(xmlnode, "comments") == null) ? 0 : Convert.ToInt32(xmlDoc.GetSingleNodeValue(xmlnode, "comments")); recommandPhoto.Username = (xmlDoc.GetSingleNodeValue(xmlnode, "username") == null) ? "" : xmlDoc.GetSingleNodeValue(xmlnode, "username"); __recommandPhotoList.Add(recommandPhoto); } return __recommandPhotoList; }
public Discuz.Common.Generic.List<AlbumCategoryInfo> GetAlbumCategory() { string sql = string.Format("SELECT * FROM [{0}albumcategories] ORDER BY [displayorder]", BaseConfigs.GetTablePrefix); IDataReader reader = DbHelper.ExecuteReader(CommandType.Text, sql); Discuz.Common.Generic.List<AlbumCategoryInfo> acic = new Discuz.Common.Generic.List<AlbumCategoryInfo>(); if (reader != null) { while (reader.Read()) { AlbumCategoryInfo aci = new AlbumCategoryInfo(); aci.Albumcateid = Utils.StrToInt(reader["albumcateid"], 0); aci.Albumcount = Utils.StrToInt(reader["albumcount"], 0); aci.Description = reader["description"].ToString(); aci.Displayorder = Utils.StrToInt(reader["displayorder"], 0); aci.Title = reader["title"].ToString(); acic.Add(aci); } reader.Close(); } return acic; }
/// <summary> /// 获得指定用户的短信息列表 /// </summary> /// <param name="userid">用户ID</param> /// <param name="folder">短信息类型(0:收件箱,1:发件箱,2:草稿箱)</param> /// <param name="pagesize">每页显示短信息数</param> /// <param name="pageindex">当前要显示的页数</param> /// <param name="strwhere">筛选条件</param> /// <returns>短信息列表</returns> public static Discuz.Common.Generic.List<PrivateMessageInfo> GetPrivateMessageCollection(int userid, int folder, int pagesize, int pageindex, int inttype) { Discuz.Common.Generic.List<PrivateMessageInfo> coll = new Discuz.Common.Generic.List<PrivateMessageInfo>(); IDataReader reader = DatabaseProvider.GetInstance().GetPrivateMessageList(userid, folder, pagesize, pageindex, inttype); if (reader != null) { while (reader.Read()) { PrivateMessageInfo info = new PrivateMessageInfo(); info.Pmid = int.Parse(reader["pmid"].ToString()); info.Msgfrom = reader["msgfrom"].ToString(); info.Msgfromid = int.Parse(reader["msgfromid"].ToString()); info.Msgto = reader["msgto"].ToString(); info.Msgtoid = int.Parse(reader["msgtoid"].ToString()); info.Folder = Int16.Parse(reader["folder"].ToString()); info.New = int.Parse(reader["new"].ToString()); info.Subject = reader["subject"].ToString(); info.Postdatetime = reader["postdatetime"].ToString(); info.Message = reader["message"].ToString(); coll.Add(info); } reader.Close(); } return coll; }