コード例 #1
0
        public static void DeleteForumTopicTypes(string typeidlist)
        {
            string[] array = typeidlist.Split(',');
            SortedList <int, string> sortedList = new SortedList <int, string>();

            sortedList = Caches.GetTopicTypeArray();
            DataTable forumListForDataTable = Forums.GetForumListForDataTable();

            foreach (DataRow dataRow in forumListForDataTable.Rows)
            {
                if (!(dataRow["topictypes"].ToString() == ""))
                {
                    string   text   = dataRow["topictypes"].ToString();
                    string[] array2 = array;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        string text2 = array2[i];
                        text = text.Replace(text2 + "," + sortedList[int.Parse(text2)].ToString() + ",0|", "");
                        text = text.Replace(text2 + "," + sortedList[int.Parse(text2)].ToString() + ",1|", "");
                        Discuz.Data.Topics.ClearTopicType(int.Parse(text2));
                    }
                    ForumInfo forumInfo = Forums.GetForumInfo(int.Parse(dataRow["fid"].ToString()));
                    forumInfo.Topictypes = text;
                    AdminForums.UpdateForumInfo(forumInfo);
                }
            }
        }
コード例 #2
0
ファイル: AdminForums.cs プロジェクト: terryxym/DiscuzNT
        /// <summary>
        /// 移动论坛版块
        /// </summary>
        /// <param name="currentfid">当前论坛版块id</param>
        /// <param name="targetfid">目标论坛版块id</param>
        /// <param name="isaschildnode">是否作为子论坛移动</param>
        /// <returns></returns>
        public static bool MovingForumsPos(string currentfid, string targetfid, bool isaschildnode)
        {
            string extname = GeneralConfigs.Deserialize(Utils.GetMapPath(BaseConfigs.GetForumPath + "config/general.config")).Extname;

            Discuz.Data.Forums.MovingForumsPos(currentfid, targetfid, isaschildnode, extname);
            AdminForums.SetForumslayer();
            AdminForums.SetForumsSubForumCountAndDispalyorder();
            AdminForums.SetForumsPathList();

            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/ForumListBoxOptions");
            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList");

            return(true);
        }
コード例 #3
0
ファイル: AdminForums.cs プロジェクト: object8421/ichari
        /// <summary>
        /// 移动论坛版块
        /// </summary>
        /// <param name="currentfid">当前论坛版块id</param>
        /// <param name="targetfid">目标论坛版块id</param>
        /// <param name="isaschildnode">是否作为子论坛移动</param>
        /// <returns></returns>
        public static bool MovingForumsPos(string currentfid, string targetfid, bool isaschildnode)
        {
            string extname = GeneralConfigs.Deserialize(AppDomain.CurrentDomain.BaseDirectory + "/config/general.config").Extname;

            DatabaseProvider.GetInstance().MovingForumsPos(currentfid, targetfid, isaschildnode, extname);
            AdminForums.SetForumslayer();
            AdminForums.SetForumsSubForumCountAndDispalyorder();
            AdminForums.SetForumsPathList();

            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/UI/ForumListBoxOptions");
            Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/ForumList");

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// 更新父版块最后发帖信息
        /// </summary>
        /// <param name="foruminfo"></param>
        /// <param name="postinfo"></param>
        private static void UpdateParentForumLastPost(ForumInfo foruminfo, PostInfo postinfo)
        {
            int parentFid = Utils.StrToInt(foruminfo.Parentidlist.Split(',')[1], 0);//去parentidlist属性split后的第一个数组元素,因为第0个是分类

            if (parentFid > 0)
            {
                string fidList = "";

                //获取到游客可以访问到的版块fidlist
                foreach (string fid in AdminForums.FindChildNode(parentFid.ToString()).Split(','))
                {
                    if (fid == "0")
                    {
                        continue;
                    }
                    foreach (DataRow dr in Forums.GetOpenForumList().Rows)
                    {
                        if (dr["fid"].ToString().Trim() == fid.Trim())
                        {
                            fidList += fid + ",";
                            break;
                        }
                    }
                }
                if (string.IsNullOrEmpty(fidList))
                {
                    return;
                }

                int forumsTid = Data.Forums.GetForumsLastPostTid(fidList.TrimEnd(','));

                if (forumsTid > 0)
                {
                    postinfo = Discuz.Data.Posts.GetLastPostByTid(forumsTid, PostTables.GetPostTableName(forumsTid));
                }
                else
                {
                    postinfo.Pid          = postinfo.Tid = 0;
                    postinfo.Title        = postinfo.Topictitle = "从未";
                    postinfo.Postdatetime = "1900-1-1";
                    postinfo.Poster       = "";
                    postinfo.Posterid     = 0;
                }
                Discuz.Data.Forums.UpdateForumLastPost(GetForumInfo(parentFid), postinfo);
            }
        }
コード例 #5
0
ファイル: TopicTypes.cs プロジェクト: terryxym/DiscuzNT
        /// <summary>
        /// 删除所选的主题分类
        /// </summary>
        /// <param name="typeidlist"></param>
        public static void DeleteForumTopicTypes(string typeidlist)
        {
            //取得ID的数组
            string[] ids = typeidlist.Split(',');

            //取得主题分类的缓存
            Discuz.Common.Generic.SortedList <int, string> topictypearray = new Discuz.Common.Generic.SortedList <int, string>();
            topictypearray = Caches.GetTopicTypeArray();

            //取得版块的fid,topictypes字段

            DataTable dt = Forums.GetForumListForDataTable();

            //处理每一个版块
            foreach (DataRow dr in dt.Rows)
            {
                //如果版块的主题分类字段为空(topictypes==""),则处理下一个
                if (dr["topictypes"].ToString() == "")
                {
                    continue;
                }

                string topictypes = dr["topictypes"].ToString();
                //处理每一个要删除的ID
                foreach (string id in ids)
                {
                    //将删除的ID拼成相应的格式串后,将原来的剔除掉,形成一个新的主题分类的字段
                    topictypes = topictypes.Replace(id + "," + topictypearray[Int32.Parse(id)].ToString() + ",0|", "");
                    topictypes = topictypes.Replace(id + "," + topictypearray[Int32.Parse(id)].ToString() + ",1|", "");
                    //将帖子列表(dnt_topics)中typeid为当前要删除的Id更新为0
                    Data.Topics.ClearTopicType(int.Parse(id));
                }
                //用剔除了要删除的主题ID的主题列表值更新数据库
                ForumInfo forumInfo = Forums.GetForumInfo(int.Parse(dr["fid"].ToString()));
                forumInfo.Topictypes = topictypes;
                AdminForums.UpdateForumInfo(forumInfo);
            }
        }