Exemple #1
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            int user_id = Convert.ToInt32(txtUserId.Text.ToString());

            modelUser = new DTcms.BLL.users().GetModel(user_id);

            if (modelUser == null)
            {
                JscriptMsg("指定的会员编号不存在!", "");
                return;
            }
            else
            {
                if (action == DTEnums.ActionEnum.Edit.ToString())                            //修改
                {
                    ChkAdminLevel("plugin_forum_topic", DTEnums.ActionEnum.Edit.ToString()); //检查权限
                    if (!DoEdit(this.id))
                    {
                        JscriptMsg("保存过程中发生错误!", "");
                        return;
                    }
                    JscriptMsg("修改信息成功!", "topic_list.aspx");
                }
                else //添加
                {
                    ChkAdminLevel("plugin_forum_topic", DTEnums.ActionEnum.Add.ToString()); //检查权限
                    if (!DoAdd())
                    {
                        JscriptMsg("保存过程中发生错误!", "");
                        return;
                    }
                    JscriptMsg("添加信息成功!", "topic_list.aspx");
                }
            }
        }
Exemple #2
0
        private void ShowInfo(int _id)
        {
            BLL.forum_posts   bll    = new BLL.forum_posts();
            Model.forum_posts model  = bll.GetModel(id);
            DTcms.BLL.users   ubll   = new DTcms.BLL.users();
            DTcms.Model.users umodel = ubll.GetModel(model.user_id);

            ddlCategoryId.SelectedValue = model.board_id.ToString();

            txtUserName.Text     = umodel.user_name;
            txtUserName.ReadOnly = true;
            if (model.is_lock == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.is_top == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.is_red == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.is_hot == 1)
            {
                cblItem.Items[3].Selected = true;
            }

            txtPostName.Text     = model.title;
            txtPostContent.Value = model.content;
        }
Exemple #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session[DTKeys.SESSION_USER_INFO] != null && Session[DTKeys.SESSION_USER_INFO].ToString() != "")
     {
         modelUser = (DTcms.Model.users)Session[DTKeys.SESSION_USER_INFO];
     }
 }
Exemple #4
0
        private bool DoAdd()
        {
            bool result = false;

            BLL.forum_posts   bll    = new BLL.forum_posts();
            Model.forum_posts model  = new Model.forum_posts();
            DTcms.BLL.users   ubll   = new DTcms.BLL.users();
            DTcms.Model.users umodel = new DTcms.Model.users();
            //判断用户名是否存在
            if (!ubll.Exists(txtUserName.Text.Trim()))
            {
                JscriptMsg("用户名不存在,请重新填写!", "");
                return(result);
            }

            umodel = ubll.GetModel(txtUserName.Text.Trim());

            string _userip = System.Web.HttpContext.Current.Request.UserHostAddress;

            model.class_layer    = 1;
            model.title          = txtPostName.Text.Trim();
            model.content        = txtPostContent.Value;
            model.user_id        = umodel.id;
            model.user_ip        = _userip;
            model.board_id       = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.parent_post_id = 0;
            model.post_type      = 1;//主题帖
            model.reply_time     = DateTime.Now;

            model.click   = 0;
            model.is_lock = 0;
            model.is_top  = 0;
            model.is_red  = 0;
            model.is_hot  = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_lock = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.is_top = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.is_red = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.is_hot = 1;
            }
            model.add_time = DateTime.Now;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "发布了帖子:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #5
0
        void forum_Init(object sender, EventArgs e)
        {
            board_id = DTRequest.GetQueryInt("board_id");

            if (board_id > 0) //如果ID获取到,将使用ID
            {
                if (bll.Exists(board_id))
                {
                    model = bll.GetModel(board_id);
                }

                if (board_id > 0)
                {
                    int    bid  = int.Parse(new board().get_category_id(board_id));           //根据子板块ID获取父板块ID
                    string auid = new BLL.forum_board().GetModel(bid).allow_usergroupid_list; //获取父板块访问权限列表
                    auid += ",";
                    string[] mlist = auid.Split(',');
                    int      ugid  = 0;
                    foreach (string item in mlist)      //遍历所有父板块的访问权限
                    {
                        if (item == "" || item == null) //如果父板块访问权限为空当前板块为所有权限
                        {
                            umodel.user_name = "游客";
                            break;
                        }
                        else
                        {
                            if (IsUserLogin()) //判断用户是否登陆
                            {
                                umodel = GetUserInfo();
                                if (item == umodel.group_id.ToString()) //如果父板块访问权限列表等于当前用户的用户组,允许访问
                                {
                                    ugid = 1;
                                    break;
                                }
                                else
                                {
                                    ugid = 2;
                                }
                            }
                            else
                            {
                                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("本板块禁止游客进入!")));
                                break;
                            }
                        }
                    }
                    if (ugid == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("您没有进入本板块的权限!")));
                    }
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("非法进入!")));
                }
            }
        }
        private void ShowInfo(int _id)
        {
            BLL.Forum_UserExtended   bll   = new BLL.Forum_UserExtended();
            Model.Forum_UserExtended model = bll.GetModel(_id);

            modelUser = new DTcms.BLL.users().GetModel(model.UserId);

            //编写赋值操作Begin

            //txtUserId.Text = model.UserId;
            //txtQQ.Text = model.QQ;
            //txtMSN.Text = model.MSN;
            rblGender.SelectedValue = model.Gender.ToString();
            //txtBirthday.Text = model.Birthday;
            //txtBio.Text = model.Bio;
            //txtAddress.Text = model.Address;
            //txtSite.Text = model.Site;
            //txtSignature.Text = model.Signature;
            txtNickname.Text = model.Nickname;
            //txtLastPostDateTime.Text = model.LastPostDateTime;
            ddlGroupId.SelectedValue = model.GroupId.ToString();
            //txtLastActivity.Text = model.LastActivity;
            //txtTopicCount.Text = model.TopicCount;
            //txtPostCount.Text = model.PostCount;
            //txtPostDigestCount.Text = model.PostDigestCount;
            //txtMedal.Text = model.Medal;
            //txtOnlineTime.Text = model.OnlineTime;
            //txtOnlineUpdateTime.Text = model.OnlineUpdateTime;
            //txtVerify.Text = model.Verify;
            //txtHometown.Text = model.Hometown;
            //txtNonlocal.Text = model.Nonlocal;
            //txtSpecialty.Text = model.Specialty;
            txtCredit.Text = model.Credit.ToString();

            if (!string.IsNullOrEmpty(model.Medal))
            {
                List <Model.Forum_Medal> modelList = new BLL.Forum_Medal().GetModelList(" id in (" + model.Medal + ") ");

                medalHtml = "";

                foreach (Model.Forum_Medal item in modelList)
                {
                    medalHtml += "<img <img src='" + item.Image + "' style=' max-width:100px; margin:8px 8px 0px 0px;vertical-align: top;' />";
                }
            }


            //编写赋值操作End
        }
Exemple #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(DTcms.Model.users model)
 {
     return(dal.Update(model));
 }
Exemple #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DTcms.Model.users model)
 {
     return(dal.Add(model));
 }
Exemple #9
0
        void forum_Init(object sender, EventArgs e)
        {
            page    = DTRequest.GetQueryInt("page", 1);
            post_id = DTRequest.GetQueryInt("post_id");

            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)
                {
                    int    bid  = int.Parse(new board().get_category_id(model.board_id));
                    string auid = new BLL.forum_board().GetModel(bid).allow_usergroupid_list;  //获取父板块访问权限列表
                    auid += ",";
                    string[] alist = auid.Split(',');
                    int      ugid  = 0;
                    foreach (string item in alist)
                    {
                        if (item == "" || item == null) //如果父板块访问权限为空当前板块为所有权限
                        {
                            if (IsUserLogin())          //判断用户是否登陆
                            {
                                umodel = GetUserInfo();
                                string moderator = new BLL.forum_board().GetModel(bid).moderator_list;
                                moderator += ",";
                                string[] mlist = moderator.Split(',');
                                foreach (string mitem in mlist)
                                {
                                    if (mitem != "" && mitem == umodel.user_name)
                                    {
                                        is_moderator = 1;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (IsUserLogin()) //判断用户是否登陆
                            {
                                umodel = GetUserInfo();
                                if (item == umodel.group_id.ToString()) //如果父板块访问权限列表等于当前用户的用户组,允许访问
                                {
                                    string moderator = new BLL.forum_board().GetModel(bid).moderator_list;
                                    moderator += ",";
                                    string[] mlist = moderator.Split(',');
                                    foreach (string mitem in mlist)
                                    {
                                        if (mitem != "" && mitem == umodel.user_name)
                                        {
                                            is_moderator = 1;
                                        }
                                    }
                                    ugid = 1;
                                    break;
                                }
                                else
                                {
                                    ugid = 2;
                                }
                            }
                            else
                            {
                                HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("本帖子禁止游客查看!")));
                                break;
                            }
                        }
                    }
                    if (ugid == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("您没有查看本帖子的权限!")));
                    }
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("非法进入!")));
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// 获取当前在线会员
        /// </summary>
        /// <returns></returns>
        public Model.Forum_UserExtended GetOnlineUser()
        {
            DTcms.Model.users model = GetUserInfo();

            if (model != null)
            {
                //论坛扩展当前在线用户是否存在
                if (HttpContext.Current.Session["SESSION_USER_EXTENDED"] != null)
                {
                    modelUserExtended = (Model.Forum_UserExtended)HttpContext.Current.Session["SESSION_USER_EXTENDED"];

                    //论坛与DTcms 是否一致
                    if (modelUserExtended.UserId != model.id)
                    {
                        modelUserExtended = null;
                    }
                }


                if (modelUserExtended == null)
                {
                    modelUserExtended = new BLL.Forum_UserExtended().GetModel(model.id);

                    if (modelUserExtended != null)
                    {
                        //组名提取
                        modelUserExtended.GroupName = new BLL.Forum_Group().GetModel(modelUserExtended.GroupId).Name;
                        modelUserExtended.UserName  = model.user_name;
                    }
                    else
                    {
                        //新增

                        modelUserExtended = new Model.Forum_UserExtended();

                        modelUserExtended.UserId      = model.id;
                        modelUserExtended.UserName    = model.user_name;
                        modelUserExtended.Nickname    = string.IsNullOrEmpty(model.nick_name) ? model.user_name : model.nick_name;
                        modelUserExtended.Birthday    = model.birthday.ToString();
                        modelUserExtended.Credit      = 0;
                        modelUserExtended.CreditTotal = 0;

                        modelUserExtended.Gender = ChangeSex(model.sex);

                        modelUserExtended.QQ               = model.qq;
                        modelUserExtended.Photo            = model.avatar;
                        modelUserExtended.MSN              = model.msn;
                        modelUserExtended.GroupId          = 0;
                        modelUserExtended.OnlineUpdateTime = System.DateTime.Now;
                        modelUserExtended.OnlineTime       = 1;


                        System.Data.DataTable dt = new BLL.Forum_Group().GetList("IsDefault=1").Tables[0];

                        if (dt.Rows.Count != 0)
                        {
                            modelUserExtended.GroupId   = Convert.ToInt32(dt.Rows[0]["id"]);
                            modelUserExtended.GroupName = dt.Rows[0]["Name"].ToString();
                        }

                        new BLL.Forum_UserExtended().Add(modelUserExtended);

                        Model.Statistic.LastUserNickname = string.IsNullOrEmpty(model.nick_name) ? model.user_name : model.nick_name;
                        Model.Statistic.LastUserId       = model.id;
                    }
                }


                int _sex = ChangeSex(model.sex);

                bool bol = false;

                //性别有改动
                if (modelUserExtended.Gender != _sex)
                {
                    modelUserExtended.Gender = _sex;
                    bol = true;
                }

                //昵称有改动
                if (modelUserExtended.Nickname != model.nick_name)
                {
                    if (!string.IsNullOrEmpty(model.nick_name))
                    {
                        modelUserExtended.Nickname = model.nick_name;
                        bol = true;
                    }
                }

                if (bol)
                {
                    new BLL.Forum_UserExtended().Update(modelUserExtended);
                }

                HttpContext.Current.Session["SESSION_USER_EXTENDED"] = modelUserExtended;
            }
            else
            {
                HttpContext.Current.Session["SESSION_USER_EXTENDED"] = null;
                modelUserExtended = null;
            }

            return(modelUserExtended);
        }