예제 #1
0
        /// <summary>
        /// 获取所有板块列表
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        public DataTable get_board_list()
        {
            DataTable dt = new DataTable();

            dt = new BLL.forum_board().GetAllList(0);
            return(dt);
        }
예제 #2
0
        public string get_board_name(int board__id)
        {
            string boardname = "所有主题";

            if (new BLL.forum_board().GetBoardName(board__id) != "")
            {
                boardname = new BLL.forum_board().GetBoardName(board__id);
            }
            return(boardname);
        }
예제 #3
0
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            action   = DTRequest.GetQueryString("action");
            board_id = DTRequest.GetQueryInt("board_id");
            post_id  = DTRequest.GetQueryInt("post_id");

            if (action == "edit")
            {
                Model.forum_posts post = new BLL.forum_posts().GetModel(post_id);


                //判断是否是斑竹
                string moderator = new BLL.forum_board().GetModel(board_id).moderator_list;
                moderator += ",";
                string[] mlist = moderator.Split(',');
                foreach (string item in mlist)
                {
                    if (item != "" && item == userModel.user_name)
                    {
                        is_moderator = 1;
                    }
                }

                //如不是斑竹,判断是否是该用户的帖子
                if (is_moderator == 0)
                {
                    if (userModel.id != post.user_id)
                    {
                        Response.End();
                    }
                }

                title    = post.title;
                content  = post.content;
                board_id = post.board_id;
                post_id  = post.id;
            }


            rurl = linkurl("forumpostlist", board_id);
            if (HttpContext.Current.Request.Url != null && HttpContext.Current.Request.UrlReferrer != null)
            {
                string currUrl = HttpContext.Current.Request.Url.ToString().ToLower();         //当前页面
                string refUrl  = HttpContext.Current.Request.UrlReferrer.ToString().ToLower(); //上一页面
                string regPath = linkurl("register").ToLower();                                //注册页面
                if (currUrl != refUrl && refUrl.IndexOf(regPath) == -1)
                {
                    rurl = HttpContext.Current.Request.UrlReferrer.ToString();
                }
            }
        }
예제 #4
0
 protected Model.forum_board model = new Model.forum_board(); //分类的实体
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     page     = DTRequest.GetQueryInt("page", 1);
     board_id = DTRequest.GetQueryInt("board_id");
     BLL.forum_board bll = new BLL.forum_board();
     model.boardname = "全部帖子";
     if (board_id > 0) //如果ID获取到,将使用ID
     {
         if (bll.Exists(board_id))
         {
             model = bll.GetModel(board_id);
         }
     }
 }
예제 #5
0
        //判断是否是版主
        public bool IsModerator(int boardid, int userid)
        {
            bool is_moderator = false;

            Model.forum_board bmodel = new Model.forum_board();
            bmodel = new BLL.forum_board().GetModel(boardid);

            CMS.Model.users umodel = new CMS.BLL.users().GetModel(userid);

            string[] mlist = bmodel.moderator_list.Split(',');
            foreach (string item in mlist)
            {
                if (item != "" && item == umodel.user_name)
                {
                    is_moderator = true;
                }
            }
            return(is_moderator);
        }
예제 #6
0
        void forum_Init(object sender, EventArgs e)
        {
            umodel.user_name = "游客";

            if (IsUserLogin())
            {
                umodel = GetUserInfo();
            }
            page    = DTRequest.GetQueryInt("page", 1);
            post_id = DTRequest.GetQueryInt("post_id");
            BLL.forum_posts bll = new BLL.forum_posts();

            if (post_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(post_id))
                {
                    model = bll.GetModel(post_id);
                }
                bll.UpdateField(post_id, "click=click+1");


                if (model.board_id > 0)
                {
                    string moderator = new BLL.forum_board().GetModel(model.board_id).moderator_list;
                    moderator += ",";
                    string[] mlist = moderator.Split(',');
                    foreach (string item in mlist)
                    {
                        if (item != "" && item == umodel.user_name)
                        {
                            is_moderator = 1;
                        }
                    }
                }
            }
        }
예제 #7
0
        private void move(HttpContext context)
        {
            //检查用户是否登录
            CMS.Model.users umodel = new CMS.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再操作!\"}");
                return;
            }
            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();

            BLL.forum_board   bbll   = new BLL.forum_board();
            Model.forum_board bmodel = new Model.forum_board();

            int    post_id    = DTRequest.GetFormInt("postid");
            int    to_boardid = DTRequest.GetFormInt("toboardid");
            string opremark   = DTRequest.GetString("opremark");

            if (post_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"参数不正确!\"}");
                return;
            }
            model = bll.GetModel(post_id);
            if (model.parent_post_id != 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"非主题贴不可移动!\"}");
                return;
            }

            int postcount  = 0;
            int replycount = 0;
            int oldboardid = model.board_id;


            //检查是否是版主
            if (!IsModerator(model.board_id, umodel.id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"当前用户无权执行此操作!\"}");
                return;
            }


            DataTable dt = bll.GetList(0, "id=" + post_id + " or parent_post_id=" + post_id, "id desc").Tables[0];


            foreach (DataRow dr in dt.Rows)
            {
                if (int.Parse(dr["parent_post_id"].ToString()) == 0)
                {
                    postcount += 1;
                }
                else
                {
                    replycount += 1;
                }
                bll.UpdateField(int.Parse(dr["id"].ToString()), "board_id=" + to_boardid);
            }

            bmodel = bbll.GetModel(oldboardid);
            bmodel.subject_count -= postcount;
            bmodel.post_count    -= replycount;
            bbll.Update(bmodel);

            bmodel = bbll.GetModel(to_boardid);
            bmodel.subject_count += postcount;
            bmodel.post_count    += replycount;
            bbll.Update(bmodel);


            context.Response.Write("{\"status\": 1, \"msg\": \"恭喜你,移动主题成功!\"}");
            return;
        }