private void DelUserInfo_Click(object sender, EventArgs e) { if (base.CheckCookie()) { int uid = DNTRequest.GetInt("uid", -1); if (this.AllowDeleteUser(this.userid, uid)) { bool delposts = this.deltype.SelectedValue.IndexOf("1") < 0; bool delpms = this.deltype.SelectedValue.IndexOf("2") < 0; User user = XUser.FindByID(uid); if (user.Delete(delposts, delpms)) { Sync.DeleteUsers(uid.ToString(), ""); Avatars.DeleteAvatar(uid.ToString()); XForum.UpdateForumsFieldModerators(this.userName.Text); Online.DeleteUserByUid(this.userInfo.ID); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:" + this.userName.Text); base.RegisterStartupScript("PAGE", "window.location.href='usergrid.aspx?condition=" + Request["condition"] + "';"); return; } base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='usergrid.aspx?condition=" + Request["condition"] + "';</script>"); return; } else { base.RegisterStartupScript("", "<script>alert('操作失败,你要删除的用户是创始人用户或是其它管理员,因此不能删除!');window.location.href='usergrid.aspx?condition=" + Request["condition"] + "';</script>"); } } }
private void StopTalk_Click(object sender, EventArgs e) { if (Request["uid"] != "") { string text = "0" + Request["uid"]; string[] array = text.Split(','); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string s = array2[i]; int num = int.Parse(s); if (num != 0) { Online.DeleteUserByUid(num); } } Users.UpdateUserToStopTalkGroup(text); base.RegisterStartupScript("PAGE", "window.location.href='usergrid.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location.href='usergrid.aspx';</script>"); }
private void StopTalk_Click(object sender, EventArgs e) { if (base.CheckCookie()) { this.userInfo = Users.GetUserInfo(DNTRequest.GetInt("uid", -1)); //if (!this.AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true)) //{ // return; //} if (this.ViewState["GroupID"].ToString() != "4") { if (this.userInfo.ID > 1) { Users.UpdateUserToStopTalkGroup(this.userInfo.ID.ToString()); base.RegisterStartupScript("PAGE", "window.location.href='edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>"); } } else { if (CreditsFacade.GetCreditsUserGroupId(0f) != null) { int groupId = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits).ID; //Users.UpdateUserGroup(this.userInfo.ID, groupId); userInfo.GroupID = groupId; userInfo.Save(); base.RegisterStartupScript("PAGE", "window.location.href='edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>"); } } Online.DeleteUserByUid(this.userInfo.ID); } }
protected override void ShowPage() { this.pagetitle = "用户控制面板"; if (!base.IsLogin()) { return; } var uid = userid; if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } this.ValidateInfo(); if (base.IsErr()) { return; } if (this.page_err == 0) { var userInfo = Users.GetUserInfo(uid); //var userInfo2 = (User)userInfo.Clone(); var uf = userInfo.Field; this.sig = userInfo.Field.Sightml; //userInfo.ID = uid; userInfo.Name = this.username; userInfo.NickName = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname"))); userInfo.Gender = DNTRequest.GetInt("gender", 0); uf.RealName = DNTRequest.GetHtmlEncodeString("realname"); uf.Idcard = DNTRequest.GetHtmlEncodeString("idcard"); uf.Mobile = DNTRequest.GetHtmlEncodeString("mobile"); uf.Phone = DNTRequest.GetHtmlEncodeString("phone"); var email = DNTRequest.GetHtmlEncodeString("email").Trim().ToLower(); if (email != userInfo.Email && !Users.ValidateEmail(email, userInfo.ID)) { base.AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用"); return; } userInfo.Email = email; userInfo.Bday = DNTRequest.GetHtmlEncodeString("bday"); userInfo.ShowEmail = DNTRequest.GetInt("showemail", 1) != 0; if (DNTRequest.GetString("website").IndexOf(".") > -1 && !DNTRequest.GetString("website").ToLower().StartsWith("http")) { uf.Website = Utils.HtmlEncode("http://" + DNTRequest.GetString("website")); } else { uf.Website = DNTRequest.GetHtmlEncodeString("website"); } uf.Icq = DNTRequest.GetHtmlEncodeString("icq"); uf.qq = DNTRequest.GetHtmlEncodeString("qq"); uf.Yahoo = DNTRequest.GetHtmlEncodeString("yahoo"); uf.Msn = DNTRequest.GetHtmlEncodeString("msn"); uf.Skype = DNTRequest.GetHtmlEncodeString("skype"); uf.Location = DNTRequest.GetHtmlEncodeString("location"); uf.Bio = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("bio")); var postpramsInfo = new PostpramsInfo(); postpramsInfo.Usergroupid = this.usergroupid; postpramsInfo.Attachimgpost = this.config.Attachimgpost; postpramsInfo.Showattachmentpath = this.config.Showattachmentpath; postpramsInfo.Hide = 0; postpramsInfo.Price = 0; postpramsInfo.Sdetail = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("signature")); postpramsInfo.Smileyoff = 1; postpramsInfo.BBCode = this.usergroupinfo.AllowSigbbCode; postpramsInfo.Parseurloff = 1; postpramsInfo.Showimages = this.usergroupinfo.AllowSigimgCode ? 1 : 0; postpramsInfo.Allowhtml = 0; postpramsInfo.Signature = 1; postpramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo(); postpramsInfo.Customeditorbuttoninfo = null; postpramsInfo.Smiliesmax = this.config.Smiliesmax; postpramsInfo.Signature = 1; uf.Sightml = UBB.UBBToHTML(postpramsInfo); if (this.sig != uf.Sightml) { Sync.UpdateSignature(userInfo.ID, userInfo.Name, uf.Sightml, ""); } if (uf.Sightml.Length >= 1000) { base.AddErrLine("您的签名转换后超出系统最大长度, 请返回修改"); return; } uf.Signature = postpramsInfo.Sdetail; userInfo.Sigstatus = ((DNTRequest.GetInt("sigstatus", 0) != 0) ? 1 : 0); //throw new NotImplementedException("CheckModified"); ////if (this.CheckModified(userInfo, userInfo2)) //{ // //Users.UpdateUserProfile(userInfo2); // Sync.UpdateProfile(userInfo.ID, userInfo.Name, ""); //} userInfo.Save(); Sync.UpdateProfile(userInfo.ID, userInfo.Name, ""); Online.DeleteUserByUid(userInfo.ID); ForumUtils.WriteCookie("sigstatus", userInfo.Sigstatus.ToString()); base.SetUrl("usercpprofile.aspx"); base.SetMetaRefresh(); base.SetShowBackLink(true); base.AddMsgLine("修改个人档案完毕"); return; } } else { this.pagename += ((String.IsNullOrEmpty(this.action)) ? "" : ("?action=" + this.action)); var userInfo3 = Users.GetUserInfo(uid); this.avatarFlashParam = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "images/common/camera.swf?nt=1&inajax=1&appid=" + (Utils.MD5(userInfo3.Name + userInfo3.Password + userInfo3.ID + this.olid)) + "&input=" + (DES.Encode(uid + "," + this.olid, this.config.Passwordkey)) + "&ucapi=" + (Utils.UrlEncode(Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/ajax.ashx")); this.avatarImage = Avatars.GetAvatarUrl(uid); } }
private void SaveUserInfo_Click(object sender, EventArgs e) { if (base.CheckCookie()) { int uid = 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(uid); this.userInfo.Name = this.userName.Text; this.userInfo.NickName = this.nickname.Text; this.userInfo.AccessMasks = Utility.ToInt(this.accessmasks.SelectedValue, 0); 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 (!String.IsNullOrEmpty(email.Text) && !Users.ValidateEmail(this.email.Text, uid)) { base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>"); return; } this.userInfo.Email = this.email.Text; this.userInfo.Gender = Utility.ToInt(this.gender.SelectedValue, 0); 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='edituser.aspx?uid=" + Request["uid"] + "';</script>"); return; } this.userInfo.GroupID = Utility.ToInt(this.groupid.SelectedValue, 0); this.userInfo.Invisible = Utility.ToInt(this.invisible.SelectedValue, 0) != 0; this.userInfo.JoinDate = Utility.ToDateTime(this.joindate.Text); this.userInfo.LastActivity = Utility.ToDateTime(this.lastactivity.Text); this.userInfo.LastIP = this.lastip.Text; this.userInfo.LastPost = Utility.ToDateTime(this.lastpost.Text); this.userInfo.LastVisit = Utility.ToDateTime(this.lastvisit.Text); this.userInfo.Newpm = Utility.ToInt(this.newpm.SelectedValue, 0) != 0; //this.userInfo.NewsLetter = (ReceivePMSettingType)this.GetNewsLetter(); this.userInfo.NewsLetter = this.GetNewsLetter(); this.userInfo.OLTime = Utility.ToInt(this.oltime.Text, 0); this.userInfo.PageViews = Utility.ToInt(this.pageviews.Text, 0); this.userInfo.Pmsound = Utility.ToInt(this.pmsound.Text, 0); this.userInfo.Posts = Utility.ToInt(this.posts.Text, 0); this.userInfo.Ppp = Utility.ToInt(this.ppp.Text, 0); this.userInfo.RegIP = this.regip.Text; this.userInfo.DigestPosts = Utility.ToInt(this.digestposts.Text, 0); if (this.secques.SelectedValue == "1") { this.userInfo.Secques = ""; } this.userInfo.ShowEmail = Utility.ToInt(this.showemail.SelectedValue, 0) != 0; this.userInfo.Sigstatus = Utility.ToInt(this.sigstatus.SelectedValue, 0); this.userInfo.TemplateID = Utility.ToInt(this.templateid.SelectedValue, 0); this.userInfo.Tpp = Utility.ToInt(this.tpp.Text, 0); 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; } IUserField 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(userInfo.ID, ViewState["username"].ToString(), this.userInfo.Name, ""); } if (userInfo.Save() > 0) { Online.DeleteUserByUid(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='usergrid.aspx?condition=" + Request["condition"] + "';"); return; } base.RegisterStartupScript("PAGE", "alert('" + text + "');window.location.href='usergrid.aspx?condition=" + Request["condition"] + "';"); return; } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='usergrid.aspx?condition=" + Request["condition"] + "';</script>"); } } }