Ejemplo n.º 1
0
        /// <summary>自动认证登录</summary>
        private bool AutoLogin(string returnUrl)
        {
            var           context   = this.Context.GetHttpContextWrapper();
            string        token     = null;
            IPKSPrincipal principal = null;

            if (!context.IsLogined(null, ref token, out principal))
            {
                var redirectUrl = context.GetRedirectUrlToPortalLogin(returnUrl);
                this.Context.Response.Redirect(redirectUrl);
                this.Context.Response.End();
                return(true);
            }
            var userName = principal.Identity.Name;
            var user     = Users.GetUserInfo(userName);
            var config   = GeneralConfigs.GetConfig();

            if (user == null)
            {
                user = context.CreateUser(config, principal, false);
            }
            ForumUtils.WriteUserCookie(user.Uid, ForumExtension.ExpireMinutes, config.Passwordkey);
            if (user.Groupid == 1)
            {
                var admin      = user;
                var adminGroup = AdminUserGroups.AdminGetUserGroupInfo(admin.Groupid);
                this.Context.AddAdminCookie(config, admin.Uid, admin.Password, admin.Secques, ForumExtension.ExpireMinutes);
                //AdminVistLogs.InsertLog(admin.Uid, admin.Username, admin.Groupid, adminGroup.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", "");
            }
            else
            {
                this.Context.Response.AppendCookie(new HttpCookie("dntadmin"));
            }
            return(false);
        }
Ejemplo n.º 2
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新系统管理组信息

            if (this.CheckCookie())
            {
                userGroupInfo                  = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System           = 0;
                userGroupInfo.Type             = 0;
                userGroupInfo.Readaccess       = Convert.ToInt32(readaccess.Text);
                userGroupInfo.Allowviewstats   = 0;
                userGroupInfo.Allownickname    = 0;
                userGroupInfo.Allowhtml        = 0;
                userGroupInfo.Allowcstatus     = 0;
                userGroupInfo.Allowuseblog     = 0;
                userGroupInfo.Allowinvisible   = 0;
                userGroupInfo.Allowtransfer    = 0;
                userGroupInfo.Allowmultigroups = 0;
                userGroupInfo.Reasonpm         = 0;

                //if (radminid.SelectedValue == "0") //当未选取任何管理模板时
                //{
                //    Discuz.Forum.AdminGroups.DeleteAdminGroupInfo((short)userGroupInfo.Groupid);
                //    userGroupInfo.Radminid = 0;
                //}

                Users.UpdateUserAdminIdByGroupId(userGroupInfo.Radminid, userGroupInfo.Groupid);
                userGroupInfo.Grouptitle         = groupTitle.Text;
                userGroupInfo.Creditshigher      = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.Creditslower       = Convert.ToInt32(creditslower.Text);
                userGroupInfo.Stars              = Convert.ToInt32(stars.Text);
                userGroupInfo.Color              = color.Text;
                userGroupInfo.Groupavatar        = groupavatar.Text;
                userGroupInfo.Maxprice           = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum           = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize         = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize      = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday      = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize  = Convert.ToInt32(maxspacephotosize.Text);
                userGroupInfo.Attachextensions   = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);

                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList");
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新系统组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                    base.RegisterStartupScript("PAGE", "window.location.href='global_sysadminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_sysadminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text = Utils.RemoveFontTag(userGroupInfo.Grouptitle);

            stars.Text              = userGroupInfo.Stars.ToString();
            color.Text              = userGroupInfo.Color;
            groupavatar.Text        = userGroupInfo.Groupavatar;
            readaccess.Text         = userGroupInfo.Readaccess.ToString();
            maxprice.Text           = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text           = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text         = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text      = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text      = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text  = userGroupInfo.Maxspacephotosize.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();

            radminid.SelectedValue = userGroupInfo.Radminid == -1 ? "0" : userGroupInfo.Radminid.ToString();
            ViewState["radminid"]  = userGroupInfo.Radminid;

            //DataTable dt = DbHelper.ExecuteDataset("Select id,extension  From [" + BaseConfigs.GetTablePrefix + "attachtypes]  Order By [id] ASC").Tables[0];
            DataTable dt = Attachments.GetAttachmentType();
            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());

            //设置用户权限组初始化信息
            //if (__usergroupinfo.Allowvisit == 1) usergroupright.Items[0].Selected = true;
            //if (__usergroupinfo.Allowpost == 1) usergroupright.Items[1].Selected = true;
            //if (__usergroupinfo.Allowreply == 1) usergroupright.Items[2].Selected = true;
            //if (__usergroupinfo.Allowpostpoll == 1) usergroupright.Items[3].Selected = true;
            //if (__usergroupinfo.Allowgetattach == 1) usergroupright.Items[4].Selected = true;
            //if (__usergroupinfo.Allowpostattach == 1) usergroupright.Items[5].Selected = true;
            //if (__usergroupinfo.Allowvote == 1) usergroupright.Items[6].Selected = true;
            //if (__usergroupinfo.Allowsetreadperm == 1) usergroupright.Items[7].Selected = true;
            //if (__usergroupinfo.Allowsetattachperm == 1) usergroupright.Items[8].Selected = true;
            //if (__usergroupinfo.Allowhidecode == 1) usergroupright.Items[9].Selected = true;
            //if (__usergroupinfo.Allowcusbbcode == 1) usergroupright.Items[10].Selected = true;
            //if (__usergroupinfo.Allowsigbbcode == 1) usergroupright.Items[11].Selected = true;
            //if (__usergroupinfo.Allowsigimgcode == 1) usergroupright.Items[12].Selected = true;
            //if (__usergroupinfo.Allowviewpro == 1) usergroupright.Items[13].Selected = true;
            //if (__usergroupinfo.Disableperiodctrl == 1) usergroupright.Items[14].Selected = true;

            //if (__usergroupinfo.Allowsearch.ToString() == "0") allowsearch.Items[0].Selected = true;
            //if (__usergroupinfo.Allowsearch.ToString() == "1") allowsearch.Items[1].Selected = true;
            //if (__usergroupinfo.Allowsearch.ToString() == "2") allowsearch.Items[2].Selected = true;

            //if (__usergroupinfo.Allowavatar >= 0) allowavatar.Items[__usergroupinfo.Allowavatar].Selected = true;

            usergrouppowersetting.Bind(userGroupInfo);
            if (userGroupInfo.System == 1)
            {
                DeleteUserGroupInf.Enabled = false;
            }

            #endregion
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                config = GeneralConfigs.GetConfig();

                // 如果IP访问列表有设置则进行判断
                if (config.Adminipaccess.Trim() != "")
                {
                    string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                    if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                    {
                        Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                        return;
                    }
                }

                //获取当前用户的在线信息
                OnlineUserInfo oluserinfo = new OnlineUserInfo();
                try
                {
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }
                catch
                {
                    Thread.Sleep(2000);
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }


                #region 进行权限判断

                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);
                if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
                {
                    Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return;
                }

                string secques = Users.GetUserInfo(oluserinfo.Userid).Secques;
                // 管理员身份验证
                if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null || ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + secques + oluserinfo.Userid.ToString()))
                {
                    Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return;
                }
                else
                {
                    Context.AddAdminCookie(config, oluserinfo, secques);
                    //HttpCookie cookie = HttpContext.Current.Request.Cookies["dntadmin"];
                    //cookie.Values["key"] = ForumUtils.SetCookiePassword(oluserinfo.Password + secques + oluserinfo.Userid.ToString(), config.Passwordkey);
                    //cookie.Expires = DateTime.Now.AddMinutes(30);
                    //HttpContext.Current.Response.AppendCookie(cookie);
                }

                #endregion
            }
        }
        public void SetGroupRights(string groupid)
        {
            #region 设置组权限相关信息
            UserGroupInfo userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid));

            creditshigher.Text = userGroupInfo.Creditshigher.ToString();
            creditslower.Text  = userGroupInfo.Creditslower.ToString();
            stars.Text         = userGroupInfo.Stars.ToString();
            color.Text         = userGroupInfo.Color;
            groupavatar.Text   = userGroupInfo.Groupavatar;
            readaccess.Text    = userGroupInfo.Readaccess.ToString();
            maxprice.Text      = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text      = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text    = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text = userGroupInfo.Maxsizeperday.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();
            radminid.SelectedValue = userGroupInfo.Radminid.ToString();

            DataTable attachmentType = Attachments.GetAttachmentType();
            attachextensions.AddTableData(attachmentType, userGroupInfo.Attachextensions.ToString());

            //设置用户权限组初始化信息
            usergrouppowersetting.Bind(userGroupInfo);

            AdminGroupInfo adminGroupInfo = AdminUserGroups.AdminGetAdminGroupInfo(Convert.ToInt32(groupid));
            if (adminGroupInfo != null)
            {
                admingroupright.Items[0].Selected  = adminGroupInfo.Alloweditpost == 1;
                admingroupright.Items[1].Selected  = adminGroupInfo.Alloweditpoll == 1;
                admingroupright.Items[2].Selected  = adminGroupInfo.Allowdelpost == 1;
                admingroupright.Items[3].Selected  = adminGroupInfo.Allowmassprune == 1;
                admingroupright.Items[4].Selected  = adminGroupInfo.Allowviewip == 1;
                admingroupright.Items[5].Selected  = adminGroupInfo.Allowedituser == 1;
                admingroupright.Items[6].Selected  = adminGroupInfo.Allowviewlog == 1;
                admingroupright.Items[7].Selected  = adminGroupInfo.Disablepostctrl == 1;
                admingroupright.Items[8].Selected  = adminGroupInfo.Allowviewrealname == 1;
                admingroupright.Items[9].Selected  = adminGroupInfo.Allowbanuser == 1;
                admingroupright.Items[10].Selected = adminGroupInfo.Allowbanip == 1;
                admingroupright.Items[11].Selected = adminGroupInfo.Allowmodpost == 1;
                admingroupright.Items[12].Selected = adminGroupInfo.Allowpostannounce == 1;
                GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                admingroupright.Items[13].Selected = ("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1;  //是否允许接收举报信息
                admingroupright.Items[14].Selected = ("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1; //是否允许管理图片评论
            }

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled       = false;
                allowstickthread.SelectedValue = "3";
            }
            else
            {
                allowstickthread.Enabled = true;
            }
            #endregion
        }
Ejemplo n.º 6
0
        /// <summary>从门户后台管理自动登录</summary>
        private bool AutoLogin(string returnUrl)
        {
            var token = this.Request.QueryString["token"];

            if (token.IsNullOrEmpty())
            {
                return(false);
            }
            var userId = this.Context.GetPortalMgmtUserId(token);

            if (userId.IsNullOrEmpty())
            {
                return(false);
            }
            var nUserId = 0;

            if (!int.TryParse(userId, out nUserId))
            {
                return(false);
            }
            var user = this.Context.GetPortalMgmtUser(nUserId);

            if (user == null)
            {
                return(false);
            }
            var admin   = Users.GetUserInfo(user.USERNAME);
            var context = this.Context.GetHttpContextWrapper();
            var config  = GeneralConfigs.GetConfig();

            if (admin == null)
            {
                var principal = new PKSPrincipal();
                var identity  = new PKSIdentity();
                identity.Name        = user.USERNAME;
                identity.Email       = user.EMAIL;
                identity.PhoneNumber = user.PHONENUMBER;
                principal.Identity   = identity;
                admin = context.CreateUser(config, principal, true);
            }
            else if (admin.Adminid != 1 || admin.Groupid != 1)
            {
                admin.Adminid  = 1;
                admin.Groupid  = 1;
                admin.Authtime = Utils.GetDateTime();
                AdminUsers.UpdateUserAllInfo(admin);
                //移除该用户的在线信息,使之重建在线表信息
                OnlineUsers.DeleteUserByUid(admin.Uid);
            }
            var adminGroup = AdminUserGroups.AdminGetUserGroupInfo(admin.Groupid);

            ForumUtils.WriteUserCookie(admin.Uid, ForumExtension.ExpireMinutes, config.Passwordkey);
            this.Context.AddAdminCookie(config, admin.Uid, admin.Password, admin.Secques, ForumExtension.ExpireMinutes);
            SoftInfo.LoadSoftInfo();
            AdminVistLogs.InsertLog(admin.Uid, admin.Username, admin.Groupid, adminGroup.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", "");
            return(true);
        }
        public void SetGroupRights(string groupid)
        {
            #region 设置组权限相关信息
            UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid));

            creditshigher.Text     = __usergroupinfo.Creditshigher.ToString();
            creditslower.Text      = __usergroupinfo.Creditslower.ToString();
            stars.Text             = __usergroupinfo.Stars.ToString();
            color.Text             = __usergroupinfo.Color;
            groupavatar.Text       = __usergroupinfo.Groupavatar;
            readaccess.Text        = __usergroupinfo.Readaccess.ToString();
            maxprice.Text          = __usergroupinfo.Maxprice.ToString();
            maxpmnum.Text          = __usergroupinfo.Maxpmnum.ToString();
            maxsigsize.Text        = __usergroupinfo.Maxsigsize.ToString();
            maxattachsize.Text     = __usergroupinfo.Maxattachsize.ToString();
            maxsizeperday.Text     = __usergroupinfo.Maxsizeperday.ToString();
            radminid.SelectedValue = __usergroupinfo.Radminid.ToString();

            DataTable dt = DatabaseProvider.GetInstance().GetAttchType().Tables[0];
            attachextensions.AddTableData(dt, __usergroupinfo.Attachextensions.ToString());

            //设置用户权限组初始化信息
            usergrouppowersetting.Bind(__usergroupinfo);

            AdminGroupInfo __admingroupinfo = AdminUserGroups.AdminGetAdminGroupInfo(Convert.ToInt32(groupid));
            if (__admingroupinfo != null)
            {
                admingroupright.Items[0].Selected  = __admingroupinfo.Alloweditpost == 1;
                admingroupright.Items[1].Selected  = __admingroupinfo.Alloweditpoll == 1;
                admingroupright.Items[2].Selected  = __admingroupinfo.Allowdelpost == 1;
                admingroupright.Items[3].Selected  = __admingroupinfo.Allowmassprune == 1;
                admingroupright.Items[4].Selected  = __admingroupinfo.Allowviewip == 1;
                admingroupright.Items[5].Selected  = __admingroupinfo.Allowedituser == 1;
                admingroupright.Items[6].Selected  = __admingroupinfo.Allowviewlog == 1;
                admingroupright.Items[7].Selected  = __admingroupinfo.Disablepostctrl == 1;
                admingroupright.Items[8].Selected  = __admingroupinfo.Allowviewrealname == 1;
                admingroupright.Items[9].Selected  = __admingroupinfo.Allowbanuser == 1;
                admingroupright.Items[10].Selected = __admingroupinfo.Allowbanip == 1;
                GeneralConfigInfo configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                admingroupright.Items[11].Selected = ("," + configinfo.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1;  //是否允许接收举报信息
                admingroupright.Items[12].Selected = ("," + configinfo.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1; //是否允许管理图片评论
            }

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled       = false;
                allowstickthread.SelectedValue = "3";
            }
            else
            {
                allowstickthread.Enabled = true;
            }


            #endregion
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 检查cookie是否有效
        /// </summary>
        /// <returns></returns>
        public bool CheckCookie()
        {
            string sysloginPage = Shove._Web.Utility.GetUrl() + "/admin/syslogin.aspx";

            config = GeneralConfigs.GetConfig();

            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(sysloginPage);
                    return(false);
                }
            }

            #region 进行权限判断

            int userid = Discuz.Forum.Users.GetUserIDFromCookie();

            if (userid <= 0)
            {
                Context.Response.Redirect(sysloginPage);
                return(false);
            }

            UserInfo u = Discuz.Forum.Users.GetUserInfo(userid);

            if (u.Adminid < 1 || u.Groupid < 1)
            {
                Context.Response.Redirect(sysloginPage);
                return(false);
            }



            UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(u.Groupid);
            if (usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(sysloginPage);
                return(false);
            }

            this.userid      = u.Uid;
            this.username    = u.Username;
            this.usergroupid = u.Groupid;
            this.useradminid = (short)usergroupinfo.Radminid;
            this.grouptitle  = usergroupinfo.Grouptitle;
            this.ip          = DNTRequest.GetIP();

            #endregion

            return(true);
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                config = GeneralConfigs.GetConfig();
                string sysloginPage = Shove._Web.Utility.GetUrl() + "admin/syslogin.aspx";

                // 如果IP访问列表有设置则进行判断
                if (config.Adminipaccess.Trim() != "")
                {
                    string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                    if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                    {
                        Context.Response.Redirect(sysloginPage);
                        return;
                    }
                }

                #region 进行权限判断

                int userid = Discuz.Forum.Users.GetUserIDFromCookie();

                if (userid <= 0)
                {
                    Context.Response.Redirect(sysloginPage);
                    return;
                }

                UserInfo u = Discuz.Forum.Users.GetUserInfo(userid);

                if (u.Adminid < 1 || u.Groupid < 1)
                {
                    Context.Response.Redirect(sysloginPage);
                    return;
                }



                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(u.Groupid);
                if (usergroupinfo.Radminid != 1)
                {
                    Context.Response.Redirect(sysloginPage);
                    return;
                }

                this.userid      = u.Uid;
                this.username    = u.Username;
                this.usergroupid = u.Groupid;
                this.useradminid = (short)usergroupinfo.Radminid;
                this.grouptitle  = usergroupinfo.Grouptitle;
                this.ip          = DNTRequest.GetIP();

                #endregion
            }
        }
Ejemplo n.º 10
0
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text    = Utils.RemoveFontTag(userGroupInfo.Grouptitle);
            creditshigher.Text = userGroupInfo.Creditshigher.ToString();
            creditslower.Text  = userGroupInfo.Creditslower.ToString();

            DataTable dt = UserGroups.GetUserGroupExceptGroupid(groupid);
            if (dt.Rows.Count == 0)
            {
                creditshigher.Enabled = false;
                creditslower.Enabled  = false;
            }

            ViewState["creditshigher"] = userGroupInfo.Creditshigher.ToString();
            ViewState["creditslower"]  = userGroupInfo.Creditslower.ToString();

            stars.Text              = userGroupInfo.Stars.ToString();
            color.Text              = userGroupInfo.Color;
            groupavatar.Text        = userGroupInfo.Groupavatar;
            readaccess.Text         = userGroupInfo.Readaccess.ToString();
            maxprice.Text           = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text           = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text         = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text      = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text      = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text  = userGroupInfo.Maxspacephotosize.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();


            dt = Attachments.GetAttachmentType();
            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());
            //绑定权限信息
            usergrouppowersetting.Bind(userGroupInfo);

            if (userGroupInfo.System == 1)
            {
                DeleteUserGroupInf.Enabled = false;
            }

            #endregion
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                #region 初始化控件
                groupid.AddTableData(DatabaseProvider.GetInstance().GetGroupInfo());
                AddUserInfo.Attributes.Add("onclick", "return IsValidPost();");
                //将金币设置数据加载到Javascript数组,在前台改变
                string scriptText = "var creditarray = new Array(";
                for (int i = 1; i < groupid.Items.Count; i++)
                {
                    scriptText += AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.Items[i].Value)).Creditshigher.ToString() + ",";
                }
                scriptText = scriptText.TrimEnd(',') + ");";
                this.RegisterStartupScript("begin", "<script type='text/javascript'>" + scriptText + "</script>");
                groupid.Attributes.Add("onchange", "document.getElementById('" + credits.ClientID + "').value=creditarray[this.selectedIndex];");
                groupid.Items.RemoveAt(0);
                try
                {
                    groupid.SelectedValue = "10";
                }
                catch
                {
                    if (UserCredits.GetCreditsUserGroupID(0) != null)
                    {
                        groupid.SelectedValue = UserCredits.GetCreditsUserGroupID(0).Groupid.ToString();
                    }
                    else
                    {
                        groupid.SelectedValue = "3";
                    }
                }

                try
                {
                    UserGroupInfo _usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.SelectedValue));
                    credits.Text = _usergroupinfo.Creditshigher.ToString();
                }
                catch
                {
                    ;
                }

                #endregion
            }
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                #region 初始化控件
                foreach (UserGroupInfo userGroupInfo in UserGroups.GetUserGroupList())
                {
                    groupid.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString()));
                }
                AddUserInfo.Attributes.Add("onclick", "return IsValidPost();");
                //将积分设置数据加载到Javascript数组,在前台改变
                string scriptText = "var creditarray = new Array(";
                for (int i = 1; i < groupid.Items.Count; i++)
                {
                    scriptText += AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.Items[i].Value)).Creditshigher.ToString() + ",";
                }
                scriptText = scriptText.TrimEnd(',') + ");";
                this.RegisterStartupScript("begin", "<script type='text/javascript'>" + scriptText + "</script>");
                groupid.Attributes.Add("onchange", "document.getElementById('" + credits.ClientID + "').value=creditarray[this.selectedIndex];");
                groupid.Items.RemoveAt(0);
                try
                {
                    groupid.SelectedValue = "10";
                }
                catch
                {
                    //当新手上路不存在时
                    groupid.SelectedValue = CreditsFacade.GetCreditsUserGroupId(0) != null?CreditsFacade.GetCreditsUserGroupId(0).Groupid.ToString() : "3";
                }

                try
                {
                    UserGroupInfo _usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.SelectedValue));
                    credits.Text = _usergroupinfo.Creditshigher.ToString();
                }
                catch
                {
                    ;
                }

                #endregion
            }
        }
Ejemplo n.º 13
0
        public UserControlsPageBase()
        {
            config = GeneralConfigs.GetConfig();

            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return;
                }
            }

            // 获取用户信息
            OnlineUserInfo oluserinfo    = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            UserGroupInfo  usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);

            if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }

            string secques = Users.GetUserInfo(oluserinfo.Userid).Secques;

            // 管理员身份验证
            if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null ||
                ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + secques + oluserinfo.Userid.ToString()))
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }
            else
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies["dntadmin"];
                cookie.Values["key"]    = ForumUtils.SetCookiePassword(oluserinfo.Password + secques + oluserinfo.Userid.ToString(), config.Passwordkey);
                cookie.Values["userid"] = oluserinfo.Userid.ToString();
                cookie.Expires          = DateTime.Now.AddMinutes(30);
                HttpContext.Current.Response.AppendCookie(cookie);
            }
        }
Ejemplo n.º 14
0
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text    = Utils.RemoveFontTag(__usergroupinfo.Grouptitle);
            creditshigher.Text = __usergroupinfo.Creditshigher.ToString();
            creditslower.Text  = __usergroupinfo.Creditslower.ToString();

            DataTable dt = DatabaseProvider.GetInstance().GetUserGroupExceptGroupid(groupid);
            if (dt.Rows.Count == 0)
            {
                creditshigher.Enabled = false;
                creditslower.Enabled  = false;
            }

            ViewState["creditshigher"] = __usergroupinfo.Creditshigher.ToString();
            ViewState["creditslower"]  = __usergroupinfo.Creditslower.ToString();

            stars.Text         = __usergroupinfo.Stars.ToString();
            color.Text         = __usergroupinfo.Color;
            groupavatar.Text   = __usergroupinfo.Groupavatar;
            readaccess.Text    = __usergroupinfo.Readaccess.ToString();
            maxprice.Text      = __usergroupinfo.Maxprice.ToString();
            maxpmnum.Text      = __usergroupinfo.Maxpmnum.ToString();
            maxsigsize.Text    = __usergroupinfo.Maxsigsize.ToString();
            maxattachsize.Text = __usergroupinfo.Maxattachsize.ToString();
            maxsizeperday.Text = __usergroupinfo.Maxsizeperday.ToString();

            dt = DatabaseProvider.GetInstance().GetAttchType().Tables[0];
            attachextensions.SetSelectByID(__usergroupinfo.Attachextensions.Trim());
            //绑定权限信息
            usergrouppowersetting.Bind(__usergroupinfo);

            if (__usergroupinfo.System == 1)
            {
                DeleteUserGroupInf.Enabled = false;
            }

            #endregion
        }
Ejemplo n.º 15
0
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text         = Utils.RemoveFontTag(userGroupInfo.Grouptitle);
            creditshigher.Text      = userGroupInfo.Creditshigher.ToString();
            creditslower.Text       = userGroupInfo.Creditslower.ToString();
            stars.Text              = userGroupInfo.Stars.ToString();
            color.Text              = userGroupInfo.Color;
            groupavatar.Text        = userGroupInfo.Groupavatar;
            readaccess.Text         = userGroupInfo.Readaccess.ToString();
            maxprice.Text           = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text           = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text         = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text      = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text      = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text  = userGroupInfo.Maxspacephotosize.ToString();

            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());

            if (groupid > 0 && groupid <= 3)
            {
                radminid.Enabled = false;
            }
            radminid.SelectedValue = userGroupInfo.Radminid.ToString();

            usergrouppowersetting.Bind(userGroupInfo);

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled       = false;
                allowstickthread.SelectedValue = "3";
            }

            #endregion
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //更新在线表相关用户信息
            config = GeneralConfigs.GetConfig();
            OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            if (AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid).Radminid != 1)
            {
                HttpContext.Current.Response.Redirect("../");
                return;
            }
            int olid = oluserinfo.Olid;

            OnlineUsers.DeleteRows(olid);

            //清除Cookie
            ForumUtils.ClearUserCookie();
            HttpCookie cookie = new HttpCookie("dntadmin");

            HttpContext.Current.Response.AppendCookie(cookie);

            FormsAuthentication.SignOut();
        }
Ejemplo n.º 17
0
 protected void SaveCombinationInfo_Click(object sender, EventArgs e)
 {
     #region 保存相册配置
     config.Enablealbum = int.Parse(EnableAlbum.SelectedValue);
     GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config"));
     if (Utils.IsNumeric(maxalbumcount.Text.ToString()) == true && Utils.IsInt(maxalbumcount.Text.ToString()) == true)
     {
         if (config.Enablealbum == 1)
         {
             AlbumConfigInfo albumconfiginfo = new AlbumConfigInfo();
             albumconfiginfo.MaxAlbumCount = maxalbumcount.Text;
             AlbumConfigs.SaveConfig(albumconfiginfo);
             //保存组照片最大空间
             DataTable dt = DatabaseProvider.GetInstance().GetUserGroupMaxspacephotosize();
             foreach (DataRow dr in dt.Rows)
             {
                 if (!Utils.IsInt(DNTRequest.GetString("maxspacephotosize" + dr["groupid"].ToString()).ToString()))
                 {
                     base.RegisterStartupScript("", "<script>alert('输入错误,相册大小只能是0或者正整数');window.location.href='album_config.aspx';</script>");
                     return;
                 }
                 int photosize = DNTRequest.GetInt("maxspacephotosize" + dr["groupid"].ToString(), 0);
                 Discuz.Entity.UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dr["groupid"].ToString()));
                 __usergroupinfo.Maxspacephotosize = photosize;
                 AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo);
             }
         }
         Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
         Response.Redirect("album_config.aspx");
     }
     else
     {
         base.RegisterStartupScript("", "<script>alert('相册数上限输入错误,请检查');window.location.href='album_config.aspx';</script>");
         return;
     }
     #endregion
 }
Ejemplo n.º 18
0
        public void VerifyLoginInf()
        {
            if (!Discuz.Forum.OnlineUsers.CheckUserVerifyCode(olid, DNTRequest.GetString("vcode")))
            {
                Response.Redirect("syslogin.aspx?result=3");
                return;
            }

            UserInfo userInfo = null;

            if (config.Passwordmode == 1)
            {
                userInfo = Users.GetUserInfo(Users.CheckDvBbsPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password")));
            }
            else if (config.Passwordmode == 0)
            {
                userInfo = Users.GetUserInfo(Users.CheckPassword(DNTRequest.GetString("username"), Utils.MD5(DNTRequest.GetString("password")), false));
            }
            else//第三方加密验证模式
            {
                userInfo = Users.CheckThirdPartPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"), -1, null);
            }

            if (userInfo != null)
            {
                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);

                if (usergroupinfo.Radminid == 1)
                {
                    ForumUtils.WriteUserCookie(userInfo.Uid, 1440, GeneralConfigs.GetConfig().Passwordkey);

                    //UserGroupInfo userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid);

                    HttpCookie cookie = new HttpCookie("dntadmin");
                    cookie.Values["key"] = ForumUtils.SetCookiePassword(userInfo.Password + userInfo.Secques + userInfo.Uid, config.Passwordkey);
                    cookie.Expires       = DateTime.Now.AddMinutes(30);
                    HttpContext.Current.Response.AppendCookie(cookie);

                    AdminVistLogs.InsertLog(userInfo.Uid, userInfo.Username, userInfo.Groupid, usergroupinfo.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", "");

                    try
                    {
                        SoftInfo.LoadSoftInfo();
                    }
                    catch
                    {
                        Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                        Response.End();
                    }

                    //升级general.config文件
                    try
                    {
                        GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config"));
                    }
                    catch { }

                    Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                    Response.End();
                }
                else
                {
                    Response.Redirect("syslogin.aspx?result=2");
                }
            }
            else
            {
                Response.Redirect("syslogin.aspx?result=1");
            }
        }
Ejemplo n.º 19
0
        public AdminPage()
        {
            if (!Page.IsPostBack)
            {
                this.RegisterAdminPageClientScriptBlock();
            }


            config = GeneralConfigs.GetConfig();


            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                    return;
                }
            }

            // 获取用户信息
            OnlineUserInfo oluserinfo    = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            UserGroupInfo  usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);

            if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }

            string secques = Users.GetUserInfo(oluserinfo.Userid).Secques;

            // 管理员身份验证
            if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null ||
                ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + secques + oluserinfo.Userid.ToString()))
            {
                Context.Response.Redirect(BaseConfigs.GetForumPath + "admin/syslogin.aspx");
                return;
            }
            else
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies["dntadmin"];
                cookie.Values["key"]    = ForumUtils.SetCookiePassword(oluserinfo.Password + secques + oluserinfo.Userid.ToString(), config.Passwordkey);
                cookie.Values["userid"] = oluserinfo.Userid.ToString();
                cookie.Expires          = DateTime.Now.AddMinutes(30);
                HttpContext.Current.Response.AppendCookie(cookie);
            }

            this.userid      = oluserinfo.Userid;
            this.username    = oluserinfo.Username;
            this.usergroupid = oluserinfo.Groupid;
            this.useradminid = (short)usergroupinfo.Radminid;
            this.grouptitle  = usergroupinfo.Grouptitle;
            this.ip          = DNTRequest.GetIP();


            //当前窗口不在Index.aspx页面上的FRAME中,则重定向到该框架中
            //if (DNTRequest.GetPageName() != "runforumstatic.aspx")
            //{
            //    Context.Response.Write("<script>if(top.mainFrame==null) top.location.href='/admin/index.aspx?fromurl=" + Context.Request.RawUrl + "';</script>");
            //    Context.Response.End();
            //    return;
            //}
        }
Ejemplo n.º 20
0
        public void LoadUserGroupInf(int groupid)
        {
            #region 加载相关组信息

            userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(groupid);

            groupTitle.Text         = Utils.RemoveFontTag(userGroupInfo.Grouptitle);
            creditshigher.Text      = userGroupInfo.Creditshigher.ToString();
            creditslower.Text       = userGroupInfo.Creditslower.ToString();
            stars.Text              = userGroupInfo.Stars.ToString();
            color.Text              = userGroupInfo.Color;
            groupavatar.Text        = userGroupInfo.Groupavatar;
            readaccess.Text         = userGroupInfo.Readaccess.ToString();
            maxprice.Text           = userGroupInfo.Maxprice.ToString();
            maxpmnum.Text           = userGroupInfo.Maxpmnum.ToString();
            maxsigsize.Text         = userGroupInfo.Maxsigsize.ToString();
            maxattachsize.Text      = userGroupInfo.Maxattachsize.ToString();
            maxsizeperday.Text      = userGroupInfo.Maxsizeperday.ToString();
            maxspaceattachsize.Text = userGroupInfo.Maxspaceattachsize.ToString();
            maxspacephotosize.Text  = userGroupInfo.Maxspacephotosize.ToString();
            //maxfriendscount.Text = userGroupInfo.MaxFriendsCount.ToString();

            if (groupid > 0 && groupid <= 3)
            {
                radminid.Enabled = false;
            }

            radminid.SelectedValue = userGroupInfo.Radminid.ToString();

            attachextensions.SetSelectByID(userGroupInfo.Attachextensions.Trim());

            //设置用户权限组初始化信息
            adminGroupInfo = AdminUserGroups.AdminGetAdminGroupInfo(userGroupInfo.Groupid);
            usergrouppowersetting.Bind(userGroupInfo);

            if (adminGroupInfo != null)
            {
                //设置管理权限组初始化信息
                admingroupright.SelectedIndex      = -1;
                admingroupright.Items[0].Selected  = adminGroupInfo.Alloweditpost == 1;
                admingroupright.Items[1].Selected  = adminGroupInfo.Alloweditpoll == 1;
                admingroupright.Items[2].Selected  = adminGroupInfo.Allowdelpost == 1;
                admingroupright.Items[3].Selected  = adminGroupInfo.Allowmassprune == 1;
                admingroupright.Items[4].Selected  = adminGroupInfo.Allowviewip == 1;
                admingroupright.Items[5].Selected  = adminGroupInfo.Allowedituser == 1;
                admingroupright.Items[6].Selected  = adminGroupInfo.Allowviewlog == 1;
                admingroupright.Items[7].Selected  = adminGroupInfo.Disablepostctrl == 1;
                admingroupright.Items[8].Selected  = adminGroupInfo.Allowviewrealname == 1;
                admingroupright.Items[9].Selected  = adminGroupInfo.Allowbanuser == 1;
                admingroupright.Items[10].Selected = adminGroupInfo.Allowbanip == 1;
                admingroupright.Items[11].Selected = adminGroupInfo.Allowmodpost == 1;
                admingroupright.Items[12].Selected = adminGroupInfo.Allowpostannounce == 1;
                GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                admingroupright.Items[13].Selected = ("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1;                               //是否允许接收举报信息
                admingroupright.Items[admingroupright.Items.Count - 1].Selected = ("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1; //是否允许管理图片评论
                if (adminGroupInfo.Allowstickthread.ToString() != "")
                {
                    allowstickthread.SelectedValue = adminGroupInfo.Allowstickthread.ToString();
                }
            }

            if (radminid.SelectedValue == "1")
            {
                allowstickthread.Enabled       = false;
                allowstickthread.SelectedValue = "3";
            }

            #endregion
        }
Ejemplo n.º 21
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新管理组信息

            if (this.CheckCookie())
            {
                Hashtable ht = new Hashtable();
                ht.Add("附件最大尺寸", maxattachsize.Text);
                ht.Add("每天最大附件总尺寸", maxsizeperday.Text);
                ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text);
                ht.Add("相册空间总尺寸", maxspacephotosize.Text);

                foreach (DictionaryEntry de in ht)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_editadminusergroup.aspx';</script>");
                        return;
                    }
                }
                userGroupInfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System     = 0;
                userGroupInfo.Type       = 0;
                userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text);

                int selectradminid = Convert.ToInt32(radminid.SelectedValue);
                //对于当前用户组中,有管理权限的,则设置管理权限
                if (selectradminid > 0 && selectradminid <= 3)
                {
                    adminGroupInfo          = new AdminGroupInfo();
                    adminGroupInfo.Admingid = (short)userGroupInfo.Groupid;
                    //插入相应的管理组
                    adminGroupInfo.Alloweditpost     = BoolToByte(admingroupright.Items[0].Selected);
                    adminGroupInfo.Alloweditpoll     = BoolToByte(admingroupright.Items[1].Selected);
                    adminGroupInfo.Allowstickthread  = (byte)Convert.ToInt16(allowstickthread.SelectedValue);
                    adminGroupInfo.Allowmodpost      = 0;
                    adminGroupInfo.Allowdelpost      = BoolToByte(admingroupright.Items[2].Selected);
                    adminGroupInfo.Allowmassprune    = BoolToByte(admingroupright.Items[3].Selected);
                    adminGroupInfo.Allowrefund       = 0;
                    adminGroupInfo.Allowcensorword   = 0;;
                    adminGroupInfo.Allowviewip       = BoolToByte(admingroupright.Items[4].Selected);
                    adminGroupInfo.Allowbanip        = 0;
                    adminGroupInfo.Allowedituser     = BoolToByte(admingroupright.Items[5].Selected);
                    adminGroupInfo.Allowmoduser      = 0;
                    adminGroupInfo.Allowbanuser      = 0;
                    adminGroupInfo.Allowpostannounce = 0;
                    adminGroupInfo.Allowviewlog      = BoolToByte(admingroupright.Items[6].Selected);
                    adminGroupInfo.Disablepostctrl   = BoolToByte(admingroupright.Items[7].Selected);
                    adminGroupInfo.Allowviewrealname = BoolToByte(admingroupright.Items[8].Selected);
                    adminGroupInfo.Allowbanuser      = BoolToByte(admingroupright.Items[9].Selected);
                    adminGroupInfo.Allowbanip        = BoolToByte(admingroupright.Items[10].Selected);
                    adminGroupInfo.Allowmodpost      = BoolToByte(admingroupright.Items[11].Selected);
                    adminGroupInfo.Allowpostannounce = BoolToByte(admingroupright.Items[12].Selected);

                    Discuz.Forum.AdminGroups.SetAdminGroupInfo(adminGroupInfo, userGroupInfo.Groupid);
                    userGroupInfo.Radminid = selectradminid;
                }
                else
                {
                    userGroupInfo.Radminid = 0;
                }

                AdminGroups.ChangeUserAdminidByGroupid(userGroupInfo.Radminid, userGroupInfo.Groupid);

                userGroupInfo.Grouptitle         = groupTitle.Text;
                userGroupInfo.Creditshigher      = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.Creditslower       = Convert.ToInt32(creditslower.Text);
                userGroupInfo.Stars              = Convert.ToInt32(stars.Text);
                userGroupInfo.Color              = color.Text;
                userGroupInfo.Groupavatar        = groupavatar.Text;
                userGroupInfo.Maxprice           = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum           = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize         = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize      = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday      = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize  = Convert.ToInt32(maxspacephotosize.Text);
                //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text);
                userGroupInfo.Attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);


                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    #region 是否允许接收举报信息和管理图片评论
                    GeneralConfigInfo configInfo = GeneralConfigs.GetConfig();
                    //是否允许接收举报信息
                    int groupid = userGroupInfo.Groupid;
                    if (admingroupright.Items[13].Selected)
                    {
                        if (("," + configInfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (configInfo.Reportusergroup == "")
                            {
                                configInfo.Reportusergroup = groupid.ToString();
                            }
                            else
                            {
                                configInfo.Reportusergroup += "," + groupid.ToString();
                            }
                        }
                    }
                    else
                    {
                        string tempstr = "";
                        foreach (string report in configInfo.Reportusergroup.Split(','))
                        {
                            if (report != groupid.ToString())
                            {
                                if (tempstr == "")
                                {
                                    tempstr = report;
                                }
                                else
                                {
                                    tempstr += "," + report;
                                }
                            }
                        }
                        configInfo.Reportusergroup = tempstr;
                    }
                    //是否允许管理图片评论
                    if (AlbumPluginProvider.GetInstance() != null)
                    {
                        if (admingroupright.Items[admingroupright.Items.Count - 1].Selected)
                        {
                            if (("," + configInfo.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1)
                            {
                                if (configInfo.Photomangegroups == "")
                                {
                                    configInfo.Photomangegroups = groupid.ToString();
                                }
                                else
                                {
                                    configInfo.Photomangegroups += "," + groupid.ToString();
                                }
                            }
                        }
                        else
                        {
                            string tempstr = "";
                            foreach (string photomangegroup in configInfo.Photomangegroups.Split(','))
                            {
                                if (photomangegroup != groupid.ToString())
                                {
                                    if (tempstr == "")
                                    {
                                        tempstr = photomangegroup;
                                    }
                                    else
                                    {
                                        tempstr += "," + photomangegroup;
                                    }
                                }
                            }
                            configInfo.Photomangegroups = tempstr;
                        }
                    }

                    GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config"));
                    #endregion
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");

                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新管理组", "组名:" + groupTitle.Text);
                    base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }
Ejemplo n.º 22
0
        //public AdminPage()
        //{
        //    this.RegisterAdminPageClientScriptBlock();
        //}

        public void AdminPageStart()
        {
            this.RegisterAdminPageClientScriptBlock();

            string sysloginPage = Shove._Web.Utility.GetUrl() + "/admin/syslogin.aspx";

            config = GeneralConfigs.GetConfig();

            // 如果IP访问列表有设置则进行判断
            if (config.Adminipaccess.Trim() != "")
            {
                string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                {
                    Context.Response.Redirect(sysloginPage);
                    return;
                }
            }

            #region 进行权限判断

            int userid = Discuz.Forum.Users.GetUserIDFromCookie();

            if (userid <= 0)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }

            UserInfo u = Discuz.Forum.Users.GetUserInfo(userid);

            if (u.Adminid < 1 || u.Groupid < 1)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }



            UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(u.Groupid);
            if (usergroupinfo.Radminid != 1)
            {
                Context.Response.Redirect(sysloginPage);
                return;
            }

            this.userid      = u.Uid;
            this.username    = u.Username;
            this.usergroupid = u.Groupid;
            this.useradminid = (short)usergroupinfo.Radminid;
            this.grouptitle  = usergroupinfo.Grouptitle;
            this.ip          = DNTRequest.GetIP();

            #endregion

            //当前窗口不在Index.aspx页面上的FRAME中,则重定向到该框架中
            //if (DNTRequest.GetPageName() != "runforumstatic.aspx")
            //{
            //    Context.Response.Write("<script>if(top.mainFrame==null) top.location.href='/admin/index.aspx?fromurl=" + Context.Request.RawUrl + "';</script>");
            //    Context.Response.End();
            //    return;
            //}
        }
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新特殊用户组信息

            if (this.CheckCookie())
            {
                __usergroupinfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                __usergroupinfo.System     = 0;
                __usergroupinfo.Type       = 0;
                __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text);

                int selectradminid = radminid.SelectedValue == "0" ? -1 : Convert.ToInt32(radminid.SelectedValue);
                __usergroupinfo.Radminid = selectradminid;

                if (selectradminid.ToString() != ViewState["radminid"].ToString())
                {
                    //DbHelper.ExecuteNonQuery("UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [adminid]=" + __usergroupinfo.Radminid + " WHERE [groupid]=" + __usergroupinfo.Groupid);
                    DatabaseProvider.GetInstance().ChangeUserAdminidByGroupid(__usergroupinfo.Radminid, __usergroupinfo.Groupid);
                }

                //__usergroupinfo.Allowvisit = BoolToInt(usergroupright.Items[0].Selected);
                //__usergroupinfo.Allowpost = BoolToInt(usergroupright.Items[1].Selected);
                //__usergroupinfo.Allowreply = BoolToInt(usergroupright.Items[2].Selected);
                //__usergroupinfo.Allowpostpoll = BoolToInt(usergroupright.Items[3].Selected);
                //__usergroupinfo.Allowdirectpost = 1;
                //__usergroupinfo.Allowgetattach = BoolToInt(usergroupright.Items[4].Selected);
                //__usergroupinfo.Allowpostattach = BoolToInt(usergroupright.Items[5].Selected);
                //__usergroupinfo.Allowvote = BoolToInt(usergroupright.Items[6].Selected);
                //__usergroupinfo.Allowmultigroups = 0;
                //__usergroupinfo.Allowsearch = Convert.ToInt32(allowsearch.SelectedValue);
                //__usergroupinfo.Allowcstatus = 0;
                //__usergroupinfo.Allowuseblog = 0;
                //__usergroupinfo.Allowinvisible = 0;
                //__usergroupinfo.Allowtransfer = 0;
                //__usergroupinfo.Allowsetreadperm = BoolToInt(usergroupright.Items[7].Selected);
                //__usergroupinfo.Allowsetattachperm = BoolToInt(usergroupright.Items[8].Selected);
                //__usergroupinfo.Allowhidecode = BoolToInt(usergroupright.Items[9].Selected);
                //__usergroupinfo.Allowhtml = 0;
                //__usergroupinfo.Allowcusbbcode = BoolToInt(usergroupright.Items[10].Selected);
                //__usergroupinfo.Allownickname = 0;
                //__usergroupinfo.Allowsigbbcode = BoolToInt(usergroupright.Items[11].Selected);
                //__usergroupinfo.Allowsigimgcode = BoolToInt(usergroupright.Items[12].Selected);
                //__usergroupinfo.Allowviewpro = BoolToInt(usergroupright.Items[13].Selected);
                //__usergroupinfo.Allowviewstats = 0;
                //__usergroupinfo.Disableperiodctrl = BoolToInt(usergroupright.Items[14].Selected);
                //__usergroupinfo.Reasonpm = 0;

                //__usergroupinfo.Allowavatar = Convert.ToInt16(allowavatar.SelectedValue);
                __usergroupinfo.Grouptitle = groupTitle.Text;

                __usergroupinfo.Stars            = Convert.ToInt32(stars.Text);
                __usergroupinfo.Color            = color.Text;
                __usergroupinfo.Groupavatar      = groupavatar.Text;
                __usergroupinfo.Maxprice         = Convert.ToInt32(maxprice.Text);
                __usergroupinfo.Maxpmnum         = Convert.ToInt32(maxpmnum.Text);
                __usergroupinfo.Maxsigsize       = Convert.ToInt32(maxsigsize.Text);
                __usergroupinfo.Maxattachsize    = Convert.ToInt32(maxattachsize.Text);
                __usergroupinfo.Maxsizeperday    = Convert.ToInt32(maxsizeperday.Text);
                __usergroupinfo.Attachextensions = attachextensions.GetSelectString(",");

                //GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                usergrouppowersetting.GetSetting(ref __usergroupinfo);
                if (AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo))
                {
                    //GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("../../config/general.config"));
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    UserGroups.GetUserGroupList();
                    AdminVistLogs.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';");
                }
                else
                {
                    if (AdminUserGroups.opresult != "")
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                    }
                }
            }

            #endregion
        }
Ejemplo n.º 24
0
        public void VerifyLoginInf()
        {
            if (!OnlineUsers.CheckUserVerifyCode(olid, DNTRequest.GetString("vcode")))
            {
                Response.Redirect("syslogin.aspx?result=3");
                return;
            }

            DataTable dt = new DataTable();

            if (config.Passwordmode == 1)
            {
                int uid = Discuz.Forum.Users.CheckDvBbsPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"));

                dt = DatabaseProvider.GetInstance().GetUserInfo(uid);
            }
            else
            {
                dt = DatabaseProvider.GetInstance().GetUserInfo(UserName.Text.Trim(), Utils.MD5(PassWord.Text.Trim()));
            }


            if (dt.Rows.Count > 0)
            {
                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dt.Rows[0]["groupid"].ToString()));

                if (usergroupinfo.Radminid == 1)
                {
                    ForumUtils.WriteUserCookie(Convert.ToInt32(dt.Rows[0]["uid"].ToString().Trim()), 1440, GeneralConfigs.GetConfig().Passwordkey);

                    int    userid      = Convert.ToInt32(dt.Rows[0]["uid"].ToString().Trim());
                    string username    = UserName.Text.Trim();
                    int    usergroupid = Convert.ToInt16(dt.Rows[0]["groupid"].ToString().Trim());
                    string secques     = dt.Rows[0]["secques"].ToString().Trim();
                    string ip          = DNTRequest.GetIP();

                    UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(usergroupid);

                    string grouptitle = __usergroupinfo.Grouptitle;


                    HttpCookie cookie = new HttpCookie("dntadmin");
                    cookie.Values["key"] = ForumUtils.SetCookiePassword(Utils.MD5(PassWord.Text.Trim()) + secques + userid.ToString(), config.Passwordkey);
                    cookie.Expires       = DateTime.Now.AddMinutes(30);
                    HttpContext.Current.Response.AppendCookie(cookie);

                    AdminVistLogs.InsertLog(userid, username, usergroupid, grouptitle, ip, "后台管理员登陆", "");

                    try
                    {
                        SoftInfo.LoadSoftInfo();
                    }
                    catch
                    {
                        Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                        Response.End();
                    }

                    //升级general.config文件
                    try
                    {
                        GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config"));
                    }
                    catch { }


                    Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>");
                    Response.End();
                    return;
                }
                else
                {
                    Response.Redirect("syslogin.aspx?result=2");
                    return;
                }
            }
            else
            {
                Response.Redirect("syslogin.aspx?result=1");
                return;
            }
        }
Ejemplo n.º 25
0
        public void Submit_Click(object sender, EventArgs e)
        {
            config.Enablespace = int.Parse(EnableSpace.SelectedValue);
            GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config"));
            if (!Utils.IsInt(Postcount.Text))
            {
                base.RegisterStartupScript("", "<script>alert('论坛发帖数超过输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>");
                return;
            }
            if (!Utils.IsInt(Digestcount.Text))
            {
                base.RegisterStartupScript("", "<script>alert('论坛精华帖数输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>");
                return;
            }
            if (!Utils.IsInt(Score.Text))
            {
                base.RegisterStartupScript("", "<script>alert('论坛用户积分输入错误,请检查');window.location.href='space_spaceapplysetting.aspx';</script>");
                return;
            }


            if (config.Enablespace == 1)
            {
                XmlDocument xmlDoc   = new XmlDocument();
                string      filePath = Server.MapPath("../../config/space.config");
                xmlDoc.Load(filePath);
                XmlNode root = xmlDoc.SelectSingleNode("SpaceActiveConfigInfo");
                XmlNodeInnerTextVisitor rootvisitor = new XmlNodeInnerTextVisitor();
                rootvisitor.SetNode(root);
                rootvisitor["AllowPostcount"]   = allowPostcount.Checked ? "1" : "0";
                rootvisitor["Postcount"]        = Postcount.Text;
                rootvisitor["AllowDigestcount"] = allowDigestcount.Checked ? "1" : "0";
                rootvisitor["Digestcount"]      = Digestcount.Text;
                rootvisitor["AllowScore"]       = allowScore.Checked ? "1" : "0";
                rootvisitor["Score"]            = Score.Text;
                rootvisitor["AllowUsergroups"]  = allowUserGroup.Checked ? "1" : "0";
                string groupList = "";
                for (int i = 0; i < UserGroup.Items.Count; i++)
                {
                    if (UserGroup.Items[i].Selected)
                    {
                        groupList += UserGroup.Items[i].Value + ",";
                    }
                }
                if (groupList == "")
                {
                    rootvisitor["Usergroups"] = "";
                }
                else
                {
                    rootvisitor["Usergroups"] = groupList.Substring(0, groupList.Length - 1);
                }
                rootvisitor["ActiveType"] = ActiveType.SelectedValue;
                xmlDoc.Save(filePath);
                //保存个人空间最大附件空间
                DataTable dt = DatabaseProvider.GetInstance().GetUserGroupMaxspaceattachsize();
                foreach (DataRow dr in dt.Rows)
                {
                    if (!Utils.IsInt(DNTRequest.GetString("maxspaceattachsize" + dr["groupid"].ToString()).ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误,空间附件最大空间只能是0或者正整数');window.location.href='space_spaceapplysetting.aspx';</script>");
                        return;
                    }

                    int attachsize = DNTRequest.GetInt("maxspaceattachsize" + dr["groupid"].ToString(), 0);
                    Discuz.Entity.UserGroupInfo __usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(dr["groupid"].ToString()));
                    __usergroupinfo.Maxspaceattachsize = attachsize;
                    AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo);
                }
                Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
            }
            Response.Redirect("space_spaceapplysetting.aspx");
        }
Ejemplo n.º 26
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新用户组信息

            if (this.CheckCookie())
            {
                Hashtable ht = new Hashtable();
                ht.Add("附件最大尺寸", maxattachsize.Text);
                ht.Add("每天最大附件总尺寸", maxsizeperday.Text);
                ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text);
                ht.Add("相册空间总尺寸", maxspacephotosize.Text);

                foreach (DictionaryEntry de in ht)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_editusergroup.aspx';</script>");
                        return;
                    }
                }

                if (creditshigher.Enabled == true)
                {
                    if (Convert.ToInt32(creditshigher.Text) < Convert.ToInt32(ViewState["creditshigher"].ToString()) || Convert.ToInt32(creditslower.Text) > Convert.ToInt32(ViewState["creditslower"].ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败, 您所输入的积分上下限范围应在" + ViewState["creditshigher"].ToString() + "至" + ViewState["creditslower"].ToString() + "之间');</script>");
                        return;
                    }
                }

                userGroupInfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System     = 0;
                userGroupInfo.Type       = 0;
                userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text);
                usergrouppowersetting.GetSetting(ref userGroupInfo);
                userGroupInfo.Grouptitle = groupTitle.Text;

                userGroupInfo.Creditshigher = Convert.ToInt32(creditshigher.Text);
                userGroupInfo.Creditslower  = Convert.ToInt32(creditslower.Text);

                if (userGroupInfo.Creditshigher >= userGroupInfo.Creditslower)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败, 积分下限必须小于积分上限');</script>");
                    return;
                }
                if (userGroupInfo.Allowbonus == 1 && (userGroupInfo.Minbonusprice >= userGroupInfo.Maxbonusprice))
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>");
                    return;
                }

                userGroupInfo.Stars              = Convert.ToInt32(stars.Text);
                userGroupInfo.Color              = color.Text;
                userGroupInfo.Groupavatar        = groupavatar.Text;
                userGroupInfo.Maxprice           = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum           = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize         = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize      = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday      = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize  = Convert.ToInt32(maxspacephotosize.Text);
                userGroupInfo.Attachextensions   = attachextensions.GetSelectString(",");
                //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text);

                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    Discuz.Forum.UserGroups.GetUserGroupList();
                    AdminVistLogs.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';");
                }
                else
                {
                    if (AdminUserGroups.opresult != "")
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupgrid.aspx';</script>");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>");
                    }
                }
            }

            #endregion
        }
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新特殊用户组信息

            if (this.CheckCookie())
            {
                Hashtable ht = new Hashtable();
                ht.Add("附件最大尺寸", maxattachsize.Text);
                ht.Add("每天最大附件总尺寸", maxsizeperday.Text);
                ht.Add("个人空间附件总尺寸", maxspaceattachsize.Text);
                ht.Add("相册空间总尺寸", maxspacephotosize.Text);

                foreach (DictionaryEntry de in ht)
                {
                    if (!Utils.IsInt(de.Value.ToString()))
                    {
                        base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                        return;
                    }
                }


                userGroupInfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                userGroupInfo.System     = 0;
                userGroupInfo.Type       = 0;
                userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text);

                int selectradminid = radminid.SelectedValue == "0" ? -1 : Convert.ToInt32(radminid.SelectedValue);
                userGroupInfo.Radminid = selectradminid;

                if (selectradminid.ToString() != ViewState["radminid"].ToString())
                {
                    Users.UpdateUserAdminIdByGroupId(userGroupInfo.Radminid, userGroupInfo.Groupid);
                }

                userGroupInfo.Grouptitle         = groupTitle.Text;
                userGroupInfo.Stars              = Convert.ToInt32(stars.Text);
                userGroupInfo.Color              = color.Text;
                userGroupInfo.Groupavatar        = groupavatar.Text;
                userGroupInfo.Maxprice           = Convert.ToInt32(maxprice.Text);
                userGroupInfo.Maxpmnum           = Convert.ToInt32(maxpmnum.Text);
                userGroupInfo.Maxsigsize         = Convert.ToInt32(maxsigsize.Text);
                userGroupInfo.Maxattachsize      = Convert.ToInt32(maxattachsize.Text);
                userGroupInfo.Maxsizeperday      = Convert.ToInt32(maxsizeperday.Text);
                userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text);
                userGroupInfo.Maxspacephotosize  = Convert.ToInt32(maxspacephotosize.Text);
                //userGroupInfo.MaxFriendsCount = Convert.ToInt32(maxfriendscount.Text);
                userGroupInfo.Attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref userGroupInfo);
                if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo))
                {
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    Discuz.Forum.UserGroups.GetUserGroupList();
                    AdminVistLogs.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';");
                }
                else
                {
                    if (AdminUserGroups.opresult != "")
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                    }
                    else
                    {
                        base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>");
                    }
                }
            }

            #endregion
        }
Ejemplo n.º 28
0
        protected void Origin_Page_Load(object sender, EventArgs e)
        {
            UserName.Attributes.Remove("class");
            PassWord.Attributes.Remove("class");
            UserName.AddAttributes("style", "width:200px");
            PassWord.AddAttributes("style", "width:200px");

            config = GeneralConfigs.GetConfig();

            OnlineUserInfo oluserinfo = Discuz.Forum.OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);

            olid = oluserinfo.Olid;

            if (!Page.IsPostBack)
            {
                #region 如果IP访问列表有设置则进行判断
                if (config.Adminipaccess.Trim() != "")
                {
                    string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n");
                    if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl))
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("<br /><br /><div style=\"width:100%\" align=\"center\"><div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\">");
                        sb.Append("<img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" />&nbsp; 您的IP地址不在系统允许的范围之内</div></div>");
                        Response.Write(sb.ToString());
                        Response.End();
                        return;
                    }
                }
                #endregion

                #region 用户身份判断
                UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid);
                if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1)
                {
                    string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                    message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>无法确认您的身份</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
                    message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">";
                    message += "<div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> &nbsp;";
                    message += "无法确认您的身份, 请<a href=\"../login.aspx\">登录</a></div></div></body></html>";
                    Response.Write(message);
                    Response.End();
                    return;
                }
                #endregion


                #region 判断安装目录文件信息
                if (IsExistsSetupFile())
                {
                    string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
                    message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>请将您的安装目录即install/目录下的文件全部删除, 以免其它用户运行安装该程序!</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
                    message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">";
                    message += "<div align=\"center\" style=\"width:660px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> &nbsp;";
                    message += "请将您的安装目录(install/)下和升级目录(upgrade/)下的.aspx文件及bin/Discuz.Install.dll全部删除, 以免其它用户运行安装或升级程序!</div></div></body></html>";
                    Response.Write(message);
                    Response.End();
                    return;
                }
                #endregion


                #region 显示相关页面登陆提交信息
                if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null ||
                    ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) !=
                    (oluserinfo.Password + Discuz.Forum.Users.GetUserInfo(oluserinfo.Userid).Secques + oluserinfo.Userid.ToString()))
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\">请重新进行管理员登录";
                }

                if (oluserinfo.Userid > 0 && usergroupinfo.Radminid == 1 && oluserinfo.Username.Trim() != "")
                {
                    UserName.Text = oluserinfo.Username;
                    UserName.AddAttributes("readonly", "true");
                    UserName.CssClass = "nofocus";
                    UserName.Attributes.Add("onfocus", "this.className='nofocus';");
                    UserName.Attributes.Add("onblur", "this.className='nofocus';");
                }

                if (DNTRequest.GetString("result") == "1")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不存在或密码错误</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "2")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不是管理员身分,因此无法登陆后台</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "3")
                {
                    Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">验证码错误,请重新输入</font>";
                    return;
                }

                if (DNTRequest.GetString("result") == "4")
                {
                    Msg.Text = "";
                    return;
                }
                #endregion
            }

            if (Page.IsPostBack)
            {
                VerifyLoginInf();//对提供的信息进行验证
            }
            else
            {
                Response.Redirect("syslogin.aspx?result=4");
            }
        }
Ejemplo n.º 29
0
        private UserInfo CreateUserInfo()
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Username = userName.Text;
            userInfo.Nickname = userName.Text;
            userInfo.Password = password.Text;
            userInfo.Secques  = "";
            userInfo.Gender   = 0;
            int selectgroupid = Convert.ToInt32(groupid.SelectedValue);

            userInfo.Adminid       = AdminUserGroups.AdminGetUserGroupInfo(selectgroupid).Radminid;
            userInfo.Groupid       = selectgroupid;
            userInfo.Groupexpiry   = 0;
            userInfo.Extgroupids   = "";
            userInfo.Regip         = "";
            userInfo.Joindate      = Utils.GetDate();
            userInfo.Lastip        = "";
            userInfo.Lastvisit     = Utils.GetDate();
            userInfo.Lastactivity  = Utils.GetDate();
            userInfo.Lastpost      = Utils.GetDate();
            userInfo.Lastpostid    = 0;
            userInfo.Lastposttitle = "";
            userInfo.Posts         = 0;
            userInfo.Digestposts   = 0;
            userInfo.Oltime        = 0;
            userInfo.Pageviews     = 0;
            userInfo.Credits       = Convert.ToInt32(credits.Text);
            userInfo.Extcredits1   = 0;
            userInfo.Extcredits2   = 0;
            userInfo.Extcredits3   = 0;
            userInfo.Extcredits4   = 0;
            userInfo.Extcredits5   = 0;
            userInfo.Extcredits6   = 0;
            userInfo.Extcredits7   = 0;
            userInfo.Extcredits8   = 0;
            userInfo.Salt          = "0";
            //userInfo.Avatarshowid = 1;
            userInfo.Email     = email.Text;
            userInfo.Bday      = "";
            userInfo.Sigstatus = 0;

            userInfo.Templateid  = GeneralConfigs.GetConfig().Templateid;
            userInfo.Tpp         = 16;
            userInfo.Ppp         = 16;
            userInfo.Pmsound     = 1;
            userInfo.Showemail   = 1;
            userInfo.Newsletter  = (ReceivePMSettingType)7;
            userInfo.Invisible   = 0;
            userInfo.Newpm       = 0;
            userInfo.Accessmasks = 0;

            //扩展信息
            userInfo.Website      = "";
            userInfo.Icq          = "";
            userInfo.Qq           = "";
            userInfo.Yahoo        = "";
            userInfo.Msn          = "";
            userInfo.Skype        = "";
            userInfo.Location     = "";
            userInfo.Customstatus = "";
            //userInfo.Avatar = "";
            //userInfo.Avatarwidth = 32;
            //userInfo.Avatarheight = 32;
            userInfo.Medals    = "";
            userInfo.Bio       = "";
            userInfo.Signature = userName.Text;
            userInfo.Sightml   = "";
            userInfo.Authstr   = "";
            userInfo.Realname  = realname.Text;
            userInfo.Idcard    = idcard.Text;
            userInfo.Mobile    = mobile.Text;
            userInfo.Phone     = phone.Text;
            return(userInfo);
        }
Ejemplo n.º 30
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            #region 更新管理组信息

            if (this.CheckCookie())
            {
                __usergroupinfo            = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1));
                __usergroupinfo.System     = 0;
                __usergroupinfo.Type       = 0;
                __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text);

                if (radminid.SelectedValue == "0") //当未选取任何管理模板时
                {
                    AdminGroups.DeleteAdminGroupInfo((short)__usergroupinfo.Groupid);
                    __usergroupinfo.Radminid = 0;
                }
                else //当选取相应的管理模板时
                {
                    int selectradminid = Convert.ToInt32(radminid.SelectedValue);
                    ///对于当前用户组中,有管理权限的,则设置管理权限
                    if (selectradminid > 0 && selectradminid <= 3)
                    {
                        __admingroupinfo          = new AdminGroupInfo();
                        __admingroupinfo.Admingid = (short)__usergroupinfo.Groupid;

                        //插入相应的管理组
                        __admingroupinfo.Alloweditpost     = BoolToByte(admingroupright.Items[0].Selected);
                        __admingroupinfo.Alloweditpoll     = BoolToByte(admingroupright.Items[1].Selected);
                        __admingroupinfo.Allowstickthread  = (byte)Convert.ToInt16(allowstickthread.SelectedValue);
                        __admingroupinfo.Allowmodpost      = 0;
                        __admingroupinfo.Allowdelpost      = BoolToByte(admingroupright.Items[2].Selected);
                        __admingroupinfo.Allowmassprune    = BoolToByte(admingroupright.Items[3].Selected);
                        __admingroupinfo.Allowrefund       = 0;
                        __admingroupinfo.Allowcensorword   = 0;;
                        __admingroupinfo.Allowviewip       = BoolToByte(admingroupright.Items[4].Selected);
                        __admingroupinfo.Allowbanip        = 0;
                        __admingroupinfo.Allowedituser     = BoolToByte(admingroupright.Items[5].Selected);
                        __admingroupinfo.Allowmoduser      = 0;
                        __admingroupinfo.Allowbanuser      = 0;
                        __admingroupinfo.Allowpostannounce = 0;
                        __admingroupinfo.Allowviewlog      = BoolToByte(admingroupright.Items[6].Selected);
                        __admingroupinfo.Disablepostctrl   = BoolToByte(admingroupright.Items[7].Selected);
                        __admingroupinfo.Allowviewrealname = BoolToByte(admingroupright.Items[8].Selected);
                        __admingroupinfo.Allowbanuser      = BoolToByte(admingroupright.Items[9].Selected);
                        __admingroupinfo.Allowbanip        = BoolToByte(admingroupright.Items[10].Selected);

                        //当已有记录时
                        if (DatabaseProvider.GetInstance().GetAdmingid(__usergroupinfo.Groupid).Rows.Count > 0)
                        {
                            //更新相应的管理组
                            AdminGroups.SetAdminGroupInfo(__admingroupinfo);
                        }
                        else
                        { //建立相应的用户组
                            AdminGroups.CreateAdminGroupInfo(__admingroupinfo);
                        }
                        __usergroupinfo.Radminid = selectradminid;
                    }
                    else
                    {
                        __usergroupinfo.Radminid = 0;
                    }
                }

                DatabaseProvider.GetInstance().ChangeUserAdminidByGroupid(__usergroupinfo.Radminid, __usergroupinfo.Groupid);

                __usergroupinfo.Grouptitle       = groupTitle.Text;
                __usergroupinfo.Creditshigher    = Convert.ToInt32(creditshigher.Text);
                __usergroupinfo.Creditslower     = Convert.ToInt32(creditslower.Text);
                __usergroupinfo.Stars            = Convert.ToInt32(stars.Text);
                __usergroupinfo.Color            = color.Text;
                __usergroupinfo.Groupavatar      = groupavatar.Text;
                __usergroupinfo.Maxprice         = Convert.ToInt32(maxprice.Text);
                __usergroupinfo.Maxpmnum         = Convert.ToInt32(maxpmnum.Text);
                __usergroupinfo.Maxsigsize       = Convert.ToInt32(maxsigsize.Text);
                __usergroupinfo.Maxattachsize    = Convert.ToInt32(maxattachsize.Text);
                __usergroupinfo.Maxsizeperday    = Convert.ToInt32(maxsizeperday.Text);
                __usergroupinfo.Attachextensions = attachextensions.GetSelectString(",");

                usergrouppowersetting.GetSetting(ref __usergroupinfo);


                if (AdminUserGroups.UpdateUserGroupInfo(__usergroupinfo))
                {
                    #region 是否允许接收举报信息和管理图片评论
                    GeneralConfigInfo configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                    //是否允许接收举报信息
                    int groupid = __usergroupinfo.Groupid;
                    if (admingroupright.Items[11].Selected)
                    {
                        if (("," + configinfo.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1)
                        {
                            if (configinfo.Reportusergroup == "")
                            {
                                configinfo.Reportusergroup = groupid.ToString();
                            }
                            else
                            {
                                configinfo.Reportusergroup += "," + groupid.ToString();
                            }
                        }
                    }
                    else
                    {
                        string tempstr = "";
                        foreach (string report in configinfo.Reportusergroup.Split(','))
                        {
                            if (report != groupid.ToString())
                            {
                                if (tempstr == "")
                                {
                                    tempstr = report;
                                }
                                else
                                {
                                    tempstr += "," + report;
                                }
                            }
                        }
                        configinfo.Reportusergroup = tempstr;
                    }

                    GeneralConfigs.Serialiaze(configinfo, AppDomain.CurrentDomain.BaseDirectory + "config/general.config");
                    #endregion
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList");
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList");

                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新管理组", "组名:" + groupTitle.Text);
                    base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>");
                }
            }

            #endregion
        }