Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        /// <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());
        }
Exemplo n.º 4
0
        /// <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));
            }
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        /// <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>();

            if (fid > 0)
            {
                coll = Discuz.Data.Forums.GetSubForumList(fid, colcount);

                foreach (IndexPageForumInfo info in coll)
                {
                    info.Description = UBB.ParseSimpleUBB(info.Description); //替换版块介绍中的UBB
                    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;
                        }
                    }
                }
            }
            return(coll);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取需要审核的主题
        /// </summary>
        /// <param name="forumidlist">版块ID</param>
        /// <param name="tpp">每页主题数</param>
        /// <param name="pageid">页数</param>
        /// <returns></returns>
        public static Discuz.Common.Generic.List <TopicInfo> GetUnauditNewTopic(string forumidlist, int tpp, int pageid, int filter)
        {
            Discuz.Common.Generic.List <TopicInfo> list = Data.Topics.GetUnauditNewTopic(forumidlist, tpp, pageid, filter);
            foreach (TopicInfo info in list)
            {
                info.Forumname = Forums.GetForumInfo(info.Fid).Name;
            }

            return(list);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取我的未通过审核主题
        /// </summary>
        /// <param name="posterid">作者ID</param>
        /// <param name="filter">-2为未审核</param>
        /// <param name="tpp">单页显示多少条</param>
        /// <param name="pageindex">起始页</param>
        public static Discuz.Common.Generic.List <TopicInfo> GetMyUnauditTopic(int posterId, int tpp, int pageId, int filter)
        {
            Discuz.Common.Generic.List <TopicInfo> list = Data.Topics.GetMyUnauditTopic(posterId, tpp, pageId, filter);
            foreach (TopicInfo info in list)
            {
                info.Forumname = Forums.GetForumInfo(info.Fid).Name;
            }

            return(list);
        }
Exemplo n.º 9
0
        /// <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);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        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;
		}
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 对符合新帖,精华帖的页面显示进行查询的函数
        /// </summary>
        /// <param name="pagesize">每个分页的主题数</param>
        /// <param name="pageindex">分页页数</param>
        /// <param name="startnum">置顶帖数量</param>
        /// <param name="newmin">最近多少分钟内的主题认为是新主题</param>
        /// <param name="hot">多少个帖子认为是热门主题</param>
        /// <param name="condition">条件</param>
        /// <returns>主题列表</returns>
        public static Discuz.Common.Generic.List <TopicInfo> GetTopicListByCondition(int pageSize, int pageIndex, int startNumber, int newMinutes, int hotReplyNumber, int autocloseTime, int topicTypePrefix, string condition, string orderby, int ascdesc)
        {
            if (pageIndex < 1)
            {
                pageIndex = 1;
            }

            Discuz.Common.Generic.List <TopicInfo> list = Data.Topics.GetTopicListByCondition(pageSize, pageIndex, startNumber, condition, orderby, ascdesc);

            LoadTopicListExtraInfo(autocloseTime, topicTypePrefix, newMinutes, hotReplyNumber, list);

            return(list);
        }
Exemplo n.º 15
0
        /// <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);
        }
Exemplo n.º 16
0
        public static Discuz.Common.Generic.List <AlbumCategoryInfo> GetAlbumCategory()
        {
            DNTCache cache = DNTCache.GetCacheService();

            Discuz.Common.Generic.List <AlbumCategoryInfo> acic = cache.RetrieveObject("/Space/AlbumCategory") as Discuz.Common.Generic.List <AlbumCategoryInfo>;

            if (acic == null)
            {
                acic = new Discuz.Common.Generic.List <AlbumCategoryInfo>();
                acic = Data.DbProvider.GetInstance().GetAlbumCategory();
                cache.AddObject("/Space/AlbumCategory", (ICollection)acic);
            }
            return(acic);
        }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        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);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 按照用户Id获取主题列表
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页条数</param>
        /// <param name="newmin">新帖时效</param>
        /// <param name="hot">热帖基数</param>
        /// <returns></returns>
        public static Discuz.Common.Generic.List <TopicInfo> GetTopicsByUserId(int userId, int pageIndex, int pageSize, int newmin, int hot)
        {
            if (pageIndex < 1)
            {
                pageIndex = 1;
            }

            Discuz.Common.Generic.List <TopicInfo> list = Data.Topics.GetTopicsByUserId(userId, pageIndex, pageSize);
            foreach (TopicInfo topic in list)
            {
                LoadTopicForumName(topic);
                LoadTopicHighlightTitle(topic);
                LoadTopicFolder(0, newmin, hot, topic);
            }
            return(list);
        }
Exemplo n.º 21
0
        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);
        }
Exemplo n.º 22
0
        /// <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);
        }
Exemplo n.º 23
0
 /// <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);
 }
Exemplo n.º 24
0
        /// <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);
        }
Exemplo n.º 25
0
        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);
        }
Exemplo n.º 26
0
        /// <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);
        }
Exemplo n.º 27
0
        /// <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);
        }
Exemplo n.º 28
0
        /// <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);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 获得用户的默认TabID
        /// </summary>
        /// <param name="spaceConfig">用户的空间设置</param>
        /// <param name="tc">Tab集合</param>
        /// <returns>TabID</returns>
        public static int GetDefaultTabId(SpaceConfigInfo spaceConfig, Discuz.Common.Generic.List <TabInfo> tc)
        {
            if (tc == null)
            {
                return(0);
            }

            int defaulttabid = 0;

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

            foreach (TabInfo tab in tc)
            {
                if (tab.TabID == spaceConfig.DefaultTab)
                {
                    defaulttabid = tab.TabID;
                    break;
                }
            }
            return(defaulttabid);
        }
Exemplo n.º 30
0
 /// <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);
 }
Exemplo n.º 31
0
        /// <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;
        }
Exemplo n.º 32
0
        /// <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;
        }
Exemplo n.º 33
0
        /// <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;
        }
Exemplo n.º 34
0
        /// <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;
        }
Exemplo n.º 35
0
        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;
        }
Exemplo n.º 36
0
        /// <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;
        }
Exemplo n.º 37
0
        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;
		}
Exemplo n.º 38
0
		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;
		}
Exemplo n.º 39
0
        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;
        }
Exemplo n.º 40
0
        protected override void ShowPage()
        {
            pagetitle = "首页";

            // 得到公告
            announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
            if (announcementlist != null)
                announcementcount = announcementlist.Rows.Count;

            // 友情链接
            forumlinkcount = forumlinklist.Rows.Count;

            Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts);

            // 获得统计信息
            totalusers = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers"));
            lastusername = Statistics.GetStatisticsRowItem("lastusername");
            lastuserid = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"));
            yesterdayposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts"));
            highestposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts"));
            highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim();
            if (todayposts > highestposts)
            {
                highestposts = todayposts;
                highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            totalonline = onlineusercount;
            OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);

            highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
            highestonlineusertime = Statistics.GetStatisticsRowItem("highestonlineusertime");

            //相册
            if (config.Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null)
                albumcategorylist = AlbumPluginProvider.GetInstance().GetAlbumCategory();

            if (config.Enablespace == 1 && AggregationFacade.SpaceAggregation.GetSpaceTopComments() != null)
                topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments();

            taglist = (config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0]);
            doublead = Advertisements.GetDoubleAd("indexad", 0);
            floatad = Advertisements.GetFloatAd("indexad", 0);
        }
Exemplo n.º 41
0
        private string condition   = ""; //查询条件

        protected override void ShowPage()
        {
            if (userid > 0 && useradminid > 0)
            {
                admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
            }

            if (config.Rssstatus == 1)
            {
                AddLinkRss("tools/rss.aspx", "最新主题");
            }

            #region 版块信息设置
            //当所选论坛为多个时或全部时
            if (forumid == -1)
            {
                //用户点选相应的论坛
                forums = (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("fidlist")) ? DNTRequest.GetString("fidlist") : DNTRequest.GetString("forums")).ToLower();
                //如果是选择全部版块

                forums = (forums == string.Empty || forums == "all") ? GetForums() : forums;
                forums = GetAllowviewForums(forums);
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            if (forumid > 0)
            {
                forum = Forums.GetForumInfo(forumid);
                if (forum == null)
                {
                    AddErrLine("不存在的版块ID");
                    return;
                }

                pagetitle      = Utils.RemoveHtml(forum.Name);
                forumnav       = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                showforumlogin = ShowForumLogin();

                if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }
                // 得到子版块列表
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            }
            #endregion

            //设置查询条件
            SetCondition();

            if (IsErr())
            {
                return;
            }

            pagetitle = (type == "digest" ? "查看精华" : "查看新帖");

            SetPageIdAndNumber();
            topiclist = Topics.GetTopicListByCondition(tpp, pageid, 0, 10, config.Hottopic, forum.Autoclose, forum.Topictypeprefix, condition, GetOrder(), direct);

            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, config.Onlinetimeout);
            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Exemplo n.º 42
0
        protected override void ShowPage()
        {
            GetPostAds(forumid);

            if (userid > 0 && useradminid > 0)
            {
                AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                if (admingroupinfo != null)
                    disablepostctrl = admingroupinfo.Disablepostctrl;
            }

            #region 获取版块信息
            if (forumid == -1)
            {
                AddLinkRss(forumpath + "tools/rss.aspx", "最新主题");
                AddErrLine("无效的版块ID");
                return;
            }
            forum = Forums.GetForumInfo(forumid);
            if (forum == null || forum.Fid < 1)
            {
                if (config.Rssstatus == 1)
                    AddLinkRss(forumpath + "tools/rss.aspx", Utils.EncodeHtml(config.Forumtitle) + " 最新主题");

                AddErrLine("不存在的版块ID");
                return;
            }
            #endregion

            if (config.Rssstatus == 1)
                AddLinkRss(forumpath + "tools/" + base.RssAspxRewrite(forum.Fid), Utils.EncodeHtml(forum.Name) + " 最新主题");

            if (JumpUrl(forum)) return;

            needaudit = UserAuthority.NeedAudit(forum, useradminid, userid, usergroupinfo);

            // 检查是否具有版主的身份
            if (useradminid > 0)
                ismoder = Moderators.IsModer(useradminid, userid, forumid);

            //设置搜索和排序条件
            SetSearchCondition();

            showforumlogin = IsShowForumLogin(forum);
            pagetitle = Utils.RemoveHtml(forum.Name);
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            forumnav = ShowForumAspxRewrite(ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname).Replace("\"showforum", "\"" + forumurl + "showforum"),
                                            forumid, pageid);
            topicextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans());

            #region 主题分类设置
            if (forum.Applytopictype == 1) //启用主题分类
                topictypeselectoptions = Forums.GetCurrentTopicTypesOption(forum.Fid, forum.Topictypes);

            if (forum.Viewbytopictype == 1) //允许按类别浏览
                topictypeselectlink = Forums.GetCurrentTopicTypesLink(forum.Fid, forum.Topictypes, forumurl + "showforum.aspx");
            #endregion

            //更新页面Meta中的keyword,description项, 提高SEO友好性
            UpdateMetaInfo(Utils.StrIsNullOrEmpty(forum.Seokeywords) ? config.Seokeywords : forum.Seokeywords,
                Utils.StrIsNullOrEmpty(forum.Seodescription) ? forum.Description : forum.Seodescription,
                config.Seohead);

            //设置编辑器状态
            SetEditorState();

            #region 访问和发帖权限校验
            if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
            {
                AddErrLine(msg);
                needlogin = userid == -1;
                return;
            }

            canposttopic = UserAuthority.PostAuthority(forum, usergroupinfo, userid, ref msg);
            // 如果当前用户非管理员并且论坛设定了禁止发帖时间段,当前时间如果在其中的一个时间段内,不允许用户发帖
            if (useradminid != 1 && usergroupinfo.Disableperiodctrl != 1)
            {
                string visittime = "";
                if (canposttopic && Scoresets.BetweenTime(config.Postbanperiods, out visittime))
                    canposttopic = false;

                isnewbie = UserAuthority.CheckNewbieSpan(userid);
            }

            //是否显示快速发主题编辑器(全局权限判定,版块权限判定,是否是游客,游客需要显示,登录用户是否允许发主题且已过新手见习期)
            if ((config.Fastpost == 1 || config.Fastpost == 3) && forum.Allowspecialonly <= 0 && (userid < 0 || (canposttopic && !isnewbie)))
                canquickpost = true;
            #endregion

            // 得到子版块列表
            if (forum.Subforumcount > 0)
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            if (!forum.Rules.Equals(""))
                forum.Rules = UBB.ParseSimpleUBB(forum.Rules);//替换版规中的UBB
            //获取主题总数
            topiccount = Topics.GetTopicCount(forumid, true, condition);

            #region 设置分页及主题列表信息
            // 得到Tpp设置
            if (tpp <= 0)
                tpp = config.Tpp;

            // 得到Ppp设置
            if (ppp <= 0)
                ppp = config.Ppp;

            //修正请求页数中可能的错误
            if (pageid < 1)
                pageid = 1;

            int toptopicpagecount = 0;

            if (forum.Layer > 0)
            {
                //获取当前页置顶主题列表
                DataRow dr = Topics.GetTopTopicListID(forumid);
                if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString()))
                    topiccount = topiccount + TypeConverter.ObjectToInt(dr["tid0Count"]);

                //获取总页数
                pagecount = topiccount % tpp == 0 ? topiccount / tpp : topiccount / tpp + 1;
                if (pagecount == 0)
                    pagecount = 1;
                if (pageid > pagecount)
                    pageid = pagecount;

                if (dr != null && !Utils.StrIsNullOrEmpty(dr["tid"].ToString()))
                {
                    toptopiccount = TypeConverter.ObjectToInt(dr["tidCount"]);
                    if (toptopiccount > tpp * (pageid - 1))
                    {
                        toptopiclist = Topics.GetTopTopicList(forumid, tpp, pageid, dr["tid"].ToString(), forum.Autoclose, forum.Topictypeprefix);
                        toptopicpagecount = toptopiccount / tpp;
                    }

                    if (toptopicpagecount >= pageid || (pageid == 1 && toptopicpagecount != toptopiccount))
                        topiclist = GetTopicInfoList(tpp - toptopiccount % tpp, pageid - toptopicpagecount, 0);
                    else
                        topiclist = GetTopicInfoList(tpp, pageid - toptopicpagecount, toptopiccount % tpp);
                }
                else
                {
                    toptopicpagecount = 0;
                    topiclist = GetTopicInfoList(tpp, pageid, 0);
                }

                //如果topiclist为空则更新当前论坛帖数
                if (topiclist == null || topiclist.Count == 0 || topiclist.Count > topiccount)
                    Forums.SetRealCurrentTopics(forum.Fid);

                SetPageNumber();
                //当版块数大于一个并且当版块数量为一个时不是版块自身时显示下拉菜单
                showvisitedforumsmenu = visitedforums != null && ((visitedforums.Length == 1 && visitedforums[0].Fid != forumid) || visitedforums.Length > 1);
                SetVisitedForumsCookie();
                //保存查看版块的页数
                Utils.WriteCookie("forumpageid", pageid.ToString(), 30);

                //判断是否需要生成游客缓存页面
                IsGuestCachePage();
            }
            #endregion

            #region 替换版规中的UBB
            forum.Description = UBB.ParseSimpleUBB(forum.Description);
            #endregion

            #region 更新在线信息
            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, forum.Name, -1, "");

            if ((forumtotalonline < config.Maxonlinelist && (config.Whosonlinestatus == 2 || config.Whosonlinestatus == 3)) || DNTRequest.GetString("showonline") == "yes")
            {

                showforumonline = true;
                onlineuserlist = OnlineUsers.GetForumOnlineUserCollection(forumid, out forumtotalonline, out forumtotalonlineguest,
                                                             out forumtotalonlineuser, out forumtotalonlineinvisibleuser);
            }
            //if (DNTRequest.GetString("showonline") != "no")
            //{
            //     showforumonline = false;
            //}

            if (DNTRequest.GetString("showonline") == "no")
            {
                showforumonline = false;
            }
            #endregion

            //修正版主列表
            if (forum.Moderators.Trim() != "")
            {
                string moderHtml = string.Empty;
                foreach (string m in forum.Moderators.Split(','))
                {
                    moderHtml += string.Format("<a href=\"{0}userinfo.aspx?username={1}\">{2}</a>,", forumpath, Utils.UrlEncode(m), m);
                }

                forum.Moderators = moderHtml.TrimEnd(',');
            }

            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Exemplo n.º 43
0
        /// <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>();

            if (fid > 0)
            {
                coll = Discuz.Data.Forums.GetSubForumList(fid, colcount);

                foreach (IndexPageForumInfo info in coll)
                {
                    info.Description = UBB.ParseSimpleUBB(info.Description); //替换版块介绍中的UBB
                    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;
                        }
                    }
                }
            }
            return coll;
        }
Exemplo n.º 44
0
        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;
        }
Exemplo n.º 45
0
        /// <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;
        }
Exemplo n.º 46
0
        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;
        }
Exemplo n.º 47
0
        public static Discuz.Common.Generic.List<AlbumCategoryInfo> GetAlbumCategory()
        {
            DNTCache cache = DNTCache.GetCacheService();
            Discuz.Common.Generic.List<AlbumCategoryInfo> acic = cache.RetrieveObject("/Space/AlbumCategory") as Discuz.Common.Generic.List<AlbumCategoryInfo>;

            if (acic == null)
            {
                acic = new Discuz.Common.Generic.List<AlbumCategoryInfo>();
                acic = Data.DbProvider.GetInstance().GetAlbumCategory();
                cache.AddObject("/Space/AlbumCategory", (ICollection)acic);
            }
            return acic;
        }
Exemplo n.º 48
0
        /// <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;
        }
Exemplo n.º 49
0
        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;
        }
Exemplo n.º 50
0
 /// <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;
 }
Exemplo n.º 51
0
        protected override void ShowPage()
		{
			pagetitle = "首页";
            if (userid > 0 && useradminid > 0)
            {
                AdminGroupInfo admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);
                if (admingroupinfo != null)
                    disablepostctrl = admingroupinfo.Disablepostctrl;
            }

            int toframe = DNTRequest.GetInt("f", 1);
            if (toframe == 0)
                ForumUtils.WriteCookie("isframe", "1");
            else
                toframe = Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1) == -1 ? config.Isframeshow : Utils.StrToInt(ForumUtils.GetCookie("isframe"), -1);

			if (toframe == 2)
			{
				HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx");
				HttpContext.Current.Response.End();
                return;
			}

            if (config.Rssstatus == 1)
				AddLinkRss("tools/rss.aspx", "最新主题");

			OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout);

            //if (newpmcount > 0)
            //    pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid,5,1,1);

			if (userid != -1)
			{
				userinfo = Users.GetShortUserInfo(userid);
                if (userinfo == null)
                {
                    userid = -1;
                    ForumUtils.ClearUserCookie("dnt");
                }
                else
                {
					newpmcount = userinfo.Newpm == 0 ? 0 : newpmcount;
				    lastvisit = userinfo.Lastvisit.ToString();
                    showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4;
                }
			}

			navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);

			forumlist = Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts);
			forumlinkcount = forumlinklist.Rows.Count;

			//个人空间控制
            if (config.Enablespace == 1)
                GetSpacePerm();

			// 获得统计信息
			totalusers = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers"));
			lastusername = Statistics.GetStatisticsRowItem("lastusername").Trim();
            lastuserid = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"));
            yesterdayposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts"));
            highestposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts"));
            highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim();
            if (todayposts > highestposts)
            {
                highestposts = todayposts;
                highestpostsdate = DateTime.Now.ToString("yyyy-M-d");
            }
            totalonline = onlineusercount;
			showforumonline = false;
			onlineiconlist = Caches.GetOnlineGroupIconList();
			if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes")
			{
				showforumonline = true;
				//获得在线用户列表和图标
                onlineuserlist = OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser);
			}

			if (DNTRequest.GetString("showonline") == "no")
				showforumonline = false;

			highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount");
			highestonlineusertime = DateTime.Parse(Statistics.GetStatisticsRowItem("highestonlineusertime")).ToString("yyyy-MM-dd HH:mm");
			// 得到公告
			announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00");
			announcementcount = announcementlist != null ? announcementlist.Rows.Count : 0;

            List<IndexPageForumInfo> topforum = new List<IndexPageForumInfo>();
            foreach (IndexPageForumInfo f in forumlist)
            {
                if (f.Layer == 0)
                    topforum.Add(f);
            }
        
            taglist = config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0];

            ///得到广告列表
            headerad = Advertisements.GetOneHeaderAd("indexad", 0);
            footerad = Advertisements.GetOneFooterAd("indexad", 0);
            inforumad = Advertisements.GetInForumAd("indexad", 0, topforum, templatepath);
			pagewordad = Advertisements.GetPageWordAd("indexad", 0);
			doublead = Advertisements.GetDoubleAd("indexad", 0);
			floatad = Advertisements.GetFloatAd("indexad", 0);
            mediaad = Advertisements.GetMediaAd(templatepath, "indexad", 0);

            if (userid > 0)
            {
                if (oluserinfo.Newpms < 0)
                    Users.UpdateUserNewPMCount(userid, olid);
                if (oluserinfo.Newnotices < 0)
                    OnlineUsers.UpdateNewNotices(olid, -1 * oluserinfo.Newnotices);
            }
		}
Exemplo n.º 52
0
        /// <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);
        }
Exemplo n.º 53
0
        /// <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;
        }
Exemplo n.º 54
0
 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;
 }
Exemplo n.º 55
0
        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);

        }
Exemplo n.º 56
0
        /// <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;
        }
Exemplo n.º 57
0
        private string condition = ""; //查询条件

        protected override void ShowPage()
        {
            if (userid > 0 && useradminid > 0)
                admingroupinfo = AdminGroups.GetAdminGroupInfo(usergroupid);

            if (config.Rssstatus == 1)
                AddLinkRss("tools/rss.aspx", "最新主题");
            
            #region 版块信息设置
            //当所选论坛为多个时或全部时
            if (forumid == -1)
            {
                //用户点选相应的论坛
                forums = (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("fidlist")) ? DNTRequest.GetString("fidlist") : DNTRequest.GetString("forums")).ToLower();
                //如果是选择全部版块
                if (forums == "all")
                    forums = "";

                if (forums == "")
                {
                    foreach (ForumInfo forumInfo in Forums.GetForumList())
                        forums += string.Format(",{0}", forumInfo.Fid);
                }
                forums = Utils.StrIsNullOrEmpty(forums) ? GetAllowviewForums(forums.Trim(',')) : GetAllowviewForums(forums);
            }

            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            if (forumid > 0)
            {
                forum = Forums.GetForumInfo(forumid);
                pagetitle = Utils.RemoveHtml(forum.Name);
                forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname);
                showforumlogin = ShowForumLogin();

                if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg))
                {
                    AddErrLine(msg);
                    return;
                }
                // 得到子版块列表
                subforumlist = Forums.GetSubForumCollection(forumid, forum.Colcount, config.Hideprivate, usergroupid, config.Moddisplay);
            }
            #endregion

            //设置查询条件
            SetCondition();

            if (IsErr()) return;

            pagetitle = (type == "digest" ? "查看精华" : "查看新帖");

            pmlist = (newpmcount > 0 ? PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1) : null);
            SetPageIdAndNumber();
            topiclist = Topics.GetTopicListByCondition(tpp, pageid, 0, 10, config.Hottopic, forum.Autoclose, forum.Topictypeprefix, condition, GetOrder(), direct);

            OnlineUsers.UpdateAction(olid, UserAction.ShowForum.ActionID, forumid, config.Onlinetimeout);
            ForumUtils.UpdateVisitedForumsOptions(forumid);
        }
Exemplo n.º 58
0
        /// <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;
        }
Exemplo n.º 59
0
        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;
        }
Exemplo n.º 60
0
 /// <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;
 }