Exemple #1
0
 public string get_user_name(int userid)
 {
     CMS.Model.users model = new CMS.BLL.users().GetModel(userid);
     if (model == null)
     {
         return("-");
     }
     return(model.user_name);
 }
Exemple #2
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;
        }
Exemple #3
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);
        }
Exemple #4
0
        private void del(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();
            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;
            }

            if (bll.Delete(post_id))
            {
                //发送短信息
                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;
            }
            context.Response.Write("{\"status\": 0, \"msg\": \"对不起,保存过程中发生错误!\"}");
            return;
        }
Exemple #5
0
 public CMS.Model.users get_user_model(int userid)
 {
     CMS.Model.users model = new CMS.BLL.users().GetModel(userid);
     return(model);
 }