Exemplo n.º 1
0
 private void SaveUserInfo_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         int    @int = DNTRequest.GetInt("uid", -1);
         string text = "";
         if (!this.AllowEditUserInfo(@int, true))
         {
             return;
         }
         if (this.userName.Text != this.ViewState["username"].ToString() && Users.GetUserId(this.userName.Text) > 0)
         {
             base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
             return;
         }
         if (this.userName.Text == "")
         {
             base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
             return;
         }
         if (this.groupid.SelectedValue == "0")
         {
             base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
             return;
         }
         this.userInfo             = Users.GetUserInfo(@int);
         this.userInfo.Name        = this.userName.Text;
         this.userInfo.NickName    = this.nickname.Text;
         this.userInfo.AccessMasks = Convert.ToInt32(this.accessmasks.SelectedValue);
         if (this.userInfo.GroupID.ToString() != this.groupid.SelectedValue)
         {
             this.userInfo.AdminID = UserGroup.FindByID(int.Parse(this.groupid.SelectedValue)).RadminID;
         }
         if (this.bday.Text == "0000-00-00" || (this.bday.Text == "0000-0-0" | this.bday.Text.Trim() == ""))
         {
             this.userInfo.Bday = "";
         }
         else
         {
             if (!Utils.IsDateString(this.bday.Text.Trim()))
             {
                 base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                 return;
             }
             this.userInfo.Bday = this.bday.Text;
         }
         if (!Users.ValidateEmail(this.email.Text, @int))
         {
             base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
             return;
         }
         this.userInfo.Email       = this.email.Text;
         this.userInfo.Gender      = Convert.ToInt32(this.gender.SelectedValue);
         this.userInfo.GroupExpiry = 0;
         this.userInfo.ExtGroupIds = this.extgroupids.GetSelectString(",");
         if (this.groupid.SelectedValue != "1" && this.userInfo.ID == BaseConfigs.GetFounderUid)
         {
             base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + Request["uid"] + "';</script>");
             return;
         }
         this.userInfo.GroupID      = Convert.ToInt32(this.groupid.SelectedValue);
         this.userInfo.Invisible    = Convert.ToInt32(this.invisible.SelectedValue);
         this.userInfo.JoinDate     = DateTime.Parse(this.joindate.Text);
         this.userInfo.LastActivity = DateTime.Parse(this.lastactivity.Text);
         this.userInfo.LastIP       = this.lastip.Text;
         this.userInfo.LastPost     = DateTime.Parse(this.lastpost.Text);
         this.userInfo.LastVisit    = DateTime.Parse(this.lastvisit.Text);
         this.userInfo.Newpm        = Convert.ToInt32(this.newpm.SelectedValue);
         //this.userInfo.NewsLetter = (ReceivePMSettingType)this.GetNewsLetter();
         this.userInfo.NewsLetter  = this.GetNewsLetter();
         this.userInfo.OLTime      = Convert.ToInt32(this.oltime.Text);
         this.userInfo.PageViews   = Convert.ToInt32(this.pageviews.Text);
         this.userInfo.Pmsound     = Convert.ToInt32(this.pmsound.Text);
         this.userInfo.Posts       = Convert.ToInt32(this.posts.Text);
         this.userInfo.Ppp         = Convert.ToInt32(this.ppp.Text);
         this.userInfo.RegIP       = this.regip.Text;
         this.userInfo.DigestPosts = Convert.ToInt32(this.digestposts.Text);
         if (this.secques.SelectedValue == "1")
         {
             this.userInfo.Secques = "";
         }
         this.userInfo.ShowEmail  = Convert.ToInt32(this.showemail.SelectedValue);
         this.userInfo.Sigstatus  = Convert.ToInt32(this.sigstatus.SelectedValue);
         this.userInfo.TemplateID = Convert.ToInt32(this.templateid.SelectedValue);
         this.userInfo.Tpp        = Convert.ToInt32(this.tpp.Text);
         if (!Utils.IsNumeric(this.extcredits1.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits1 = float.Parse(this.extcredits1.Text);
         if (!Utils.IsNumeric(this.extcredits2.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits2 = float.Parse(this.extcredits2.Text);
         if (!Utils.IsNumeric(this.extcredits3.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits3 = float.Parse(this.extcredits3.Text);
         if (!Utils.IsNumeric(this.extcredits4.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits4 = float.Parse(this.extcredits4.Text);
         if (!Utils.IsNumeric(this.extcredits5.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits5 = float.Parse(this.extcredits5.Text);
         if (!Utils.IsNumeric(this.extcredits6.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits6 = float.Parse(this.extcredits6.Text);
         if (!Utils.IsNumeric(this.extcredits7.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits7 = float.Parse(this.extcredits7.Text);
         if (!Utils.IsNumeric(this.extcredits8.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits8 = float.Parse(this.extcredits8.Text);
         this.userInfo.Credits     = CreditsFacade.GetUserCreditsByUserInfo(this.userInfo);
         //if (UserGroups.IsCreditUserGroup(this.userInfo.GroupID))
         if (userInfo.Group.IsCreditUserGroup)
         {
             var g = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits);
             this.userInfo.GroupID = g.ID;
             userInfo.Group        = g;
         }
         var uf = userInfo.Field;
         uf.Website      = this.website.Text;
         uf.Icq          = this.icq.Text;
         uf.qq           = this.qq.Text;
         uf.Yahoo        = this.yahoo.Text;
         uf.Msn          = this.msn.Text;
         uf.Skype        = this.skype.Text;
         uf.Location     = this.location.Text;
         uf.Customstatus = this.customstatus.Text;
         uf.Bio          = this.bio.Text;
         if (this.signature.Text.Length > userInfo.Group.MaxSigSize)
         {
             text = "更新的签名长度超过 " + userInfo.Group.MaxSigSize + " 字符的限制,未能更新。";
         }
         else
         {
             uf.Signature = this.signature.Text;
             PostpramsInfo postpramsInfo = new PostpramsInfo();
             postpramsInfo.Showimages = userInfo.Group.AllowSigimgCode ? 1 : 0;
             postpramsInfo.Sdetail    = this.signature.Text;
             uf.Sightml = UBB.UBBToHTML(postpramsInfo);
         }
         uf.RealName = this.realname.Text;
         uf.Idcard   = this.idcard.Text;
         uf.Mobile   = this.mobile.Text;
         uf.Phone    = this.phone.Text;
         uf.Medals   = Request["medalid"];
         if (this.IsEditUserName.Checked && this.userName.Text != this.ViewState["username"].ToString())
         {
             throw new NotImplementedException("UserNameChange");
             //AdminUsers.UserNameChange(this.userInfo, this.ViewState["username"].ToString());
             Sync.RenameUser(this.userInfo.ID, this.ViewState["username"].ToString(), this.userInfo.Name, "");
         }
         if (userInfo.Save() > 0)
         {
             OnlineUsers.DeleteUserByUid(this.userInfo.ID);
             if (this.ViewState["GroupID"].ToString() != this.userInfo.GroupID.ToString())
             {
                 if (this.userInfo.GroupID == 4)
                 {
                     if (AlbumPluginProvider.GetInstance() != null)
                     {
                         AlbumPluginProvider.GetInstance().Ban(this.userInfo.ID);
                     }
                     if (SpacePluginProvider.GetInstance() != null)
                     {
                         SpacePluginProvider.GetInstance().Ban(this.userInfo.ID);
                     }
                 }
                 else
                 {
                     if (AlbumPluginProvider.GetInstance() != null)
                     {
                         AlbumPluginProvider.GetInstance().UnBan(this.userInfo.ID);
                     }
                     if (SpacePluginProvider.GetInstance() != null)
                     {
                         SpacePluginProvider.GetInstance().UnBan(this.userInfo.ID);
                     }
                 }
             }
             if (this.delavart.Checked)
             {
                 Avatars.DeleteAvatar(this.userInfo.ID.ToString());
             }
             AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + this.userName.Text);
             if (text == "")
             {
                 base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
                 return;
             }
             base.RegisterStartupScript("PAGE", "alert('" + text + "');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
             return;
         }
         else
         {
             base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';</script>");
         }
     }
 }
Exemplo n.º 2
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                foreach (DictionaryEntry dictionaryEntry in new Hashtable
                {
                    {
                        "附件最大尺寸",
                        this.maxattachsize.Text
                    },

                    {
                        "每天最大附件总尺寸",
                        this.maxsizeperday.Text
                    },

                    {
                        "个人空间附件总尺寸",
                        this.maxspaceattachsize.Text
                    },

                    {
                        "相册空间总尺寸",
                        this.maxspacephotosize.Text
                    }
                })
                {
                    if (!Utils.IsInt(dictionaryEntry.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + dictionaryEntry.Key.ToString() + "只能是0或者正整数');window.location.href='global_editusergroup.aspx';</script>");
                        return;
                    }
                }
                if (this.creditshigher.Enabled && (Convert.ToInt32(this.creditshigher.Text) < Convert.ToInt32(this.ViewState["creditshigher"].ToString()) || Convert.ToInt32(this.creditslower.Text) > Convert.ToInt32(this.ViewState["creditslower"].ToString())))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败, 您所输入的积分上下限范围应在" + this.ViewState["creditshigher"].ToString() + "至" + this.ViewState["creditslower"].ToString() + "之间');</script>");
                }
                else
                {
                    this.userGroupInfo            = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
                    this.userGroupInfo.System     = 0;
                    this.userGroupInfo.Type       = 0;
                    this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text);
                    this.usergrouppowersetting.GetSetting(ref this.userGroupInfo);
                    this.userGroupInfo.GroupTitle    = this.groupTitle.Text;
                    this.userGroupInfo.Creditshigher = Convert.ToInt32(this.creditshigher.Text);
                    this.userGroupInfo.Creditslower  = Convert.ToInt32(this.creditslower.Text);
                    if (this.userGroupInfo.Creditshigher >= this.userGroupInfo.Creditslower)
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败, 积分下限必须小于积分上限');</script>");
                        return;
                    }
                    if (this.userGroupInfo.AllowBonus && this.userGroupInfo.MinBonusprice >= this.userGroupInfo.MaxBonusprice)
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>");
                        return;
                    }
                    this.userGroupInfo.Stars              = Convert.ToInt32(this.stars.Text);
                    this.userGroupInfo.Color              = this.color.Text;
                    this.userGroupInfo.Groupavatar        = this.groupavatar.Text;
                    this.userGroupInfo.MaxPrice           = Convert.ToInt32(this.maxprice.Text);
                    this.userGroupInfo.MaxPmNum           = Convert.ToInt32(this.maxpmnum.Text);
                    this.userGroupInfo.MaxSigSize         = Convert.ToInt32(this.maxsigsize.Text);
                    this.userGroupInfo.MaxAttachSize      = Convert.ToInt32(this.maxattachsize.Text);
                    this.userGroupInfo.MaxSizeperday      = Convert.ToInt32(this.maxsizeperday.Text);
                    this.userGroupInfo.MaxSpaceattachSize = Convert.ToInt32(this.maxspaceattachsize.Text);
                    this.userGroupInfo.MaxSpacephotoSize  = Convert.ToInt32(this.maxspacephotosize.Text);
                    this.userGroupInfo.AttachExtensions   = this.attachextensions.GetSelectString(",");
                    //if (AdminUserGroups.UpdateUserGroupInfo(this.userGroupInfo))
                    userGroupInfo.Save();
                    {
                        DNTCache.Current.RemoveObject(CacheKeys.FORUM_USER_GROUP_LIST);
                        UserGroup.FindAllWithCache();
                        AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新用户组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';");
                        return;
                    }
                    if (AdminUserGroups.opresult != "")
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupgrid.aspx';</script>");
                        return;
                    }
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>");
                    return;
                }
                return;
            }
        }
Exemplo n.º 3
0
        private User CreateUserInfo()
        {
            User user = new User();

            user.Name     = this.userName.Text;
            user.NickName = this.userName.Text;
            user.Password = this.password.Text;
            user.Secques  = "";
            user.Gender   = 0;
            int num = Convert.ToInt32(this.groupid.SelectedValue);

            user.AdminID       = UserGroup.FindByID(num).RadminID;
            user.GroupID       = num;
            user.JoinDate      = DateTime.Now;
            user.LastIP        = "";
            user.LastVisit     = DateTime.Now;
            user.LastActivity  = DateTime.Now;
            user.LastPost      = DateTime.Now;
            user.LastPostID    = 0;
            user.LastPostTitle = "";
            user.Posts         = 0;
            user.DigestPosts   = 0;
            user.OLTime        = 0;
            user.PageViews     = 0;
            user.Credits       = Convert.ToInt32(this.credits.Text);
            user.ExtCredits1   = 0f;
            user.ExtCredits2   = 0f;
            user.ExtCredits3   = 0f;
            user.ExtCredits4   = 0f;
            user.ExtCredits5   = 0f;
            user.ExtCredits6   = 0f;
            user.ExtCredits7   = 0f;
            user.ExtCredits8   = 0f;
            user.Salt          = "0";
            user.Email         = this.email.Text;
            user.Bday          = "";
            user.Sigstatus     = 0;
            user.TemplateID    = GeneralConfigInfo.Current.Templateid;
            user.Tpp           = 16;
            user.Ppp           = 16;
            user.Pmsound       = 1;
            user.ShowEmail     = 1;
            user.NewsLetter    = (Int32)ReceivePMSettingType.ReceiveAllPMWithHint;
            user.Invisible     = 0;
            user.Newpm         = 0;
            user.AccessMasks   = 0;

            var uf = user.Field;

            uf.Website      = "";
            uf.Icq          = "";
            uf.qq           = "";
            uf.Yahoo        = "";
            uf.Msn          = "";
            uf.Skype        = "";
            uf.Location     = "";
            uf.Customstatus = "";
            uf.Medals       = "";
            uf.Bio          = "";
            uf.Signature    = this.userName.Text;
            uf.Sightml      = "";
            uf.Authstr      = "";
            uf.RealName     = this.realname.Text;
            uf.Idcard       = this.idcard.Text;
            uf.Mobile       = this.mobile.Text;
            uf.Phone        = this.phone.Text;
            return(user);
        }
Exemplo n.º 4
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                foreach (DictionaryEntry dictionaryEntry in new Hashtable
                {
                    {
                        "附件最大尺寸",
                        this.maxattachsize.Text
                    },

                    {
                        "每天最大附件总尺寸",
                        this.maxsizeperday.Text
                    },

                    {
                        "个人空间附件总尺寸",
                        this.maxspaceattachsize.Text
                    },

                    {
                        "相册空间总尺寸",
                        this.maxspacephotosize.Text
                    }
                })
                {
                    if (!Utils.IsInt(dictionaryEntry.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + dictionaryEntry.Key.ToString() + "只能是0或者正整数');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                        return;
                    }
                }
                this.userGroupInfo            = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
                this.userGroupInfo.System     = 0;
                this.userGroupInfo.Type       = 0;
                this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text);
                int num = (this.radminid.SelectedValue == "0") ? -1 : Convert.ToInt32(this.radminid.SelectedValue);
                this.userGroupInfo.RadminID = num;
                if (num.ToString() != this.ViewState["radminid"].ToString())
                {
                    Users.UpdateUserAdminIdByGroupId(this.userGroupInfo.RadminID, this.userGroupInfo.ID);
                }
                this.userGroupInfo.GroupTitle         = this.groupTitle.Text;
                this.userGroupInfo.Stars              = Convert.ToInt32(this.stars.Text);
                this.userGroupInfo.Color              = this.color.Text;
                this.userGroupInfo.Groupavatar        = this.groupavatar.Text;
                this.userGroupInfo.MaxPrice           = Convert.ToInt32(this.maxprice.Text);
                this.userGroupInfo.MaxPmNum           = Convert.ToInt32(this.maxpmnum.Text);
                this.userGroupInfo.MaxSigSize         = Convert.ToInt32(this.maxsigsize.Text);
                this.userGroupInfo.MaxAttachSize      = Convert.ToInt32(this.maxattachsize.Text);
                this.userGroupInfo.MaxSizeperday      = Convert.ToInt32(this.maxsizeperday.Text);
                this.userGroupInfo.MaxSpaceattachSize = Convert.ToInt32(this.maxspaceattachsize.Text);
                this.userGroupInfo.MaxSpacephotoSize  = Convert.ToInt32(this.maxspacephotosize.Text);
                this.userGroupInfo.AttachExtensions   = this.attachextensions.GetSelectString(",");
                this.usergrouppowersetting.GetSetting(ref this.userGroupInfo);
                //if (AdminUserGroups.UpdateUserGroupInfo(this.userGroupInfo))
                userGroupInfo.Save();
                {
                    DNTCache.Current.RemoveObject(CacheKeys.FORUM_USER_GROUP_LIST);
                    UserGroup.FindAllWithCache();
                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除特殊用户组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                    base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';");
                    return;
                }
                if (AdminUserGroups.opresult != "")
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                    return;
                }
                base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>");
            }
        }