Exemple #1
0
        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>");
                }
            }
        }
Exemple #2
0
 private void SelectPass_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string uid = Request["uid"];
         if (uid != "")
         {
             if (CreditsFacade.GetCreditsUserGroupId(0f) != null)
             {
                 int groupid = CreditsFacade.GetCreditsUserGroupId(0f).ID;
                 //Users.UpdateUserGroupByUidList(groupid, uid);
                 //IUser user = XUser.FindByID(uid.ToInt());
                 string[] array = uid.Split(',');
                 for (int i = 0; i < array.Length; i++)
                 {
                     string value = array[i];
                     Int32  id    = Convert.ToInt32(value);
                     XUser  user  = XUser.FindByID(id);
                     user.GroupID = groupid;
                     user.Save();
                     CreditsFacade.UpdateUserCredits(id);
                 }
                 //Users.ClearUsersAuthstr(uid);
                 XUser.ClearUsersAuthstr(uid);
             }
             if (this.sendemail.Checked)
             {
                 Users.SendEmailForAccountCreateSucceed(uid);
             }
             base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';");
             return;
         }
         base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location='forum_audituser.aspx';</script>");
     }
 }
Exemple #3
0
 private void DeleteUser_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         string text = Request["uid"].Trim(',');
         if (text != "")
         {
             bool     delposts = this.deltype.SelectedValue.IndexOf("1") < 0;
             bool     delpms   = this.deltype.SelectedValue.IndexOf("2") < 0;
             string[] array    = text.Split(',');
             for (int i = 0; i < array.Length; i++)
             {
                 string text2 = array[i];
                 if (text2 != "" && this.CheckSponser(Utility.ToInt(text2, 0)) && Utility.ToInt(text2, 0) > 1)
                 {
                     int  userid = Utility.ToInt(text2, 0);
                     User user   = XUser.FindByID(userid);
                     if (user.Delete(delposts, delpms))
                     {
                         Sync.DeleteUsers(text2, "");
                         AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户", "用户名:批量用户删除");
                         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>");
     }
 }
Exemple #4
0
 protected void searchuser_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         //this.DataGrid1.BindData(Users.AuditNewUserClear(this.searchusername.Text, this.regbefore.Text, this.regip.Text));
         this.DataGrid1.BindData(XUser.AuditNewUserClear(searchusername.Text, Int32.Parse(regbefore.Text), regip.Text));
     }
 }
Exemple #5
0
 private void AllDelete_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         XUser.DeleteAuditUser();
         base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';");
     }
 }
Exemple #6
0
        private EntityList <XUser> buildGridData()
        {
            EntityList <XUser> list = XUser.FindAll(this.ViewState["condition"] + "", null, null, (this.DataGrid1.CurrentPageIndex) * this.DataGrid1.PageSize, this.DataGrid1.PageSize);

            if (list.Count == 1 && Request["username"] != null && Request["username"] != "")
            {
                base.Response.Redirect("edituser.aspx?uid=" + list[0].ID);
            }
            return(list);
        }
Exemple #7
0
        public void BindData()
        {
            this.DataGrid1.AllowCustomPaging = false;
            this.DataGrid1.TableHeaderName   = "审核用户列表";
            this.DataGrid1.DataKeyField      = "uid";
            //DataTable userListByGroupid = Users.GetUserListByGroupid(8);
            //this.DataGrid1.BindData(userListByGroupid);
            //this.AllDelete.Enabled = (userListByGroupid.Rows.Count > 0);
            //this.AllPass.Enabled = (userListByGroupid.Rows.Count > 0);
            EntityList <XUser> list = XUser.FindAllByGroupID(8);

            this.DataGrid1.BindData(list.ToDataTable(false));
            this.AllDelete.Enabled = list.Count > 0;
            this.AllPass.Enabled   = list.Count > 0;
        }
Exemple #8
0
        private void ExportUserEmails()
        {
            string gid = "";

            if (base.CheckCookie())
            {
                gid = this.Usergroups.GetSelectString(",");
            }
            if (String.IsNullOrEmpty(gid))
            {
                return;
            }

            //DataTable emailListByGroupidList = Users.GetEmailListByGroupidList(gid);
            //string text2 = "";
            //if (emailListByGroupidList.Rows.Count > 0)
            //{
            //    for (int i = 0; i < emailListByGroupidList.Rows.Count; i++)
            //    {
            //        text2 = text2 + emailListByGroupidList.Rows[i][1].ToString().Trim() + "; ";
            //    }
            //}
            var sb = new StringBuilder();

            foreach (var item in XUser.GetEmailListByGroupidList(gid.SplitAsInt()))
            {
                if (item.Email.IsNullOrWhiteSpace())
                {
                    continue;
                }

                if (sb.Length > 0)
                {
                    sb.Append("; ");
                }
                sb.Append(item.Email);
            }
            string file = "Useremail.txt";

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Buffer          = false;
            HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
            HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + base.Server.UrlEncode(file));
            HttpContext.Current.Response.ContentType = "text/plain";
            this.EnableViewState = false;
            HttpContext.Current.Response.Write(sb.ToString());
            HttpContext.Current.Response.End();
        }
Exemple #9
0
 private void BatchSendEmail_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         this.groupidlist = this.Usergroups.GetSelectString(",");
         if (String.IsNullOrEmpty(this.groupidlist) && String.IsNullOrEmpty(this.usernamelist.Text.Trim()))
         {
             base.RegisterStartupScript("", "<script>alert('您需要输入接收邮件用户名称或选取相关的用户组,因此邮件无法发送');</script>");
             return;
         }
         int num = 5;
         if (!this.usernamelist.Text.IsNullOrEmpty())
         {
             //DataTable list = Users.GetEmailListByUserNameList(this.usernamelist.Text);
             var list = XUser.FindAllByName(usernamelist.Text);
             if (list.Count <= 0)
             {
                 base.RegisterStartupScript("", "<script>alert('您输入的接收邮件用户名未能查找到相关用户,因此邮件无法发送');</script>");
                 return;
             }
             //Thread[] array = new Thread[list.Count];
             int num2 = 0;
             foreach (var item in list)
             {
                 //EmailMultiThread em = new EmailMultiThread(dataRow["UserName"].ToString(), dataRow["Email"].ToString(), this.subject.Text, this.body.Text);
                 //array[num2] = new Thread(new ThreadStart(em.Send));
                 //array[num2].Start();
                 Emails.SendAsync(item.Name, item.Email, this.subject.Text, this.body.Text);
                 if (num2 >= num)
                 {
                     Thread.Sleep(5000);
                     num2 = 0;
                 }
                 num2++;
             }
         }
         if (String.IsNullOrEmpty(this.groupidlist))
         {
             base.LoadRegisterStartupScript("PAGE", "window.location.href='global_usergroupsendemail.aspx';");
             return;
         }
         base.ClientScript.RegisterStartupScript(base.GetType(), "Page", "<script>submit_Click();</script>");
     }
 }
Exemple #10
0
        public void BindData()
        {
            String condition = ViewState["condition"] + "";
            Int32  count     = 0;

            if (String.IsNullOrEmpty(condition))
            {
                count = XUser.Meta.Count;
            }
            else
            {
                count = XUser.FindCount(condition, null, null, 0, 0);
            }

            this.DataGrid1.AllowCustomPaging = true;
            this.DataGrid1.VirtualItemCount  = count;

            this.DataGrid1.DataSource = this.buildGridData();
            this.DataGrid1.DataBind();
        }
Exemple #11
0
 private void Search_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         //string usersSearchCondition = Users.GetUsersSearchCondition(this.islike.Checked, this.ispostdatetime.Checked, this.Username.Text, this.nickname.Text, this.UserGroup.SelectedValue, this.email.Text, this.credits_start.Text, this.credits_end.Text, this.lastip.Text, this.posts.Text, this.digestposts.Text, this.uid.Text, this.joindateStart.SelectedDate.ToString(), this.joindateEnd.SelectedDate.AddDays(1.0).ToString());
         string where = XUser.SearchWhere(this.islike.Checked, this.ispostdatetime.Checked, this.Username.Text, this.nickname.Text, Utility.ToInt(this.UserGroup.SelectedValue, 0), this.email.Text, Utility.ToInt(this.credits_start.Text, 0), Utility.ToInt(this.credits_end.Text, 0), this.lastip.Text, Utility.ToInt(this.posts.Text, 0), Utility.ToInt(this.digestposts.Text, 0), this.uid.Text, this.joindateStart.SelectedDate, this.joindateEnd.SelectedDate);
         this.ViewState["condition"]   = where;
         this.searchtable.Visible      = false;
         this.ResetSearchTable.Visible = true;
         //DataTable usersByCondition = Users.GetUsersByCondition(usersSearchCondition);
         DataTable dt = XUser.FindAll(where, null, null, 0, 1).ToDataTable(false);
         if (dt.Rows.Count == 1)
         {
             base.Response.Redirect("edituser.aspx?uid=" + dt.Rows[0][0].ToString() + "&condition=" + where.Replace("'", "~^").Replace("%", "~$"));
             return;
         }
         this.DataGrid1.CurrentPageIndex = 0;
         this.BindData();
     }
 }
Exemple #12
0
        private string CombinationUser(string userName, string targetUserName, int targetUid)
        {
            string result = "";

            if (userName != "" && targetUserName != userName)
            {
                int userId = Users.GetUserId(userName);
                if (userId > 0)
                {
                    //AdminUsers.CombinationUser(userId, targetUid);
                    User src = XUser.FindByID(userId);
                    User des = XUser.FindByID(targetUid);
                    des.Credits     += src.Credits;
                    des.ExtCredits1 += src.ExtCredits1;
                    des.ExtCredits2 += src.ExtCredits2;
                    des.ExtCredits3 += src.ExtCredits3;
                    des.ExtCredits4 += src.ExtCredits4;
                    des.ExtCredits5 += src.ExtCredits5;
                    des.ExtCredits6 += src.ExtCredits6;
                    des.ExtCredits7 += src.ExtCredits7;
                    des.ExtCredits8 += src.ExtCredits8;
                    //Users.UpdateUser(userInfo2);
                    des.Save();
                    //BBX.Data.Users.CombinationUser(TableList.CurrentTableName, userInfo2, userInfo);
                    des.CombinationFrom(src);
                    src.Delete(true, true);

                    XForum.UpdateForumsFieldModerators(userName);
                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并用户", "把用户" + userName + " 合并到" + targetUserName);
                }
                else
                {
                    result = "用户:" + userName + "不存在!,";
                }
            }
            return(result);
        }
Exemple #13
0
 private void AllPass_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         if (CreditsFacade.GetCreditsUserGroupId(0f) != null)
         {
             int groupid = CreditsFacade.GetCreditsUserGroupId(0f).ID;
             UserGroup.ChangeAllUserGroupId(8, groupid);
             //foreach (DataRow dataRow in Users.GetUserListByGroupid(8).Rows)
             foreach (XUser user in XUser.FindAllByGroupID(8))
             {
                 //CreditsFacade.UpdateUserCredits(Convert.ToInt32(dataRow["uid"].ToString()));
                 CreditsFacade.UpdateUserCredits(user.ID);
             }
             //Users.ClearUsersAuthstrByUncheckedUserGroup();
             XUser.ClearUsersAuthstr(XUser.GetUidListByUserGroupId(8));
         }
         if (this.sendemail.Checked)
         {
             Users.SendEmailForUncheckedUserGroup();
         }
         base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';");
     }
 }
Exemple #14
0
 protected override void ShowPage()
 {
     this.pagetitle = "用户";
     if (this.config.Memliststatus != 1)
     {
         base.AddErrLine("系统不允许查看用户列表");
         return;
     }
     this.orderby = DNTRequest.GetHtmlEncodeString("orderby", true).Trim();
     if (!"id|name|credits|posts|adminid|joindate|lastactivity".Contains(this.orderby))
     {
         this.orderby = "";
     }
     if (!this.orderby.IsNullOrEmpty() && !Utils.InArray(this.orderby, "id,name,credits,posts,adminid,joindate,lastactivity"))
     {
         this.orderby = "id";
     }
     this.ordertype = DNTRequest.GetHtmlEncodeString("ordertype", true).Trim();
     if (!"asc|desc".Contains(this.ordertype))
     {
         this.ordertype = "";
     }
     if (!this.ordertype.Equals("desc") && !this.ordertype.Equals("asc"))
     {
         this.ordertype = "desc";
     }
     //this.totalusers = Users.GetUserCountByAdmin(DNTRequest.GetString("orderby"));
     this.totalusers = XUser.Meta.Count;
     this.pagecount  = ((this.totalusers % 20 == 0) ? (this.totalusers / 20) : (this.totalusers / 20 + 1));
     this.pagecount  = ((this.pagecount == 0) ? 1 : this.pagecount);
     this.pageid     = ((this.pageid < 1) ? 1 : this.pageid);
     this.pageid     = ((this.pageid > this.pagecount) ? this.pagecount : this.pageid);
     //this.userlist = Users.GetUserList(20, this.pageid, this.orderby, this.ordertype);
     this.userlist    = XUser.GetUserList(20, this.pageid, this.orderby, this.ordertype);
     this.pagenumbers = Utils.GetPageNumbers(this.pageid, this.pagecount, string.Format("showuser.aspx{0}", string.Format("?orderby={0}&ordertype={1}", this.orderby, this.ordertype)), 8);
 }
Exemple #15
0
        protected override void ShowPage()
        {
            if (this.postid == 0)
            {
                base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回.");
                return;
            }
            var postInfo = Post.FindByID(this.postid);

            if (postInfo == null)
            {
                base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回.");
                return;
            }
            this.ip         = postInfo.IP;
            this.iplocation = IPAddress.Parse(this.ip).GetAddress();
            if (this.iplocation == null)
            {
                this.iplocation = "(IP数据库文件不存在,无法查询)";
            }
            else
            {
                if (string.IsNullOrEmpty(this.iplocation))
                {
                    this.iplocation = "没有查询到该用户的地理所在地";
                }
            }
            var topicInfo = Topic.FindByID(postInfo.Tid);

            if (topicInfo == null)
            {
                base.AddErrLine("不存在的主题ID");
                return;
            }
            var forumInfo = Forums.GetForumInfo(postInfo.Fid);

            this.forumname = forumInfo.Name;
            this.pagetitle = topicInfo.Title;
            this.forumnav  = ForumUtils.UpdatePathListExtname(forumInfo.Pathlist.Trim(), this.config.Extname);
            var adminGroupInfo = AdminGroup.FindByID(this.usergroupid);

            if (adminGroupInfo == null || !adminGroupInfo.AllowViewIP)
            {
                base.AddErrLine("你没有查看IP的权限");
                return;
            }
            if (DNTRequest.GetString("action") == "ipban")
            {
                if (!adminGroupInfo.AllowBanIP)
                {
                    base.AddErrLine("你无权禁止用户IP,请返回");
                    return;
                }
                if (Utils.InIPArray(DNTRequest.GetString("ip"), Utils.SplitString(this.config.Ipdenyaccess, "\n")))
                {
                    //Users.UpdateUserGroup(postInfo.Posterid, 6);
                    XUser user = XUser.FindByID(postInfo.PosterID);
                    user.GroupID = 6;
                    user.Save();
                    base.AddErrLine("IP已在列表中存在,无需重复添加");
                    return;
                }
                var cfg = GeneralConfigInfo.Current;
                cfg.Ipdenyaccess += "\n" + DNTRequest.GetString("ip");
                cfg.Save();
                //if (GeneralConfigs.SetIpDenyAccess(DNTRequest.GetString("ip")))
                {
                    //Users.UpdateUserGroup(postInfo.Posterid, 6);
                    XUser user = XUser.FindByID(postInfo.PosterID);
                    user.GroupID = 6;
                    user.Save();
                    base.SetUrl(base.ShowTopicAspxRewrite(topicInfo.ID, 0));
                    base.SetMetaRefresh();
                    base.SetShowBackLink(false);
                    base.MsgForward("getip_succeed");
                    base.AddMsgLine("IP已加入到用户禁止列表中");
                    this.ispost = true;
                    return;
                }
                //base.AddErrLine("未知原因,IP无法加到禁止列表中");
            }
        }