Exemplo n.º 1
0
        private void set_lock(HttpContext context)
        {
            //检查用户是否登录
            CMS.Model.users umodel = new CMS.Web.UI.BasePage().GetUserInfo();
            if (umodel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"请登录后再提交!\"}");
                return;
            }

            StringBuilder strTxt = new StringBuilder();

            BLL.forum_posts   bll   = new BLL.forum_posts();
            Model.forum_posts model = new Model.forum_posts();

            int    post_id  = DTRequest.GetFormInt("postid");
            string optip    = DTRequest.GetFormString("optip");
            string opremark = DTRequest.GetFormString("opremark");

            model = bll.GetModel(post_id);


            //检查是否是版主
            if (!IsModerator(model.board_id, umodel.id))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,你无权进行此操作!\"}");
                return;
            }

            string strSet = "is_lock=0";

            if (model.is_lock == 0)
            {
                strSet = "is_lock=1";
            }

            bll.UpdateField(post_id, strSet);

            //发送短信息
            string postusername = new CMS.BLL.users().GetModel(model.user_id).user_name;

            new CMS.BLL.user_message().Add(1, string.Empty, postusername, "您发布的帖子被管理员进行操作", "您的帖子被管理员进行 " + optip + " 操作,原因:" + opremark);

            context.Response.Write("{\"status\": 1, \"msg\": \"恭喜您,操作成功!\"}");
            return;
        }
Exemplo n.º 2
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;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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;
        }