Ejemplo n.º 1
0
 private void ComUsergroup_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         if (this.sourceusergroup.SelectedIndex == 0 || this.targetusergroup.SelectedIndex == 0)
         {
             base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的用户组!');</script>");
             return;
         }
         if (this.sourceusergroup.SelectedValue == this.targetusergroup.SelectedValue)
         {
             base.RegisterStartupScript("", "<script>alert('操作失败,同一个用户组不能够合并!');</script>");
             return;
         }
         UserGroup src = UserGroup.FindByID(int.Parse(this.sourceusergroup.SelectedValue));
         UserGroup des = UserGroup.FindByID(int.Parse(this.targetusergroup.SelectedValue));
         if (src.Creditslower != des.Creditshigher)
         {
             base.RegisterStartupScript("", "<script>alert('操作失败,要合并的用户组必须是积分相连的两个用户组!');</script>");
             return;
         }
         //var userGroupInfo = UserGroup.FindByID(int.Parse(this.targetusergroup.SelectedValue));
         des.Creditshigher = src.Creditshigher;
         //UserGroups.UpdateUserGroup(userGroupInfo);
         des.Save();
         //UserGroups.DeleteUserGroupInfo(int.Parse(this.sourceusergroup.SelectedValue));
         src.Delete();
         UserGroup.ChangeAllUserGroupId(int.Parse(this.sourceusergroup.SelectedValue), int.Parse(this.targetusergroup.SelectedValue));
         //XCache.Remove(CacheKeys.FORUM_USER_GROUP_LIST);
         AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并用户组", "把组ID:" + this.sourceusergroup.SelectedIndex + " 合并到组ID:" + this.targetusergroup.SelectedIndex);
         base.RegisterStartupScript("PAGE", "window.location.href='usergroupgrid.aspx';");
     }
 }
Ejemplo n.º 2
0
 public void LoadUserGroupInf(int groupid)
 {
     this.userGroupInfo      = UserGroup.FindByID(groupid);
     this.groupTitle.Text    = Utils.RemoveFontTag(this.userGroupInfo.GroupTitle);
     this.creditshigher.Text = this.userGroupInfo.Creditshigher.ToString();
     this.creditslower.Text  = this.userGroupInfo.Creditslower.ToString();
     if (UserGroup.GetUserGroupExceptGroupid(groupid).Count == 0)
     {
         this.creditshigher.Enabled = false;
         this.creditslower.Enabled  = false;
     }
     this.ViewState["creditshigher"] = this.userGroupInfo.Creditshigher.ToString();
     this.ViewState["creditslower"]  = this.userGroupInfo.Creditslower.ToString();
     this.stars.Text         = this.userGroupInfo.Stars.ToString();
     this.color.Text         = this.userGroupInfo.Color;
     this.groupavatar.Text   = this.userGroupInfo.Groupavatar;
     this.readaccess.Text    = this.userGroupInfo.Readaccess.ToString();
     this.maxprice.Text      = this.userGroupInfo.MaxPrice.ToString();
     this.maxpmnum.Text      = this.userGroupInfo.MaxPmNum.ToString();
     this.maxsigsize.Text    = this.userGroupInfo.MaxSigSize.ToString();
     this.maxattachsize.Text = this.userGroupInfo.MaxAttachSize.ToString();
     this.maxsizeperday.Text = this.userGroupInfo.MaxSizeperday.ToString();
     this.attachextensions.SetSelectByID(this.userGroupInfo.AttachExtensions.Trim());
     this.usergrouppowersetting.Bind(this.userGroupInfo);
     if (this.userGroupInfo.System == 1)
     {
         this.DeleteUserGroupInf.Enabled = false;
     }
 }
Ejemplo n.º 3
0
        /// <summary>被扣除积分以后,可能会降低用户级别</summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int UpdateUserCredits(int userId)
        {
            User.UpdateUserCredits(userId);
            IUser user = (userId > 0) ? User.FindByID(userId) : null;

            if (user == null)
            {
                return(0);
            }

            // 被扣除积分以后,可能会降低用户级别
            var ug = UserGroup.FindByID(user.GroupID);

            if (ug != null && ug.IsCreditUserGroup)
            {
                ug = GetCreditsUserGroupId((float)user.Credits);
                if (ug.ID != user.GroupID)
                {
                    //BBX.Data.Users.UpdateUserGroup(user.ID.ToString(), ug.ID);
                    user.GroupID = ug.ID;
                    (user as User).Save();
                    Online.UpdateGroupid(user.ID, ug.ID);
                }
            }
            var httpCookie = HttpContext.Current.Request.Cookies["bbx"];

            if (httpCookie != null && httpCookie["userid"] == userId.ToString())
            {
                ForumUtils.WriteUserCreditsCookie(user, ug.GroupTitle);
            }
            return(1);
        }
Ejemplo n.º 4
0
        public void WriteScoreInf(DataTable dt)
        {
            string text = "";

            foreach (DataRow dataRow in dt.Rows)
            {
                text += string.Format("{0},{1},{2},{3},{4},{5},{6}|", new object[]
                {
                    dataRow["id"].ToString(),
                    dataRow["available"].ToString(),
                    dataRow["ScoreCode"].ToString(),
                    dataRow["ScoreName"].ToString(),
                    dataRow["Min"].ToString(),
                    dataRow["Max"].ToString(),
                    dataRow["MaxInDay"].ToString()
                });
            }
            //UserGroup.UpdateUserGroupRaterange(text.Substring(0, text.Length - 1), DNTRequest.GetInt("groupid", 0));
            var ug = UserGroup.FindByID(DNTRequest.GetInt("groupid", 0));

            ug.Raterange = text.Substring(0, text.Length - 1);
            ug.Update();

            this.templateDT.Clear();
            //Caches.ReSetUserGroupList();
        }
Ejemplo n.º 5
0
 public void LoadUserGroupInf(int groupid)
 {
     this.userGroupInfo      = UserGroup.FindByID(groupid);
     this.groupTitle.Text    = Utils.RemoveFontTag(this.userGroupInfo.GroupTitle);
     this.creditshigher.Text = this.userGroupInfo.Creditshigher.ToString();
     this.creditslower.Text  = this.userGroupInfo.Creditslower.ToString();
     this.stars.Text         = this.userGroupInfo.Stars.ToString();
     this.color.Text         = this.userGroupInfo.Color;
     this.groupavatar.Text   = this.userGroupInfo.Groupavatar;
     this.readaccess.Text    = this.userGroupInfo.Readaccess.ToString();
     this.maxprice.Text      = this.userGroupInfo.MaxPrice.ToString();
     this.maxpmnum.Text      = this.userGroupInfo.MaxPmNum.ToString();
     this.maxsigsize.Text    = this.userGroupInfo.MaxSigSize.ToString();
     this.maxattachsize.Text = this.userGroupInfo.MaxAttachSize.ToString();
     this.maxsizeperday.Text = this.userGroupInfo.MaxSizeperday.ToString();
     //this.maxspaceattachsize.Text = this.userGroupInfo.MaxSpaceattachSize.ToString();
     //this.maxspacephotosize.Text = this.userGroupInfo.MaxSpacephotoSize.ToString();
     this.attachextensions.SetSelectByID(this.userGroupInfo.AttachExtensions.Trim());
     if (groupid > 0 && groupid <= 3)
     {
         this.radminid.Enabled = false;
     }
     this.radminid.SelectedValue = this.userGroupInfo.RadminID.ToString();
     this.usergrouppowersetting.Bind(this.userGroupInfo);
     if (this.radminid.SelectedValue == "1")
     {
         //this.allowstickthread.Enabled = false;
         //this.allowstickthread.SelectedValue = "3";
     }
 }
Ejemplo n.º 6
0
        private void radminid_SelectedIndexChanged(object sender, EventArgs e)
        {
            UserGroup userGroupInfo = UserGroup.FindByID(int.Parse(this.radminid.SelectedValue));

            if (userGroupInfo != null)
            {
                this.creditshigher.Text = userGroupInfo.Creditslower.ToString();
                this.creditslower.Text  = userGroupInfo.Creditslower.ToString();
                this.stars.Text         = userGroupInfo.Stars.ToString();
                this.color.Text         = userGroupInfo.Color;
                this.groupavatar.Text   = userGroupInfo.Groupavatar;
                this.readaccess.Text    = userGroupInfo.Readaccess.ToString();
                this.maxprice.Text      = userGroupInfo.MaxPrice.ToString();
                this.maxpmnum.Text      = userGroupInfo.MaxPmNum.ToString();
                this.maxsigsize.Text    = userGroupInfo.MaxSigSize.ToString();
                this.maxattachsize.Text = userGroupInfo.MaxAttachSize.ToString();
                this.maxsizeperday.Text = userGroupInfo.MaxSizeperday.ToString();
                DataTable attachmentType = AttachType.FindAllWithCache().ToDataTable(false);
                this.attachextensions.AddTableData(attachmentType, userGroupInfo.AttachExtensions);
            }
            AdminGroup adminGroupInfo = AdminGroup.FindByID(int.Parse(this.radminid.SelectedValue));

            if (adminGroupInfo != null)
            {
                //admingroupright.SelectedIndex = -1;
                //admingroupright.Items[0].Selected = adminGroupInfo.AllowEditPost;
                //admingroupright.Items[1].Selected = adminGroupInfo.AllowEditpoll;
                //admingroupright.Items[2].Selected = adminGroupInfo.AllowDelPost;
                //admingroupright.Items[3].Selected = adminGroupInfo.AllowMassprune;
                //admingroupright.Items[4].Selected = adminGroupInfo.AllowViewIP;
                //admingroupright.Items[5].Selected = adminGroupInfo.AllowEditUser;
                //admingroupright.Items[6].Selected = adminGroupInfo.AllowViewLog;
                //admingroupright.Items[7].Selected = adminGroupInfo.DisablePostctrl;
            }
        }
Ejemplo n.º 7
0
 protected void EditUserGroup_Click(object sender, EventArgs e)
 {
     try
     {
         int               num        = 0;
         ArrayList         arrayList  = new ArrayList();
         ArrayList         arrayList2 = new ArrayList();
         List <UserGroup2> ugs        = new List <UserGroup2>();
         foreach (object current in this.DataGrid1.GetKeyIDArray())
         {
             int    id           = int.Parse(current.ToString());
             string controlValue = this.DataGrid1.GetControlValue(num, "grouptitle");
             if (controlValue.Trim() == "")
             {
                 base.RegisterStartupScript("", "<script>alert('组标题未输入,请检查!');window.location.href='usergroupgrid.aspx';</script>");
                 return;
             }
             int num2 = int.Parse(this.DataGrid1.GetControlValue(num, "creditshigher"));
             int num3 = int.Parse(this.DataGrid1.GetControlValue(num, "creditslower"));
             if (num2 >= num3)
             {
                 base.RegisterStartupScript("", "<script>alert('" + controlValue + "组的积分下限超过上限,请检查!');window.location.href='usergroupgrid.aspx';</script>");
                 return;
             }
             arrayList.Add(num2);
             arrayList2.Add(num3);
             ugs.Add(new UserGroup2(id, controlValue, num2, num3));
             num++;
         }
         arrayList.Sort();
         arrayList2.Sort();
         for (int i = 1; i < arrayList.Count; i++)
         {
             if (arrayList[i].ToString() != arrayList2[i - 1].ToString())
             {
                 base.RegisterStartupScript("", "<script>alert('积分下限与上限取值不连续,请检查!');window.location.href='usergroupgrid.aspx';</script>");
                 return;
             }
         }
         for (int j = 0; j < ugs.Count; j++)
         {
             UserGroup2 userGroup     = (UserGroup2)ugs[j];
             UserGroup  userGroupInfo = UserGroup.FindByID(userGroup.id);
             userGroupInfo.GroupTitle    = userGroup.grouptitle;
             userGroupInfo.Creditslower  = userGroup.creditslower;
             userGroupInfo.Creditshigher = userGroup.creditshigher;
             //UserGroups.UpdateUserGroup(userGroupInfo);
             userGroupInfo.Save();
         }
         //Caches.ReSetUserGroupList();
         base.RegisterStartupScript("", "<script>window.location.href='usergroupgrid.aspx';</script>");
     }
     catch
     {
         base.RegisterStartupScript("", "<script>alert('积分下限或是上限输入的数值不合法,请检查!');window.location.href='usergroupgrid.aspx';</script>");
     }
 }
Ejemplo n.º 8
0
        private void DeleteUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                UserGroup ug = UserGroup.FindByID(WebHelper.RequestInt("groupid"));
                //if (AdminUserGroups.DeleteUserGroupInfo(DNTRequest.GetInt("groupid", -1)))
                if (ug != null)
                {
                    ug.Delete();

                    GeneralConfigInfo config = GeneralConfigInfo.Current;
                    string            text   = "";
                    string[]          array  = config.Reportusergroup.Split(',');
                    for (int i = 0; i < array.Length; i++)
                    {
                        string text2 = array[i];
                        if (text2 != this.userGroupInfo.ID.ToString())
                        {
                            if (String.IsNullOrEmpty(text))
                            {
                                text = text2;
                            }
                            else
                            {
                                text = text + "," + text2;
                            }
                        }
                    }
                    config.Reportusergroup = text;
                    text = "";
                    string[] array2 = config.Photomangegroups.Split(',');
                    for (int j = 0; j < array2.Length; j++)
                    {
                        string text3 = array2[j];
                        if (text3 != this.userGroupInfo.ID.ToString())
                        {
                            if (text == "")
                            {
                                text = text3;
                            }
                            else
                            {
                                text = text + "," + text3;
                            }
                        }
                    }
                    config.Photomangegroups = text;
                    config.Save();

                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除管理组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                    base.RegisterStartupScript("PAGE", "window.location.href='adminusergroupgrid.aspx';");
                    return;
                }
                base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='adminusergroupgrid.aspx';</script>");
            }
        }
Ejemplo n.º 9
0
        public string GroupName(string groupid)
        {
            var userGroupInfo = UserGroup.FindByID(groupid.ToInt());

            if (userGroupInfo == null)
            {
                return("");
            }
            return(userGroupInfo.GroupTitle);
        }
Ejemplo n.º 10
0
        public void LoadUserGroupInf(int groupid)
        {
            this.userGroupInfo      = UserGroup.FindByID(groupid);
            this.groupTitle.Text    = Utils.RemoveFontTag(this.userGroupInfo.GroupTitle);
            this.creditshigher.Text = this.userGroupInfo.Creditshigher.ToString();
            this.creditslower.Text  = this.userGroupInfo.Creditslower.ToString();
            this.stars.Text         = this.userGroupInfo.Stars.ToString();
            this.color.Text         = this.userGroupInfo.Color;
            this.groupavatar.Text   = this.userGroupInfo.Groupavatar;
            this.readaccess.Text    = this.userGroupInfo.Readaccess.ToString();
            this.maxprice.Text      = this.userGroupInfo.MaxPrice.ToString();
            this.maxpmnum.Text      = this.userGroupInfo.MaxPmNum.ToString();
            this.maxsigsize.Text    = this.userGroupInfo.MaxSigSize.ToString();
            this.maxattachsize.Text = this.userGroupInfo.MaxAttachSize.ToString();
            this.maxsizeperday.Text = this.userGroupInfo.MaxSizeperday.ToString();
            if (groupid > 0 && groupid <= 3)
            {
                this.radminid.Enabled = false;
            }
            this.radminid.SelectedValue = this.userGroupInfo.RadminID.ToString();
            this.attachextensions.SetSelectByID(this.userGroupInfo.AttachExtensions + "");

            adminGroupInfo = AdminGroup.FindByID(userGroupInfo.ID);
            this.usergrouppowersetting.Bind(this.userGroupInfo);
            if (this.adminGroupInfo != null)
            {
                admingroupright.SelectedIndex      = -1;
                admingroupright.Items[0].Selected  = adminGroupInfo.AllowEditPost;
                admingroupright.Items[1].Selected  = adminGroupInfo.AllowEditpoll;
                admingroupright.Items[2].Selected  = adminGroupInfo.AllowDelPost;
                admingroupright.Items[3].Selected  = adminGroupInfo.AllowMassprune;
                admingroupright.Items[4].Selected  = adminGroupInfo.AllowViewIP;
                admingroupright.Items[5].Selected  = adminGroupInfo.AllowEditUser;
                admingroupright.Items[6].Selected  = adminGroupInfo.AllowViewLog;
                admingroupright.Items[7].Selected  = adminGroupInfo.DisablePostctrl;
                admingroupright.Items[8].Selected  = adminGroupInfo.AllowViewrealName;
                admingroupright.Items[9].Selected  = adminGroupInfo.AllowBanUser;
                admingroupright.Items[10].Selected = adminGroupInfo.AllowBanIP;
                admingroupright.Items[11].Selected = adminGroupInfo.AllowModPost;
                admingroupright.Items[12].Selected = adminGroupInfo.AllowPostannounce;
                String config = GeneralConfigInfo.Current.Reportusergroup;
                this.admingroupright.Items[13].Selected = (("," + config + ",").IndexOf("," + groupid + ",") != -1);
                this.admingroupright.Items[this.admingroupright.Items.Count - 1].Selected = (("," + config + ",").IndexOf("," + groupid + ",") != -1);
                if (this.adminGroupInfo.AllowStickthread.ToString() != "")
                {
                    this.allowstickthread.SelectedValue = this.adminGroupInfo.AllowStickthread.ToString();
                }
            }
            if (this.radminid.SelectedValue == "1")
            {
                this.allowstickthread.Enabled       = false;
                this.allowstickthread.SelectedValue = "3";
            }
        }
Ejemplo n.º 11
0
        public static bool AllowDiggs(int userid)
        {
            if (!UserGroup.Guest.AllowDiggs && userid == -1)
            {
                return(false);
            }
            //var userGroupInfo = UserGroup.FindByID(BBX.Data.Users.GetUserInfo(userid).Groupid);
            var userGroupInfo = UserGroup.FindByID(User.FindByID(userid).GroupID);

            return(userGroupInfo.AllowDiggs);
        }
Ejemplo n.º 12
0
        private void UpdateUserGroupInf_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                UserGroup ug = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
                this.userGroupInfo  = ug;
                ug.System           = 0;
                ug.Type             = 0;
                ug.Readaccess       = Convert.ToInt32(this.readaccess.Text);
                ug.AllowViewstats   = false;
                ug.AllowNickName    = false;
                ug.AllowHtml        = false;
                ug.AllowCstatus     = false;
                ug.AllowUsebLog     = false;
                ug.AllowInvisible   = false;
                ug.AllowTransfer    = false;
                ug.AllowMultigroups = false;
                ug.ReasonPm         = 0;
                Users.UpdateUserAdminIdByGroupId(ug.RadminID, ug.ID);
                ug.GroupTitle    = this.groupTitle.Text;
                ug.Creditshigher = Convert.ToInt32(this.creditshigher.Text);
                ug.Creditslower  = Convert.ToInt32(this.creditslower.Text);
                ug.Stars         = Convert.ToInt32(this.stars.Text);
                ug.Color         = this.color.Text;
                ug.Groupavatar   = this.groupavatar.Text;
                ug.MaxPrice      = Convert.ToInt32(this.maxprice.Text);
                ug.MaxPmNum      = Convert.ToInt32(this.maxpmnum.Text);
                ug.MaxSigSize    = Convert.ToInt32(this.maxsigsize.Text);
                ug.MaxAttachSize = Convert.ToInt32(this.maxattachsize.Text);
                ug.MaxSizeperday = Convert.ToInt32(this.maxsizeperday.Text);
                //ug.MaxSpaceattachSize = Convert.ToInt32(this.maxspaceattachsize.Text);
                //ug.MaxSpacephotoSize = Convert.ToInt32(this.maxspacephotosize.Text);
                ug.AttachExtensions = this.attachextensions.GetSelectString(",");
                this.usergrouppowersetting.GetSetting(ref ug);
                //if (AdminUserGroups.UpdateUserGroupInfo(ug))
                try
                {
                    userGroupInfo.Save();
                    //{
                    //XCache.Remove(CacheKeys.FORUM_USER_GROUP_LIST);

                    //DNTCache.Current.RemoveObject(CacheKeys.FORUM_ADMIN_GROUP_LIST);
                    AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新系统组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                    base.RegisterStartupScript("PAGE", "window.location.href='sysadminusergroupgrid.aspx';");
                    return;
                }
                catch (Exception ex)
                {
                    XTrace.WriteException(ex);
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='sysadminusergroupgrid.aspx';</script>");
                }
            }
        }
Ejemplo n.º 13
0
 protected override void ShowPage()
 {
     this.pagetitle = "查看用户信息";
     if (!this.usergroupinfo.AllowViewpro && this.userid != this.id)
     {
         base.AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", this.usergroupinfo.GroupTitle));
         if (this.userid < 1)
         {
             this.needlogin = true;
         }
         return;
     }
     if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("username")) && Utils.StrIsNullOrEmpty(DNTRequest.GetString("userid")))
     {
         base.AddErrLine("错误的URL链接");
         return;
     }
     if (this.id == -1)
     {
         this.id = Users.GetUserId(Utils.UrlDecode(DNTRequest.GetString("username")));
     }
     if (this.id == -1)
     {
         base.AddErrLine("该用户不存在");
         return;
     }
     this.user = Users.GetUserInfo(this.id);
     if (this.user == null)
     {
         base.AddErrLine("该用户不存在");
         return;
     }
     if (!user.ShowEmail && this.id != this.userid)
     {
         //this.user.Email = "";
         // 不影响脏数据,避免不小心被保存了
         user["Email"] = "";
     }
     this.score = Scoresets.GetValidScoreName();
     this.group = UserGroup.FindByID(this.user.GroupID);
     //this.admininfo = AdminUserGroups.AdminGetAdminGroupInfo(this.usergroupid);
     admininfo   = AdminGroup.FindByID(usergroupid);
     this.score1 = ((decimal)this.user.ExtCredits1).ToString();
     this.score2 = ((decimal)this.user.ExtCredits2).ToString();
     this.score3 = ((decimal)this.user.ExtCredits3).ToString();
     this.score4 = ((decimal)this.user.ExtCredits4).ToString();
     this.score5 = ((decimal)this.user.ExtCredits5).ToString();
     this.score6 = ((decimal)this.user.ExtCredits6).ToString();
     this.score7 = ((decimal)this.user.ExtCredits7).ToString();
     this.score8 = ((decimal)this.user.ExtCredits8).ToString();
 }
Ejemplo n.º 14
0
        public void SetGroupRights(string groupid)
        {
            var userGroupInfo = UserGroup.FindByID(groupid.ToInt());

            this.creditshigher.Text     = userGroupInfo.Creditshigher.ToString();
            this.creditslower.Text      = userGroupInfo.Creditslower.ToString();
            this.stars.Text             = userGroupInfo.Stars.ToString();
            this.color.Text             = userGroupInfo.Color;
            this.groupavatar.Text       = userGroupInfo.Groupavatar;
            this.readaccess.Text        = userGroupInfo.Readaccess.ToString();
            this.maxprice.Text          = userGroupInfo.MaxPrice.ToString();
            this.maxpmnum.Text          = userGroupInfo.MaxPmNum.ToString();
            this.maxsigsize.Text        = userGroupInfo.MaxSigSize.ToString();
            this.maxattachsize.Text     = userGroupInfo.MaxAttachSize.ToString();
            this.maxsizeperday.Text     = userGroupInfo.MaxSizeperday.ToString();
            this.radminid.SelectedValue = userGroupInfo.RadminID.ToString();
            var attachmentType = AttachType.FindAllWithCache().ToDataTable(false);

            this.attachextensions.AddTableData(attachmentType, userGroupInfo.AttachExtensions);
            this.usergrouppowersetting.Bind(userGroupInfo);

            var adminGroupInfo = AdminGroup.FindByID(groupid.ToInt());

            if (adminGroupInfo != null)
            {
                this.admingroupright.Items[0].Selected  = adminGroupInfo.AllowEditPost;
                this.admingroupright.Items[1].Selected  = adminGroupInfo.AllowEditpoll;
                this.admingroupright.Items[2].Selected  = adminGroupInfo.AllowDelPost;
                this.admingroupright.Items[3].Selected  = adminGroupInfo.AllowMassprune;
                this.admingroupright.Items[4].Selected  = adminGroupInfo.AllowViewIP;
                this.admingroupright.Items[5].Selected  = adminGroupInfo.AllowEditUser;
                this.admingroupright.Items[6].Selected  = adminGroupInfo.AllowViewLog;
                this.admingroupright.Items[7].Selected  = adminGroupInfo.DisablePostctrl;
                this.admingroupright.Items[8].Selected  = adminGroupInfo.AllowViewrealName;
                this.admingroupright.Items[9].Selected  = adminGroupInfo.AllowBanUser;
                this.admingroupright.Items[10].Selected = adminGroupInfo.AllowBanIP;
                this.admingroupright.Items[11].Selected = adminGroupInfo.AllowModPost;
                this.admingroupright.Items[12].Selected = adminGroupInfo.AllowPostannounce;
                var config = GeneralConfigInfo.Current;
                this.admingroupright.Items[13].Selected = (("," + config.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1);
                this.admingroupright.Items[14].Selected = (("," + config.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1);
            }
            if (this.radminid.SelectedValue == "1")
            {
                this.allowstickthread.Enabled       = false;
                this.allowstickthread.SelectedValue = "3";
                return;
            }
            this.allowstickthread.Enabled = true;
        }
Ejemplo n.º 15
0
 private void LoginUser(IUser userInfo)
 {
     ForumUtils.WriteUserCookie(userInfo.ID, TypeConverter.StrToInt(DNTRequest.GetString("expires"), -1), this.config.Passwordkey, DNTRequest.GetInt("templateid", 0), DNTRequest.GetInt("loginmode", -1));
     this.oluserinfo    = OnlineUsers.UpdateInfo(this.config.Passwordkey, this.config.Onlinetimeout, userInfo.ID, "");
     this.olid          = this.oluserinfo.Olid;
     this.username      = userInfo.Name;
     this.userid        = userInfo.ID;
     this.usergroupinfo = UserGroup.FindByID(userInfo.GroupID);
     this.useradminid   = this.usergroupinfo.RadminID;
     Utils.WriteCookie("bindconnect", "1");
     OnlineUsers.UpdateAction(this.olid, UserAction.Login.ActionID, 0);
     LoginLogs.DeleteLoginLog(DNTRequest.GetIP());
     Users.UpdateUserCreditsAndVisit(userInfo.ID, DNTRequest.GetIP());
 }
Ejemplo n.º 16
0
 private void UpdateUserGroupInf_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         var dic = new Dictionary <String, Int32>();
         dic.Add("附件最大尺寸", this.maxattachsize.Text.ToInt(-1));
         dic.Add("每天最大附件总尺寸", this.maxsizeperday.Text.ToInt(-1));
         foreach (var item in dic)
         {
             if (item.Value < 0)
             {
                 base.RegisterStartupScript("", "<script>alert('输入错误," + item.Key + "只能是0或者正整数');window.location.href='usergroupspecialgrid.aspx';</script>");
                 return;
             }
         }
         this.userGroupInfo            = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1));
         this.userGroupInfo.System     = 0;
         this.userGroupInfo.Type       = 0;
         this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text);
         int num = (this.radminid.SelectedValue == "0") ? -1 : Convert.ToInt32(this.radminid.SelectedValue);
         this.userGroupInfo.RadminID = num;
         if (num.ToString() != this.ViewState["radminid"].ToString())
         {
             Users.UpdateUserAdminIdByGroupId(this.userGroupInfo.RadminID, this.userGroupInfo.ID);
         }
         this.userGroupInfo.GroupTitle       = this.groupTitle.Text;
         this.userGroupInfo.Stars            = Convert.ToInt32(this.stars.Text);
         this.userGroupInfo.Color            = this.color.Text;
         this.userGroupInfo.Groupavatar      = this.groupavatar.Text;
         this.userGroupInfo.MaxPrice         = Convert.ToInt32(this.maxprice.Text);
         this.userGroupInfo.MaxPmNum         = Convert.ToInt32(this.maxpmnum.Text);
         this.userGroupInfo.MaxSigSize       = Convert.ToInt32(this.maxsigsize.Text);
         this.userGroupInfo.MaxAttachSize    = Convert.ToInt32(this.maxattachsize.Text);
         this.userGroupInfo.MaxSizeperday    = Convert.ToInt32(this.maxsizeperday.Text);
         this.userGroupInfo.AttachExtensions = this.attachextensions.GetSelectString(",");
         this.usergrouppowersetting.GetSetting(ref this.userGroupInfo);
         try
         {
             userGroupInfo.UpdateWithCredits();
             AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除特殊用户组", "组ID:" + DNTRequest.GetInt("groupid", -1));
             base.RegisterStartupScript("PAGE", "window.location.href='usergroupspecialgrid.aspx';");
             return;
         }
         catch (Exception ex)
         {
             base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + ex.Message + "');window.location.href='usergroupspecialgrid.aspx';</script>");
             return;
         }
     }
 }
Ejemplo n.º 17
0
        public void SetGroupRights(int groupid)
        {
            var userGroupInfo = UserGroup.FindByID(groupid);

            this.stars.Text         = userGroupInfo.Stars.ToString();
            this.color.Text         = userGroupInfo.Color;
            this.groupavatar.Text   = userGroupInfo.Groupavatar;
            this.readaccess.Text    = userGroupInfo.Readaccess.ToString();
            this.maxprice.Text      = userGroupInfo.MaxPrice.ToString();
            this.maxpmnum.Text      = userGroupInfo.MaxPmNum.ToString();
            this.maxsigsize.Text    = userGroupInfo.MaxSigSize.ToString();
            this.maxattachsize.Text = userGroupInfo.MaxAttachSize.ToString();
            this.maxsizeperday.Text = userGroupInfo.MaxSizeperday.ToString();
        }
Ejemplo n.º 18
0
        private void LoginUser(IUser userInfo)
        {
            XTrace.WriteLine("{0}({1}) 登录", userInfo.Name, userInfo.NickName);

            ForumUtils.WriteUserCookie(userInfo.ID, DNTRequest.GetInt("expires", -1), this.config.Passwordkey, DNTRequest.GetInt("templateid", 0), DNTRequest.GetInt("loginmode", -1));
            this.oluserinfo    = Online.UpdateInfo(userInfo.ID, "");
            this.olid          = this.oluserinfo.ID;
            this.username      = userInfo.Name;
            this.userid        = userInfo.ID;
            this.usergroupinfo = UserGroup.FindByID(userInfo.GroupID);
            this.useradminid   = this.usergroupinfo.RadminID;
            Online.UpdateAction(this.olid, UserAction.Login, 0);
            LoginLogs.DeleteLoginLog(WebHelper.UserHost);
            Users.UpdateUserCreditsAndVisit(userInfo, WebHelper.UserHost);
        }
Ejemplo n.º 19
0
 public static bool CanEditPost(Post postInfo, int userId, int userAdminId, ref string msg)
 {
     if (postInfo.PosterID != userId && BaseConfigs.GetFounderUid != userId)
     {
         if (postInfo.PosterID == BaseConfigs.GetFounderUid)
         {
             msg = "您无权编辑创始人的帖子";
             return(false);
         }
         if (postInfo.PosterID != -1)
         {
             UserGroup userGroupInfo = UserGroup.FindByID(User.FindByID(postInfo.PosterID).GroupID);
             if (userGroupInfo.Is管理团队 && userGroupInfo.RadminID < userAdminId)
             {
                 msg = "您无权编辑更高权限人的帖子";
                 return(false);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 20
0
 private void CreatePM(int folder, int saveToSendBox, string url, string msg)
 {
     if (folder != 2)
     {
         User userInfo = Users.GetUserInfo(this.msgtoid);
         var  ug       = UserGroup.FindByID(this.usergroupid);
         if (!ug.Is管理团队 && ShortMessage.GetPrivateMessageCount(this.msgtoid, -1) >= UserGroup.FindByID(userInfo.GroupID).MaxPmNum)
         {
             base.AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
             return;
         }
         if (!Utils.InArray(userInfo.NewsLetter.ToInt().ToString(), "2,3,6,7"))
         {
             base.AddErrLine("抱歉,接收人拒绝接收短消息");
             return;
         }
     }
     if (url != "usercpinbox.aspx" && ShortMessage.GetPrivateMessageCount(this.userid, -1) >= this.usergroupinfo.MaxPmNum)
     {
         base.AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱");
         return;
     }
     this.pm.Folder = (Int16)folder;
     if (CreditsFacade.SendPM(this.userid) == -1)
     {
         base.AddErrLine("您的积分不足, 不能发送短消息");
         return;
     }
     //this.pm.Pmid = PrivateMessages.CreatePrivateMessage(this.pm, saveToSendBox);
     pm.Create(saveToSendBox != 0);
     if (DNTRequest.GetString("emailnotify") == "on")
     {
         this.SendNotifyEmail(Users.GetUserInfo(this.msgtoid).Email.Trim(), this.pm);
     }
     base.SetUrl(url);
     base.SetMetaRefresh();
     base.SetShowBackLink(true);
     base.MsgForward("usercppostpm_succeed");
     base.AddMsgLine(msg);
 }
Ejemplo n.º 21
0
 public void LoadUserGroupInf(int groupid)
 {
     this.userGroupInfo          = UserGroup.FindByID(groupid);
     this.groupTitle.Text        = Utils.RemoveFontTag(this.userGroupInfo.GroupTitle);
     this.stars.Text             = this.userGroupInfo.Stars.ToString();
     this.color.Text             = this.userGroupInfo.Color;
     this.groupavatar.Text       = this.userGroupInfo.Groupavatar;
     this.readaccess.Text        = this.userGroupInfo.Readaccess.ToString();
     this.maxprice.Text          = this.userGroupInfo.MaxPrice.ToString();
     this.maxpmnum.Text          = this.userGroupInfo.MaxPmNum.ToString();
     this.maxsigsize.Text        = this.userGroupInfo.MaxSigSize.ToString();
     this.maxattachsize.Text     = this.userGroupInfo.MaxAttachSize.ToString();
     this.maxsizeperday.Text     = this.userGroupInfo.MaxSizeperday.ToString();
     this.radminid.SelectedValue = ((this.userGroupInfo.RadminID == -1) ? "0" : this.userGroupInfo.RadminID.ToString());
     this.ViewState["radminid"]  = this.userGroupInfo.RadminID;
     this.attachextensions.SetSelectByID(this.userGroupInfo.AttachExtensions.Trim());
     this.usergrouppowersetting.Bind(this.userGroupInfo);
     if (this.userGroupInfo.System == 1)
     {
         this.DeleteUserGroupInf.Enabled = false;
     }
 }
Ejemplo n.º 22
0
        public static DataTable GroupParticipateScore(int groupid)
        {
            var ug = UserGroup.FindByID(groupid);

            //var userGroupRateRange = BBX.Data.UserGroups.GetUserGroupRateRange(groupid);
            if (ug == null)
            {
                return(null);
            }

            var dataTable = CreateGroupScoreTable();

            if (ug.Raterange.IsNullOrEmpty())
            {
                return(dataTable);
            }

            int num = 0;

            string[] array = ug.Raterange.Trim().Split('|');
            for (int i = 0; i < array.Length; i++)
            {
                string text = array[i];
                if (!text.IsNullOrEmpty())
                {
                    string[] array2 = text.Split(',');
                    if (array2[1].Trim() == "True")
                    {
                        dataTable.Rows[num]["available"] = true;
                    }
                    dataTable.Rows[num]["Min"]      = array2[4].Trim();
                    dataTable.Rows[num]["Max"]      = array2[5].Trim();
                    dataTable.Rows[num]["MaxInDay"] = array2[6].Trim();
                }
                num++;
            }
            return(dataTable);
        }
Ejemplo n.º 23
0
        private void ComAdminUsergroup_Click(object sender, EventArgs e)
        {
            if (base.CheckCookie())
            {
                if (this.sourceadminusergroup.SelectedIndex == 0 || this.targetadminusergroup.SelectedIndex == 0)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的管理组!');</script>");
                    return;
                }
                if (Convert.ToInt32(this.sourceadminusergroup.SelectedValue) <= 3 || Convert.ToInt32(this.sourceadminusergroup.SelectedValue) <= 3)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,您选择的组为系统初始化的管理组,这些组不允许合并!');</script>");
                    return;
                }
                if (this.sourceadminusergroup.SelectedValue == this.targetadminusergroup.SelectedValue)
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败,同一个管理组不能够合并!');</script>");
                    return;
                }

                //AdminGroups.DeleteAdminGroupInfo(Convert.ToInt16(this.sourceadminusergroup.SelectedValue));
                AdminGroup adg = AdminGroup.FindByID(Convert.ToInt32(sourceadminusergroup.SelectedValue));
                if (adg != null)
                {
                    adg.Delete();
                }
                //UserGroups.DeleteUserGroupInfo(int.Parse(this.sourceadminusergroup.SelectedValue));
                UserGroup ug = UserGroup.FindByID(adg.ID);
                if (ug != null)
                {
                    ug.Delete();
                }
                UserGroup.ChangeAllUserGroupId(int.Parse(this.sourceusergroup.SelectedValue), int.Parse(this.targetadminusergroup.SelectedValue));
                //XCache.Remove(CacheKeys.FORUM_USER_GROUP_LIST);
                AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并管理组", "把组ID:" + this.sourceusergroup.SelectedIndex + " 合并到组ID:" + this.targetusergroup.SelectedIndex);
                base.RegisterStartupScript("PAGE", "window.location.href='adminusergroupgrid.aspx';");
            }
        }
Ejemplo n.º 24
0
 private void DeleteUserGroupInf_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         int       groupid = DNTRequest.GetInt("groupid", -1);
         UserGroup ug      = UserGroup.FindByID(groupid);
         if (ug != null)
         {
             try
             {
                 AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除用户组", "组ID:" + DNTRequest.GetInt("groupid", -1));
                 base.RegisterStartupScript("PAGE", "window.location.href='usergroupgrid.aspx';");
                 return;
             }
             catch (Exception ex)
             {
                 base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + ex.Message + "');window.location.href='usergroupgrid.aspx';</script>");
                 return;
             }
         }
         base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='usergroupgrid.aspx';</script>");
     }
 }
Ejemplo n.º 25
0
 private void EditUserGroup_Click(object sender, EventArgs e)
 {
     if (this.Usergroupid.SelectedValue != "0")
     {
         int num = Convert.ToInt32(this.Usergroupid.SelectedValue);
         if (num >= 1 && num <= 3)
         {
             base.Response.Redirect("../user/editadminusergroup.aspx?groupid=" + this.Usergroupid.SelectedValue);
             return;
         }
         if (num >= 4 && num <= 8)
         {
             base.Response.Redirect("../user/editsysadminusergroup.aspx?groupid=" + this.Usergroupid.SelectedValue);
             return;
         }
         int radminid = UserGroup.FindByID(this.Usergroupid.SelectedValue.ToInt(0)).RadminID;
         if (radminid == 0)
         {
             base.Response.Redirect("../user/editusergroup.aspx?groupid=" + this.Usergroupid.SelectedValue);
             return;
         }
         if (radminid > 0)
         {
             base.Response.Redirect("../user/editadminusergroup.aspx?groupid=" + this.Usergroupid.SelectedValue);
             return;
         }
         if (radminid < 0)
         {
             base.Response.Redirect("../user/editusergroupspecial.aspx?groupid=" + this.Usergroupid.SelectedValue);
             return;
         }
     }
     else
     {
         base.RegisterStartupScript("", "<script>alert('请您选择有效的用户组!');</script>");
     }
 }
Ejemplo n.º 26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         foreach (UserGroup current in UserGroup.FindAllWithCache())
         {
             this.groupid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString()));
         }
         this.AddUserInfo.Attributes.Add("onclick", "return IsValidPost();");
         string text = "var creditarray = new Array(";
         for (int i = 1; i < this.groupid.Items.Count; i++)
         {
             text = text + UserGroup.FindByID(Convert.ToInt32(this.groupid.Items[i].Value)).Creditshigher.ToString() + ",";
         }
         text = text.TrimEnd(',') + ");";
         base.RegisterStartupScript("begin", "<script type='text/javascript'>" + text + "</script>");
         this.groupid.Attributes.Add("onchange", "document.getElementById('" + this.credits.ClientID + "').value=creditarray[this.selectedIndex];");
         this.groupid.Items.RemoveAt(0);
         try
         {
             this.groupid.SelectedValue = "10";
         }
         catch
         {
             this.groupid.SelectedValue = ((CreditsFacade.GetCreditsUserGroupId(0f) != null) ? CreditsFacade.GetCreditsUserGroupId(0f).ID.ToString() : "3");
         }
         try
         {
             UserGroup userGroupInfo = UserGroup.FindByID(Convert.ToInt32(this.groupid.SelectedValue));
             this.credits.Text = userGroupInfo.Creditshigher.ToString();
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 27
0
        public static string UpdateUserInfoWithModerator(string moderators)
        {
            moderators = ((moderators == null) ? "" : moderators);
            string text = "";

            string[] array = moderators.Split(',');
            for (int i = 0; i < array.Length; i++)
            {
                string name = array[i];
                if (name != "" && !("系统" == name))
                {
                    var user = User.FindByName(name);
                    if (user != null && user.GroupID != 7 && user.GroupID != 8)
                    {
                        if (user.GroupID > 3 || user.GroupID <= 0)
                        {
                            //int radminid = UserGroup.FindByID(userInfo.GroupID).RadminID;
                            var ug = UserGroup.FindByID(user.GroupID);
                            if (ug != null && ug.Is管理团队)
                            {
                                //BBX.Data.Users.SetUserToModerator(name);
                                user.AdminID = 3;
                                user.GroupID = 3;
                                user.Save();
                            }
                        }
                    }
                    else
                    {
                        text = text + name + ",";
                    }
                }
            }
            Caches.ReSetModeratorList();
            return(text);
        }
Ejemplo n.º 28
0
        public static bool SystemCheckCredits(string opname, ref int creditsHigher, ref int creditsLower, int groupid)
        {
            opresult = "";
            string a;

            if ((a = opname.ToLower()) != null)
            {
                if (!(a == "add"))
                {
                    if (!(a == "delete"))
                    {
                        if (a == "update")
                        {
                            var       userGroupInfo = UserGroup.FindByID(groupid);
                            int       creditshigher = userGroupInfo.Creditshigher;
                            int       creditslower  = userGroupInfo.Creditslower;
                            DataTable dataTable     = BBX.Data.UserGroups.GetMinCreditHigher();
                            if (dataTable.Rows.Count > 0)
                            {
                                int num = Convert.ToInt32(dataTable.Rows[0][0].ToString());
                                if (creditsLower <= num)
                                {
                                    creditsLower = num;
                                    opresult     = "由您所输入的积分下限小于或等于系统最大值,因此系统已将其调整为" + num;
                                    BBX.Data.UserGroups.UpdateUserGroupsCreditsHigherByCreditsHigher(creditshigher, creditslower);
                                    return(true);
                                }
                            }
                            dataTable = BBX.Data.UserGroups.GetMaxCreditLower();
                            if (dataTable.Rows.Count > 0)
                            {
                                int num2 = Convert.ToInt32(dataTable.Rows[0][0].ToString());
                                if (creditsHigher >= num2)
                                {
                                    creditsHigher = num2;
                                    opresult      = "由您所输入的积分上限大于或等于系统最大值,因此系统已将其调整为" + num2;
                                    BBX.Data.UserGroups.UpdateUserGroupsCreditsLowerByCreditsLower(creditslower, creditshigher);
                                    return(true);
                                }
                            }
                            dataTable = BBX.Data.UserGroups.GetUserGroupByCreditshigher(creditsHigher);
                            if (dataTable.Rows.Count <= 0)
                            {
                                opresult = "系统未提到合适的位置保存您提交的信息!";
                                return(false);
                            }
                            Convert.ToInt32(dataTable.Rows[0][0].ToString());
                            int num3 = Convert.ToInt32(dataTable.Rows[0][1].ToString());
                            int num4 = Convert.ToInt32(dataTable.Rows[0][2].ToString());
                            if (creditsLower > num4)
                            {
                                opresult = "由您所输入的积分上限大于或等于所属有效积分上限的最大值" + num4 + ",因此系统无效提交您的数据!";
                                return(false);
                            }
                            if (creditsHigher == num3)
                            {
                                if (creditsLower < num4)
                                {
                                    BBX.Data.UserGroups.UpdateUserGroupsCreditsHigherByCreditsHigher(creditsLower, num4);
                                }
                            }
                            else
                            {
                                opresult = "系统已自动将您提交的积分上限调整为" + num4;
                                BBX.Data.UserGroups.UpdateUserGroupsCreditsHigherByCreditsHigher(creditsLower, num4);
                                BBX.Data.UserGroups.UpdateUserGroupsCreditsLowerByCreditsLower(creditsHigher, num3);
                            }
                        }
                    }
                    else
                    {
                        if (BBX.Data.UserGroups.GetGroupCountByCreditsLower(creditsHigher) > 0)
                        {
                            BBX.Data.UserGroups.UpdateUserGroupsCreditsLowerByCreditsLower(creditsLower, creditsHigher);
                        }
                        else
                        {
                            BBX.Data.UserGroups.UpdateUserGroupsCreditsHigherByCreditsHigher(creditsHigher, creditsLower);
                        }
                    }
                }
                else
                {
                    DataTable dataTable2 = BBX.Data.UserGroups.GetMinCreditHigher();
                    if (dataTable2.Rows.Count > 0)
                    {
                        int num5 = Convert.ToInt32(dataTable2.Rows[0][0].ToString());
                        if (creditsLower <= num5)
                        {
                            creditsLower = num5;
                            opresult     = "由您所输入的积分下限小于或等于系统最小值,因此系统已将其调整为" + num5;
                            return(true);
                        }
                    }
                    dataTable2 = BBX.Data.UserGroups.GetMaxCreditLower();
                    if (dataTable2.Rows.Count > 0)
                    {
                        int num6 = Convert.ToInt32(dataTable2.Rows[0][0].ToString());
                        if (creditsHigher >= num6)
                        {
                            creditsHigher = num6;
                            opresult      = "由您所输入的积分上限大于或等于系统最大值,因此系统已将其调整为" + num6;
                            return(true);
                        }
                    }
                    dataTable2 = BBX.Data.UserGroups.GetUserGroupByCreditshigher(creditsHigher);
                    if (dataTable2.Rows.Count <= 0)
                    {
                        opresult = "系统未提到合适的位置保存您提交的信息!";
                        return(false);
                    }
                    int groupid2 = Convert.ToInt32(dataTable2.Rows[0][0].ToString());
                    int num7     = Convert.ToInt32(dataTable2.Rows[0][1].ToString());
                    int num8     = Convert.ToInt32(dataTable2.Rows[0][2].ToString());
                    if (creditsLower > num8)
                    {
                        return(false);
                    }
                    if (creditsHigher == num7)
                    {
                        if (creditsLower >= num8)
                        {
                            opresult = "由您所输入的积分上限大于或等于所属有效积分上限的最大值" + num8 + ",因此系统无效提交您的数据!";
                            return(false);
                        }
                        var userGroupInfo2 = UserGroup.FindByID(groupid2);
                        userGroupInfo2.Creditshigher = creditsLower;
                        //UserGroups.UpdateUserGroup(userGroupInfo2);
                        userGroupInfo2.Save();
                    }
                    else
                    {
                        creditsLower = num8;
                        BBX.Data.UserGroups.UpdateUserGroupCreidtsLower(num7, creditsHigher);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 29
0
        protected override void OnLoad(EventArgs e)
        {
            LoadTemplate();
            base.OnLoad(e);

            if (this.pagename != "forumlist.aspx" && this.pagename != "forumindex.aspx")
            {
                this.oluserinfo = Online.UpdateInfo();
            }
            else
            {
                try
                {
                    this.oluserinfo = Online.UpdateInfo();
                }
                catch
                {
                    Thread.Sleep(2000);
                    this.oluserinfo = Online.UpdateInfo();
                }
            }
            if (this.config.PostTimeStorageMedia == 1 && Utils.GetCookie("lastposttime") != "")
            {
                var lptime = DateTime.MinValue;
                if (DateTime.TryParse(Utils.GetCookie("lastposttime"), out lptime))
                {
                    this.oluserinfo.LastPostTime = lptime;
                }
            }
            if (userid > 0)
            {
                if (oluserinfo == null)
                {
                    XTrace.WriteLine("发现Cookie记录ID={0}已登录,但是未检测到登录对象", userid);
                }
                else if (userid != oluserinfo.UserID)
                {
                    XTrace.WriteLine("发现Cookie记录ID={0}已登录,实际登录对象ID={1}", userid, oluserinfo.UserID);
                }
            }
            this.userid      = this.oluserinfo.UserID;
            this.usergroupid = (int)this.oluserinfo.GroupID;
            this.username    = this.oluserinfo.UserName;
            this.password    = this.oluserinfo.Password;
            //2014-1-20 增加判断password是否为null,初次使用时使用QQ登陆,密码会为空
            this.userkey        = password != null ? (this.password.Length > 16) ? this.password.Substring(4, 8).Trim() : "" : "";
            this.lastposttime   = this.oluserinfo.LastPostTime;
            this.lastpostpmtime = this.oluserinfo.LastPostpmTime;
            this.lastsearchtime = this.oluserinfo.LastSearchTime;
            this.olid           = this.oluserinfo.ID;
            //this.isopenconnect = DiscuzCloud.GetCloudServiceEnableStatus("connect");
            if (this.userid > 0)
            {
                this.useravatar = Avatars.GetAvatarUrl(this.userid, AvatarSize.Small);
            }

            this.pmsound = ForumUtils.GetCookie("pmsound").ToInt(0);
            if (this.usergroupid == 4 || this.usergroupid == 5)
            {
                var user = BBX.Entity.User.FindByID(this.userid);
                //var user2 = user as IUser;
                if (user.GroupExpiry != 0 && user.GroupExpiry <= DateTime.Now.ToString("yyyyMMdd").ToInt(0))
                {
                    var creditsUserGroupId = CreditsFacade.GetCreditsUserGroupId((float)user.Credits);
                    this.usergroupid = ((creditsUserGroupId.ID != 0) ? creditsUserGroupId.ID : this.usergroupid);
                    //Users.UpdateUserGroup(this.userid, this.usergroupid);
                    user.GroupID = usergroupid;
                    user.Save();
                }
            }
            this.usergroupinfo = UserGroup.FindByID(this.usergroupid);
            this.useradminid   = this.usergroupinfo.RadminID;
            string userCreditsCookie = ForumUtils.GetUserCreditsCookie(this.userid, this.usergroupinfo.GroupTitle);

            if (userCreditsCookie != "")
            {
                string[] array = userCreditsCookie.Split(',');
                this.userinfotips = "<p><a class=\"drop\" onmouseover=\"showMenu(this.id);\" href=\"" + BaseConfigs.GetForumPath + "usercpcreditspay.aspx\" id=\"extcreditmenu\">" + array[0] + "</a> ";
                string text = this.userinfotips;
                this.userinfotips  = text + "<span class=\"pipe\">|</span>用户组: <a class=\"xi2\" id=\"g_upmine\" href=\"" + BaseConfigs.GetForumPath + "usercp.aspx\">" + array[1].Split(':')[1] + "</a></p>";
                this.userinfotips += "<ul id=\"extcreditmenu_menu\" class=\"p_pop\" style=\"display:none;\">";
                for (int i = 2; i < array.Length; i++)
                {
                    this.userinfotips += string.Format("<li><a> {0}</a></li>", array[i]);
                }
                this.userinfotips += "</ul>";
            }
            this.mainnavigation       = Nav.GetNavigationString(this.userid, this.useradminid);
            this.subnavigation        = Nav.GetSubNavigation();
            this.mainnavigationhassub = Nav.Root.Childs.GetItem <Int32>(Nav._.ID).ToArray();
            if (this.config.Closed == 1 && this.pagename != "login.aspx" && this.pagename != "logout.aspx" && this.pagename != "register.aspx" && this.useradminid != 1)
            {
                this.ShowMessage(1);
                return;
            }
            if (!Utils.InArray(this.pagename, "attachment.aspx"))
            {
                //this.onlineusercount = Online.Meta.Count;
                var st = Online.GetStat();
                this.onlineusercount = st.Total;
            }
            if (!this.ValidateUserPermission())
            {
                return;
            }

            if (this.userid != -1 && !Utils.InArray(this.pagename, "attachment.aspx"))
            {
                Online.UpdateOnlineTime(this.config.Oltimespan, this.userid);
            }
            var tmp = Template.FindByID(this.templateid);

            this.templatepath = tmp.Directory;
            if (!String.IsNullOrEmpty(tmp.Url) && tmp.Url.StartsWithIgnoreCase("http://"))
            {
                imagedir = tmp.Url.TrimEnd('/') + "/images";
                cssdir   = tmp.Url.TrimEnd('/');
            }
            else
            {
                imagedir = forumpath + "templates/" + tmp.Directory + "/images";
                cssdir   = forumpath + "templates/" + tmp.Directory;
            }
            if (!config.ImageServer.IsNullOrEmpty())
            {
                imagedir = config.ImageServer.TrimEnd("/") + imagedir;
            }
            if (!config.CssServer.IsNullOrEmpty())
            {
                cssdir = config.CssServer.TrimEnd("/") + cssdir;
            }

            this.topicidentifydir = this.forumpath + "images/identify";
            this.posticondir      = this.forumpath + "images/posticons";
            this.jsdir            = "javascript";
            if (!config.JsServer.IsNullOrEmpty())
            {
                jsdir = config.JsServer.EnsureEnd("/") + jsdir;
            }
            else
            {
                jsdir = this.rooturl + jsdir;
            }

            //this.nowdatetime = Utils.GetDateTime();
            //this.ispost = DNTRequest.IsPost();
            //this.isget = DNTRequest.IsGet();
            //this.link = "";
            //this.script = "";
            this.templatelistboxoptions = Caches.GetTemplateListBoxOptionsCache();
            string oldValue = string.Format("<li><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", "", BaseConfigs.GetForumPath, this.templateid);
            string newValue = string.Format("<li class=\"current\"><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", BaseConfigs.GetForumPath, this.templateid);

            this.templatelistboxoptions = this.templatelistboxoptions.Replace(oldValue, newValue);
            this.isLoginCode            = this.config.Seccodestatus.Contains("login.aspx");
            this.isseccode = (Utils.InArray(this.pagename, this.config.Seccodestatus) && this.usergroupinfo.IgnoresecCode == 0);
            this.headerad  = Advertisement.GetOneHeaderAd("", 0);
            this.footerad  = Advertisement.GetOneFooterAd("", 0);
            if (this.config.Allowchangewidth == 0)
            {
                Utils.WriteCookie("allowchangewidth", "");
            }

            if (this.pagename != "website.aspx" && (Utils.GetCookie("allowchangewidth") == "0" || (string.IsNullOrEmpty(Utils.GetCookie("allowchangewidth")) && this.config.Showwidthmode == 1)))
            {
                this.isnarrowpage = true;
            }
            if (this.isseccode && this.ispost && !this.ValidateVerifyCode())
            {
                return;
            }

            this.newtopicminute = this.config.Viewnewtopicminute;

            CanShow = true;

            this.ShowPage();
        }
Ejemplo n.º 30
0
        protected override void ShowPage()
        {
            this.pagetitle = "用户登录";
            this.inapi     = DNTRequest.GetInt("inapi", 0);
            if (this.userid != -1)
            {
                base.SetUrl(BaseConfigs.GetForumPath);
                base.AddMsgLine("您已经登录,无须重复登录");
                this.ispost = true;
                this.SetLeftMenuRefresh();
                if (APIConfigInfo.Current.Enable)
                {
                    this.APILogin(APIConfigInfo.Current);
                }
            }
            if (LoginLogs.UpdateLoginLog(WebHelper.UserHost, false) >= 5)
            {
                base.AddErrLine("您已经多次输入密码错误, 请15分钟后再登录");
                this.loginsubmit = false;
                return;
            }
            this.SetReUrl();
            var username = DNTRequest.GetString("username");

            if (DNTRequest.IsPost())
            {
                this.SetBackLink();
                if (this.isseccode && String.IsNullOrEmpty(DNTRequest.GetString("vcode")))
                {
                    this.postusername = username;
                    this.loginauth    = DES.Encode(DNTRequest.GetString("password"), this.config.Passwordkey).Replace("+", "[");
                    this.loginsubmit  = true;
                    return;
                }
                if (this.config.Emaillogin == 1 && Utils.IsValidEmail(username))
                {
                    //var userInfoByEmail = Users.GetUserInfoByEmail(username);
                    var list = BBX.Entity.User.FindAllByEmail(username);
                    //if (userInfoByEmail.Rows.Count == 0)
                    if (list.Count == 0)
                    {
                        base.AddErrLine("用户不存在");
                        return;
                    }
                    if (list.Count > 1)
                    {
                        base.AddErrLine("您所使用Email不唯一,请使用用户名登陆");
                        return;
                    }
                    if (list.Count == 1)
                    {
                        this.postusername = list[0].Name;
                    }
                }
                if (this.config.Emaillogin == 0 && Users.GetUserId(username) == 0)
                {
                    base.AddErrLine("用户不存在");
                }
                if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("password")) && Utils.StrIsNullOrEmpty(DNTRequest.GetString("loginauth")))
                {
                    base.AddErrLine("密码不能为空");
                }
                if (base.IsErr())
                {
                    return;
                }
                IUser user = this.GetShortUserInfo();
                if (user != null)
                {
                    if ((user.GroupID == 4 || user.GroupID == 5) && user.GroupExpiry != 0 && user.GroupExpiry <= DateTime.Now.ToString("yyyyMMdd").ToInt(0))
                    {
                        var creditsUserGroupId = CreditsFacade.GetCreditsUserGroupId((float)user.Credits);
                        this.usergroupid = ((creditsUserGroupId.ID != 0) ? creditsUserGroupId.ID : this.usergroupid);
                        user.GroupID     = this.usergroupid;
                        //Users.UpdateUserGroup(user.ID, this.usergroupid);
                        //XUser user = XUser.FindByID(postInfo.Posterid);
                        user.GroupID = 6;
                        (user as IEntity).Save();
                    }
                    if (user.GroupID == 5)
                    {
                        base.AddErrLine("您所在的用户组,已经被禁止访问");
                        return;
                    }
                    if (user.GroupID == 8)
                    {
                        if (this.config.Regverify == 1)
                        {
                            this.needactiveuid = user.ID;
                            this.email         = user.Email;
                            this.timestamp     = DateTime.Now.Ticks.ToString();
                            this.authstr       = Utils.MD5(user.Password + this.config.Passwordkey + this.timestamp);
                            base.AddMsgLine("请您到您的邮箱中点击激活链接来激活您的帐号");
                        }
                        else
                        {
                            if (this.config.Regverify == 2)
                            {
                                base.AddMsgLine("您需要等待一些时间, 待系统管理员审核您的帐户后才可登录使用");
                            }
                            else
                            {
                                base.AddErrLine("抱歉, 您的用户身份尚未得到验证");
                            }
                        }
                        this.loginsubmit = false;
                        return;
                    }
                    if (!user.Secques.IsNullOrEmpty() && this.loginsubmit && Utils.StrIsNullOrEmpty(DNTRequest.GetString("loginauth")))
                    {
                        this.loginauth = DES.Encode(DNTRequest.GetString("password"), this.config.Passwordkey).Replace("+", "[");
                    }
                    else
                    {
                        base.AddMsgLine("登录成功, 返回登录前页面");
                        ForumUtils.WriteUserCookie(user.ID, DNTRequest.GetInt("expires", -1), this.config.Passwordkey, DNTRequest.GetInt("templateid", 0), DNTRequest.GetInt("loginmode", -1));
                        this.oluserinfo    = Online.UpdateInfo(user.ID, "");
                        this.olid          = this.oluserinfo.ID;
                        this.username      = username;
                        this.userid        = user.ID;
                        this.usergroupinfo = UserGroup.FindByID(user.GroupID);
                        this.useradminid   = this.usergroupinfo.RadminID;
                        Online.UpdateAction(this.olid, UserAction.Login, 0);
                        LoginLogs.DeleteLoginLog(WebHelper.UserHost);
                        Users.UpdateUserCreditsAndVisit(user, WebHelper.UserHost);
                        if (APIConfigInfo.Current.Enable)
                        {
                            this.APILogin(APIConfigInfo.Current);
                        }
                        this.loginsubmit = false;
                        string text = Utils.UrlDecode(ForumUtils.GetReUrl());
                        base.SetUrl((text.IndexOf("register.aspx") < 0) ? text : (this.forumpath + "index.aspx"));
                        this.SetLeftMenuRefresh();
                        if (APIConfigInfo.Current.Enable)
                        {
                            base.AddMsgLine(Sync.GetLoginScript(this.userid, this.username));
                        }
                        if (!APIConfigInfo.Current.Enable || !Sync.NeedAsyncLogin())
                        {
                            base.MsgForward("login_succeed", true);
                        }
                    }
                }
                else
                {
                    int num = LoginLogs.UpdateLoginLog(WebHelper.UserHost, true);
                    if (num > 5)
                    {
                        base.AddErrLine("您已经输入密码5次错误, 请15分钟后再试");
                    }
                    else
                    {
                        base.AddErrLine(string.Format("密码或安全提问第{0}次错误, 您最多有5次机会重试", num));
                    }
                }
                if (base.IsErr())
                {
                    return;
                }
                ForumUtils.WriteUserCreditsCookie(user, this.usergroupinfo.GroupTitle);
            }
        }