コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int tid = DNTRequest.GetInt("tid", 0);

        if (tid > 0)
        {
            //ShowtopicPagePostInfo info = Posts.GetSinglePost(tid);
            PostInfo postInfo = Posts.GetPostInfo(tid, Posts.GetFirstPostId(tid));
            if (postInfo != null)
            {
                //处理帖子内容
                PostpramsInfo postpramsinfo = new PostpramsInfo();
                postpramsinfo.Smileyoff   = postInfo.Smileyoff;
                postpramsinfo.Bbcodeoff   = postInfo.Bbcodeoff;
                postpramsinfo.Parseurloff = postInfo.Parseurloff;
                postpramsinfo.Allowhtml   = postInfo.Htmlon;
                postpramsinfo.Sdetail     = postInfo.Message;
                postpramsinfo.Pid         = postInfo.Pid;
                postpramsinfo.Showimages  = 1;

                //Discuz.Web.News.News

                //显示内容
                lblTitle.Text     = postInfo.Title;
                lblAuthor.Text    = postInfo.Poster;
                lblDatetime.Text  = postInfo.Postdatetime.ToString();
                content.InnerHtml = UBB.UBBToHTML(postpramsinfo);
            }
        }
    }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int tid = DNTRequest.GetInt("tid", 0);

        if (tid > 0)
        {
            try
            {
                //ShowtopicPagePostInfo info = Posts.GetSinglePost(tid);
                PostInfo postInfo = Posts.GetPostInfo(tid, Posts.GetFirstPostId(tid));
                if (postInfo != null)
                {
                    //处理帖子内容
                    PostpramsInfo postpramsinfo = new PostpramsInfo();
                    postpramsinfo.Smileyoff   = postInfo.Smileyoff;
                    postpramsinfo.Bbcodeoff   = postInfo.Bbcodeoff;
                    postpramsinfo.Parseurloff = postInfo.Parseurloff;
                    postpramsinfo.Allowhtml   = postInfo.Htmlon;
                    postpramsinfo.Sdetail     = postInfo.Message;
                    postpramsinfo.Pid         = postInfo.Pid;
                    postpramsinfo.Showimages  = 1;

                    //Discuz.Web.News.News

                    //显示内容
                    //lblTitle.Text = postInfo.Title;
                    //lblAuthor.Text = postInfo.Poster;
                    //lblDatetime.Text = postInfo.Postdatetime.ToString();
                    //content.InnerHtml = UBB.UBBToHTML(postpramsinfo);
                    string postInfos = "0|" + postInfo.Title + "|" + postInfo.Postdatetime + "|" + postInfo.Poster + "$$$$";
                    string test      = UBB.UBBToHTML(postpramsinfo);
                    Response.Write(postInfos + UBB.UBBToHTML(postpramsinfo));
                }
                else
                {
                    Response.Write("1|不存在相关内容");
                }
            }
            catch (Exception ex)
            {
                Response.Write("2|获取信息出错:" + ex);
            }
        }
        else
        {
            Response.Write("3|帖子不存在");
        }
    }
コード例 #3
0
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserId(userName.Text) > 0)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                userInfo             = AdminUsers.GetUserInfo(uid);
                userInfo.Username    = userName.Text;
                userInfo.Nickname    = nickname.Text;
                userInfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (userInfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    userInfo.Adminid = UserGroups.GetUserGroupInfo(int.Parse(groupid.SelectedValue)).Radminid;
                }

                //userInfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    userInfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        userInfo.Bday = bday.Text;
                    }
                }


                if (!Users.ValidateEmail(email.Text, uid))
                {
                    base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                    return;
                }

                userInfo.Email  = email.Text;
                userInfo.Gender = Convert.ToInt32(gender.SelectedValue);
                //userInfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);后台操作为永久禁言和永久禁访

                userInfo.Groupexpiry = 0;
                userInfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (userInfo.Uid == BaseConfigs.GetFounderUid))
                {
                    base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                userInfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                userInfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                userInfo.Joindate     = joindate.Text;
                userInfo.Lastactivity = lastactivity.Text;
                userInfo.Lastip       = lastip.Text;
                userInfo.Lastpost     = lastpost.Text;
                userInfo.Lastvisit    = lastvisit.Text;
                userInfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                userInfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                userInfo.Oltime       = Convert.ToInt32(oltime.Text);
                userInfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                userInfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                userInfo.Posts        = Convert.ToInt32(posts.Text);
                userInfo.Ppp          = Convert.ToInt32(ppp.Text);
                userInfo.Regip        = regip.Text;
                userInfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    userInfo.Secques = "";                               //清空安全码
                }
                userInfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                userInfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                userInfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                userInfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    userInfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    userInfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    userInfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    userInfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    userInfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    userInfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    userInfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    userInfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
                    return;
                }


                //根据公式计算用户的总积分,并更新
                userInfo.Credits = CreditsFacade.GetUserCreditsByUserInfo(userInfo);
                //判断用户组是否为积分用户组。如果是的话,就用当前积分更新。
                if (UserGroups.IsCreditUserGroup(userInfo.Groupid))
                {
                    userInfo.Groupid = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid;
                }
                //用户扩展信息
                userInfo.Website      = website.Text;
                userInfo.Icq          = icq.Text;
                userInfo.Qq           = qq.Text;
                userInfo.Yahoo        = yahoo.Text;
                userInfo.Msn          = msn.Text;
                userInfo.Skype        = skype.Text;
                userInfo.Location     = location.Text;
                userInfo.Customstatus = customstatus.Text;
                //userInfo.Avatar = avatar.Text;
                //userInfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                //userInfo.Avatarwidth = Convert.ToInt32(avatarwidth.Text);
                userInfo.Bio = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    userInfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(userInfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    userInfo.Sightml          = UBB.UBBToHTML(_postpramsinfo);
                }

                userInfo.Realname = realname.Text;
                userInfo.Idcard   = idcard.Text;
                userInfo.Mobile   = mobile.Text;
                userInfo.Phone    = phone.Text;
                userInfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked && userName.Text != ViewState["username"].ToString())
                {
                    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //用户重命名同步
                    Discuz.Forum.Sync.RenameUser(userInfo.Uid, ViewState["username"].ToString(), userInfo.Username, "");
                }

                if (AdminUsers.UpdateUserAllInfo(userInfo))
                {
                    OnlineUsers.DeleteUserByUid(userInfo.Uid);    //移除该用户的在线信息,使之重建在线表信息
                    if (ViewState["Groupid"].ToString() != userInfo.Groupid.ToString())
                    {
                        if (userInfo.Groupid == 4)
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().Ban(userInfo.Uid);
                            }
                        }
                        else
                        {
                            if (AlbumPluginProvider.GetInstance() != null)
                            {
                                AlbumPluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                            if (SpacePluginProvider.GetInstance() != null)
                            {
                                SpacePluginProvider.GetInstance().UnBan(userInfo.Uid);
                            }
                        }
                    }
                    //if (userName.Text != ViewState["username"].ToString())
                    //{
                    //    AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString());
                    //}
                    //删除头像
                    if (delavart.Checked)
                    {
                        Avatars.DeleteAvatar(userInfo.Uid.ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
コード例 #4
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");

                return;
            }
            user = Discuz.Forum.Users.GetUserInfo(userid);

            if (DNTRequest.IsPost())
            {
                SetBackLink("usercpforumsetting.aspx");
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                UserInfo __userinfo = new UserInfo();
                __userinfo.Uid          = userid;
                __userinfo.Tpp          = DNTRequest.GetInt("tpp", 0);
                __userinfo.Ppp          = DNTRequest.GetInt("ppp", 0);
                __userinfo.Pmsound      = DNTRequest.GetInt("pmsound", 0);
                __userinfo.Invisible    = DNTRequest.GetInt("invisible", 0);
                __userinfo.Customstatus = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("customstatus")));
                //获取提交的内容并进行脏字和Html处理
                string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

                int sigstatus = DNTRequest.GetInt("sigstatus", 0);
                //错误参数值纠正
                if (sigstatus != 0)
                {
                    sigstatus = 1;
                }

                PostpramsInfo _postpramsinfo = new PostpramsInfo();
                _postpramsinfo.Usergroupid        = usergroupid;
                _postpramsinfo.Attachimgpost      = config.Attachimgpost;
                _postpramsinfo.Showattachmentpath = config.Showattachmentpath;
                _postpramsinfo.Hide                   = 0;
                _postpramsinfo.Price                  = 0;
                _postpramsinfo.Sdetail                = signature;
                _postpramsinfo.Smileyoff              = 1;
                _postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
                _postpramsinfo.Parseurloff            = 1;
                _postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
                _postpramsinfo.Allowhtml              = 0;
                _postpramsinfo.Signature              = 1;
                _postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                _postpramsinfo.Customeditorbuttoninfo = null;//Editors.GetCustomEditButtonListWithInfo();
                _postpramsinfo.Smiliesmax             = config.Smiliesmax;
                _postpramsinfo.Signature              = 1;


                string sightml = UBB.UBBToHTML(_postpramsinfo);

                //if (usergroupinfo.Maxsigsize<Utils.ClearHtml(sightml).Length)
                if (DNTRequest.GetString("signature").Length > usergroupinfo.Maxsigsize)
                {
                    AddErrLine(string.Format("您的签名长度超过 {0} 字符的限制,请返回修改。", usergroupinfo.Maxsigsize));
                    return;
                }

                if (sightml.Length >= 1000)
                {
                    AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                    return;
                }

                __userinfo.Sigstatus = sigstatus;
                __userinfo.Signature = signature;
                __userinfo.Sightml   = sightml;

                Discuz.Forum.Users.UpdateUserForumSetting(__userinfo);
                OnlineUsers.UpdateInvisible(olid, __userinfo.Invisible);

                ForumUtils.WriteCookie("sigstatus", sigstatus);
                ForumUtils.WriteCookie("tpp", __userinfo.Tpp.ToString());
                ForumUtils.WriteCookie("ppp", __userinfo.Ppp.ToString());
                ForumUtils.WriteCookie("pmsound", __userinfo.Pmsound.ToString());

                SetUrl("usercpforumsetting.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("修改论坛设置完毕");
            }
        }
コード例 #5
0
        private User CreateUser(string userName, string nickname, string email, string birthday)
        {
            var userInfo = new User();

            userInfo.Name          = userName;
            userInfo.Email         = email;
            userInfo.Bday          = birthday;
            userInfo.NickName      = nickname;
            userInfo.Password      = Utils.MD5(ForumUtils.CreateAuthStr(16));
            userInfo.Secques       = "";
            userInfo.Gender        = DNTRequest.GetInt("gender", 0);
            userInfo.AdminID       = 0;
            userInfo.GroupExpiry   = 0;
            userInfo.ExtGroupIds   = "";
            userInfo.RegIP         = userInfo.LastIP = WebHelper.UserHost;
            userInfo.JoinDate      = userInfo.LastVisit = userInfo.LastActivity = userInfo.LastPost = DateTime.Now;
            userInfo.LastPostID    = 0;
            userInfo.LastPostTitle = "";
            userInfo.Posts         = 0;
            userInfo.DigestPosts   = 0;
            userInfo.OLTime        = 0;
            userInfo.PageViews     = 0;
            userInfo.Credits       = 0;
            userInfo.ExtCredits1   = Scoresets.GetScoreSet(1).Init;
            userInfo.ExtCredits2   = Scoresets.GetScoreSet(2).Init;
            userInfo.ExtCredits3   = Scoresets.GetScoreSet(3).Init;
            userInfo.ExtCredits4   = Scoresets.GetScoreSet(4).Init;
            userInfo.ExtCredits5   = Scoresets.GetScoreSet(5).Init;
            userInfo.ExtCredits6   = Scoresets.GetScoreSet(6).Init;
            userInfo.ExtCredits7   = Scoresets.GetScoreSet(7).Init;
            userInfo.ExtCredits8   = Scoresets.GetScoreSet(8).Init;
            userInfo.Sigstatus     = ((DNTRequest.GetInt("sigstatus", 1) != 0) ? 1 : 0);
            userInfo.Tpp           = DNTRequest.GetInt("tpp", 0);
            userInfo.Ppp           = DNTRequest.GetInt("ppp", 0);
            userInfo.TemplateID    = DNTRequest.GetInt("templateid", 0);
            userInfo.Pmsound       = DNTRequest.GetInt("pmsound", 0);
            userInfo.ShowEmail     = DNTRequest.GetInt("showemail", 0) != 0;
            userInfo.Salt          = "";
            int newsletter = (this.config.Regadvance == 0) ? 3 : DNTRequest.GetInt("receivesetting", 3);

            //userInfo.Newsletter = (ReceivePMSettingType)newsletter;
            userInfo.NewsLetter  = newsletter;
            userInfo.Invisible   = DNTRequest.GetInt("invisible", 0) != 0;
            userInfo.Newpm       = ((this.config.Welcomemsg == 1) ? 1 : 0) != 0;
            userInfo.AccessMasks = DNTRequest.GetInt("accessmasks", 0);

            var uf = userInfo.Field;

            uf.Medals       = "";
            uf.Website      = DNTRequest.GetHtmlEncodeString("website");
            uf.Icq          = DNTRequest.GetHtmlEncodeString("icq");
            uf.qq           = DNTRequest.GetHtmlEncodeString("qq");
            uf.Yahoo        = DNTRequest.GetHtmlEncodeString("yahoo");
            uf.Msn          = DNTRequest.GetHtmlEncodeString("msn");
            uf.Skype        = DNTRequest.GetHtmlEncodeString("skype");
            uf.Location     = DNTRequest.GetHtmlEncodeString("location");
            uf.Customstatus = usergroupinfo.AllowCstatus ? DNTRequest.GetHtmlEncodeString("customstatus") : "";
            uf.Bio          = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            uf.Signature    = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));
            uf.Sightml      = UBB.UBBToHTML(new PostpramsInfo
            {
                Usergroupid        = this.usergroupid,
                Attachimgpost      = this.config.Attachimgpost,
                Showattachmentpath = this.config.Showattachmentpath,
                Hide                   = 0,
                Price                  = 0,
                Sdetail                = uf.Signature,
                Smileyoff              = 1,
                BBCode                 = this.usergroupinfo.AllowSigbbCode,
                Parseurloff            = 1,
                Showimages             = this.usergroupinfo.AllowSigimgCode ? 1 : 0,
                Allowhtml              = 0,
                Smiliesinfo            = Smilies.GetSmiliesListWithInfo(),
                Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo(),
                Smiliesmax             = this.config.Smiliesmax
            });
            uf.AuthTime = DateTime.Now;
            uf.RealName = DNTRequest.GetString("realname");
            uf.Idcard   = DNTRequest.GetString("idcard");
            uf.Mobile   = DNTRequest.GetString("mobile");
            uf.Phone    = DNTRequest.GetString("phone");
            if (this.config.Regverify == 2)
            {
                uf.Authstr       = DNTRequest.GetString("website");
                userInfo.GroupID = 8;
                uf.Authflag      = 1;
            }
            else
            {
                uf.Authstr       = "";
                uf.Authflag      = 0;
                userInfo.GroupID = CreditsFacade.GetCreditsUserGroupId(0f).ID;
            }
            //userInfo.ID = Users.CreateUser(userInfo);
            userInfo.Save();
            return(userInfo);
        }
コード例 #6
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (!IsLogin())
            {
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }

                ValidateInfo();

                if (IsErr())
                {
                    return;
                }

                if (page_err == 0)
                {
                    UserInfo oldUserInfo = Users.GetUserInfo(userid);
                    UserInfo userInfo    = oldUserInfo.Clone();
                    //需要判断签名是否修改过
                    sig               = oldUserInfo.Sightml;
                    userInfo.Uid      = userid;
                    userInfo.Username = username;
                    userInfo.Nickname = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
                    userInfo.Gender   = DNTRequest.GetInt("gender", 0);
                    userInfo.Realname = DNTRequest.GetHtmlEncodeString("realname");
                    userInfo.Idcard   = DNTRequest.GetHtmlEncodeString("idcard");
                    userInfo.Mobile   = DNTRequest.GetHtmlEncodeString("mobile");
                    userInfo.Phone    = DNTRequest.GetHtmlEncodeString("phone");
                    userInfo.Email    = DNTRequest.GetHtmlEncodeString("email").Trim().ToLower();
                    if (userInfo.Email != oldUserInfo.Email && !Users.ValidateEmail(userInfo.Email, userid))
                    {
                        AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        return;
                    }

                    userInfo.Bday      = DNTRequest.GetHtmlEncodeString("bday");
                    userInfo.Showemail = DNTRequest.GetInt("showemail", 1);

                    if (DNTRequest.GetString("website").IndexOf(".") > -1 && !DNTRequest.GetString("website").ToLower().StartsWith("http"))
                    {
                        userInfo.Website = Utils.HtmlEncode("http://" + DNTRequest.GetString("website"));
                    }
                    else
                    {
                        userInfo.Website = DNTRequest.GetHtmlEncodeString("website");
                    }

                    userInfo.Icq      = DNTRequest.GetHtmlEncodeString("icq");
                    userInfo.Qq       = DNTRequest.GetHtmlEncodeString("qq");
                    userInfo.Yahoo    = DNTRequest.GetHtmlEncodeString("yahoo");
                    userInfo.Msn      = DNTRequest.GetHtmlEncodeString("msn");
                    userInfo.Skype    = DNTRequest.GetHtmlEncodeString("skype");
                    userInfo.Location = DNTRequest.GetHtmlEncodeString("location");
                    userInfo.Bio      = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("bio"));

                    PostpramsInfo postPramsInfo = new PostpramsInfo();
                    postPramsInfo.Usergroupid        = usergroupid;
                    postPramsInfo.Attachimgpost      = config.Attachimgpost;
                    postPramsInfo.Showattachmentpath = config.Showattachmentpath;
                    postPramsInfo.Hide  = 0;
                    postPramsInfo.Price = 0;
                    //获取提交的内容并进行脏字和Html处理
                    postPramsInfo.Sdetail                = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("signature"));;
                    postPramsInfo.Smileyoff              = 1;
                    postPramsInfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
                    postPramsInfo.Parseurloff            = 1;
                    postPramsInfo.Showimages             = usergroupinfo.Allowsigimgcode;
                    postPramsInfo.Allowhtml              = 0;
                    postPramsInfo.Signature              = 1;
                    postPramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                    postPramsInfo.Customeditorbuttoninfo = null;
                    postPramsInfo.Smiliesmax             = config.Smiliesmax;
                    postPramsInfo.Signature              = 1;

                    userInfo.Sightml = UBB.UBBToHTML(postPramsInfo);
                    if (sig != userInfo.Sightml)
                    {
                        Sync.UpdateSignature(userid, userInfo.Username, userInfo.Sightml, "");
                    }
                    if (userInfo.Sightml.Length >= 1000)
                    {
                        AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                        return;
                    }

                    userInfo.Signature = postPramsInfo.Sdetail;
                    userInfo.Sigstatus = DNTRequest.GetInt("sigstatus", 0) != 0 ? 1 : 0;


                    if (CheckModified(oldUserInfo, userInfo))
                    {
                        Users.UpdateUserProfile(userInfo);
                        Sync.UpdateProfile(userInfo.Uid, userInfo.Username, "");
                    }
                    OnlineUsers.DeleteUserByUid(userid);    //删除在线表中的信息,使之重建该用户在线表信息
                    //ManyouApplications.AddUserLog(userid, UserLogActionEnum.Update);

                    ForumUtils.WriteCookie("sigstatus", userInfo.Sigstatus.ToString());

                    SetUrl("usercpprofile.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("修改个人档案完毕");
                }
            }
            else
            {
                pagename += action == "" ? "" : "?action=" + action;

                UserInfo userInfo = Users.GetUserInfo(userid);//olid
                avatarFlashParam = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "images/common/camera.swf?nt=1&inajax=1&appid=" +
                                   Utils.MD5(userInfo.Username + userInfo.Password + userInfo.Uid + olid) + "&input=" +
                                   DES.Encode(userid + "," + olid, config.Passwordkey) + "&ucapi=" + Utils.UrlEncode(Utils.GetRootUrl(BaseConfigs.GetForumPath) +
                                                                                                                     "tools/ajax.aspx");
                avatarImage = Avatars.GetAvatarUrl(userid);
            }
        }
コード例 #7
0
        /// <summary>
        /// 创建用户信息
        /// </summary>
        /// <param name="tmpUsername"></param>
        /// <param name="email"></param>
        /// <param name="tmpBday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string tmpUsername, string email, string tmpBday)
        {
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userinfo.Password      = DNTRequest.GetString("password");
            userinfo.Secques       = ForumUtils.GetUserSecques(DNTRequest.GetInt("question", 0), DNTRequest.GetString("answer"));
            userinfo.Gender        = DNTRequest.GetInt("gender", 0);
            userinfo.Adminid       = 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Utils.GetDateTime();
            userinfo.Lastip        = DNTRequest.GetIP();
            userinfo.Lastvisit     = Utils.GetDateTime();
            userinfo.Lastactivity  = Utils.GetDateTime();
            userinfo.Lastpost      = Utils.GetDateTime();
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = email;
            userinfo.Bday       = tmpBday;
            userinfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userinfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userinfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userinfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userinfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userinfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userinfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            userinfo.Website      = Utils.HtmlEncode(DNTRequest.GetString("website"));
            userinfo.Icq          = Utils.HtmlEncode(DNTRequest.GetString("icq"));
            userinfo.Qq           = Utils.HtmlEncode(DNTRequest.GetString("qq"));
            userinfo.Yahoo        = Utils.HtmlEncode(DNTRequest.GetString("yahoo"));
            userinfo.Msn          = Utils.HtmlEncode(DNTRequest.GetString("msn"));
            userinfo.Skype        = Utils.HtmlEncode(DNTRequest.GetString("skype"));
            userinfo.Location     = Utils.HtmlEncode(DNTRequest.GetString("location"));
            userinfo.Customstatus = (usergroupinfo.Allowcstatus == 1) ? Utils.HtmlEncode(DNTRequest.GetString("customstatus")) : "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userinfo.Signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userinfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = Utils.GetDateTime();

            //邮箱激活链接验证
            if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = DNTRequest.GetString("website");
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = DNTRequest.GetString("realname");
            userinfo.Idcard   = DNTRequest.GetString("idcard");
            userinfo.Mobile   = DNTRequest.GetString("mobile");
            userinfo.Phone    = DNTRequest.GetString("phone");

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
コード例 #8
0
        /// <summary>
        /// 根据附件加载帖子内容
        /// </summary>
        /// <param name="postpramsInfo">参数对象</param>
        /// <param name="attachList">附件列表</param>
        /// <param name="isModer">是否是管理人员</param>
        /// <param name="allowGetAttach">是否允许获取附件</param>
        /// <param name="originalHideStatus">帖子原始Hide属性</param>
        /// <param name="postInfo">帖子信息 </param>
        private static void LoadPostMessage(PostpramsInfo postpramsInfo, List <ShowtopicPageAttachmentInfo> attachList, bool isModer, int allowGetAttach, int originalHideStatus, ShowtopicPagePostInfo postInfo)
        {
            UserGroupInfo tmpGroupInfo;

            if (!Utils.InArray(postInfo.Groupid.ToString(), "4,5,6"))
            {
                //处理帖子内容
                postpramsInfo.Smileyoff   = postInfo.Smileyoff;
                postpramsInfo.Bbcodeoff   = postInfo.Bbcodeoff;
                postpramsInfo.Parseurloff = postInfo.Parseurloff;
                postpramsInfo.Allowhtml   = postInfo.Htmlon;
                postpramsInfo.Sdetail     = postInfo.Message;
                postpramsInfo.Pid         = postInfo.Pid;
                //校正hide处理
                tmpGroupInfo = UserGroups.GetUserGroupInfo(postInfo.Groupid);
                if (tmpGroupInfo.Allowhidecode == 0)
                {
                    postpramsInfo.Hide = 0;
                }

                //先简单判断是否是动网兼容模式
                if (!postpramsInfo.Ubbmode)
                {
                    postInfo.Message = UBB.UBBToHTML(postpramsInfo);
                }
                else
                {
                    postInfo.Message = Utils.HtmlEncode(postInfo.Message);
                }

                if (postpramsInfo.Jammer == 1)
                {
                    postInfo.Message = ForumUtils.AddJammer(postInfo.Message);
                }

                string message = postInfo.Message;
                if (postInfo.Attachment > 0 || regexAttach.IsMatch(message) || regexAttachImg.IsMatch(message))
                {
                    //获取在[hide]标签中的附件id
                    string[] attHidArray = Posts.GetHiddenAttachIdList(postpramsInfo.Sdetail, postpramsInfo.Hide);
                    List <ShowtopicPageAttachmentInfo> attachDeleteList = new List <ShowtopicPageAttachmentInfo>();
                    foreach (ShowtopicPageAttachmentInfo attach in attachList)
                    {
                        message = Attachments.GetMessageWithAttachInfo(postpramsInfo, allowGetAttach, attHidArray, postInfo, attach, message);
                        if ((postpramsInfo.CurrentUserGroup.Radminid == 1 || attach.Uid == postpramsInfo.CurrentUserid || attach.Attachprice <= 0 || attach.Isbought == 1) ||//当为发帖人或不为收费附件或已购买该收费附件时
                            Utils.InArray(attach.Aid.ToString(), attHidArray))
                        {
                            ;
                        }
                        else
                        {
                            attachDeleteList.Add(attach);
                        }
                    }

                    foreach (ShowtopicPageAttachmentInfo attach in attachDeleteList)
                    {
                        attachList.Remove(attach);
                    }
                    postInfo.Message = message;
                }

                //恢复hide初值
                postpramsInfo.Hide = originalHideStatus;
            }
            else//发帖人已经被禁止发言
            {
                if (isModer)
                {
                    postInfo.Message = "<div class='hintinfo'>该用户帖子内容已被屏蔽, 您拥有管理权限, 以下是帖子内容</div>" + postInfo.Message;
                }
                else
                {
                    postInfo.Message = "该用户帖子内容已被屏蔽";
                    List <ShowtopicPageAttachmentInfo> delattlist = new List <ShowtopicPageAttachmentInfo>();
                    foreach (ShowtopicPageAttachmentInfo attach in attachList)
                    {
                        if (attach.Pid == postInfo.Pid)
                        {
                            delattlist.Add(attach);
                        }
                    }

                    foreach (ShowtopicPageAttachmentInfo attach in delattlist)
                    {
                        attachList.Remove(attach);
                    }
                }
            }
        }
コード例 #9
0
        private void SaveUserInfo_Click(object sender, EventArgs e)
        {
            #region 保存用户信息

            if (this.CheckCookie())
            {
                int    uid       = DNTRequest.GetInt("uid", -1);
                string errorInfo = "";

                if (!AllowEditUserInfo(uid, true))
                {
                    return;
                }

                if (userName.Text != ViewState["username"].ToString())
                {
                    if (AdminUsers.GetUserID(userName.Text) != -1)
                    {
                        base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
                        return;
                    }
                }

                if (userName.Text == "")
                {
                    base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
                    return;
                }

                if (groupid.SelectedValue == "0")
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
                    return;
                }

                __userinfo             = AdminUsers.GetUserInfo(uid);
                __userinfo.Username    = userName.Text;
                __userinfo.Nickname    = nickname.Text;
                __userinfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue);

                //当用户组发生变化时则相应更新用户的管理组字段
                if (__userinfo.Groupid.ToString() != groupid.SelectedValue)
                {
                    __userinfo.Adminid = DatabaseProvider.GetInstance().GetRadminidByGroupid(int.Parse(groupid.SelectedValue));
                }

                __userinfo.Avatarshowid = 0;

                if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == ""))
                {
                    __userinfo.Bday = "";
                }
                else
                {
                    if (!Utils.IsDateString(bday.Text.Trim()))
                    {
                        base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                        return;
                    }
                    else
                    {
                        __userinfo.Bday = bday.Text;
                    }
                }

                if (Utils.IsNumeric(credits.Text.Replace("-", "")))
                {
                    __userinfo.Credits = Convert.ToInt32(credits.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户的金币不能为空或大于9位 !');</script>");
                    return;
                }

                GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                if (__configinfo.Doublee == 0)
                {
                    int currentuid = AdminUsers.FindUserEmail(email.Text);
                    if ((currentuid != -1) && (currentuid != uid))
                    {
                        base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
                        return;
                    }
                }

                __userinfo.Email       = email.Text;
                __userinfo.Gender      = Convert.ToInt32(gender.SelectedValue);
                __userinfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);
                __userinfo.Extgroupids = extgroupids.GetSelectString(",");

                if ((groupid.SelectedValue != "1") && (__userinfo.Uid == 1))
                {
                    base.RegisterStartupScript("", "<script>alert('初始化系统管理员的所属用户组设置不能修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>");
                    return;
                }

                __userinfo.Groupid      = Convert.ToInt32(groupid.SelectedValue);
                __userinfo.Invisible    = Convert.ToInt32(invisible.SelectedValue);
                __userinfo.Joindate     = joindate.Text;
                __userinfo.Lastactivity = lastactivity.Text;
                __userinfo.Lastip       = lastip.Text;
                __userinfo.Lastpost     = lastpost.Text;
                __userinfo.Lastvisit    = lastvisit.Text;
                __userinfo.Newpm        = Convert.ToInt32(newpm.SelectedValue);
                __userinfo.Newsletter   = (ReceivePMSettingType)GetNewsLetter();
                __userinfo.Oltime       = Convert.ToInt32(oltime.Text);
                __userinfo.Pageviews    = Convert.ToInt32(pageviews.Text);
                __userinfo.Pmsound      = Convert.ToInt32(pmsound.Text);
                __userinfo.Posts        = Convert.ToInt32(posts.Text);
                __userinfo.Ppp          = Convert.ToInt32(ppp.Text);
                __userinfo.Regip        = regip.Text;
                __userinfo.Digestposts  = Convert.ToInt32(digestposts.Text);

                if (secques.SelectedValue == "1")
                {
                    __userinfo.Secques = "";                               //清空安全码
                }
                __userinfo.Showemail  = Convert.ToInt32(showemail.SelectedValue);
                __userinfo.Sigstatus  = Convert.ToInt32(sigstatus.SelectedValue);
                __userinfo.Templateid = Convert.ToInt32(templateid.SelectedValue);
                __userinfo.Tpp        = Convert.ToInt32(tpp.Text);


                if (Utils.IsNumeric(extcredits1.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits1 = float.Parse(extcredits1.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits2.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits2 = float.Parse(extcredits2.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits3.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits3 = float.Parse(extcredits3.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits4.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits4 = float.Parse(extcredits4.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits5.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits5 = float.Parse(extcredits5.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits6.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits6 = float.Parse(extcredits6.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits7.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits7 = float.Parse(extcredits7.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }

                if (Utils.IsNumeric(extcredits8.Text.Replace("-", "")))
                {
                    __userinfo.Extcredits8 = float.Parse(extcredits8.Text);
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('用户扩展金币不能为空或大于7位 !');</script>");
                    return;
                }


                //用户扩展信息
                __userinfo.Website      = website.Text;
                __userinfo.Icq          = icq.Text;
                __userinfo.Qq           = qq.Text;
                __userinfo.Yahoo        = yahoo.Text;
                __userinfo.Msn          = msn.Text;
                __userinfo.Skype        = skype.Text;
                __userinfo.Location     = location.Text;
                __userinfo.Customstatus = customstatus.Text;
                __userinfo.Avatar       = avatar.Text;
                __userinfo.Avatarheight = Convert.ToInt32(avatarheight.Text);
                __userinfo.Avatarwidth  = Convert.ToInt32(avatarwidth.Text);
                __userinfo.Bio          = bio.Text;
                if (signature.Text.Length > UserGroups.GetUserGroupInfo(__userinfo.Groupid).Maxsigsize)
                {
                    errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(__userinfo.Groupid).Maxsigsize + " 字符的限制,未能更新。";
                }
                else
                {
                    __userinfo.Signature = signature.Text;
                    //签名UBB转换HTML
                    PostpramsInfo _postpramsinfo = new PostpramsInfo();
                    _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(__userinfo.Groupid).Allowsigimgcode;
                    _postpramsinfo.Sdetail    = signature.Text;
                    __userinfo.Sightml        = UBB.UBBToHTML(_postpramsinfo);
                }

                __userinfo.Realname = realname.Text;
                __userinfo.Idcard   = idcard.Text;
                __userinfo.Mobile   = mobile.Text;
                __userinfo.Phone    = phone.Text;
                __userinfo.Medals   = DNTRequest.GetString("medalid");

                if (IsEditUserName.Checked)
                {
                    AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                }

                if (AdminUsers.UpdateUserAllInfo(__userinfo))
                {
                    if (userName.Text != ViewState["username"].ToString())
                    {
                        AdminUsers.UserNameChange(__userinfo, ViewState["username"].ToString());
                    }
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text);
                    if (errorInfo == "")
                    {
                        base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                    else
                    {
                        base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';");
                    }
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>");
                }
            }

            #endregion
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    pertask       = DNTRequest.GetInt("pertask", 0);
                int    lastnumber    = DNTRequest.GetInt("lastnumber", 0);
                int    startvalue    = DNTRequest.GetInt("startvalue", 0);
                int    endvalue      = DNTRequest.GetInt("endvalue", 0);
                string resultmessage = "";
                switch (Request.Params["opname"])
                {
                case "UpdatePostSP":
                    AdminForumStats.UpdatePostSP(pertask, ref lastnumber);
                    resultmessage = lastnumber.ToString();
                    break;

                case "UpdateMyPost":
                    AdminForumStats.UpdateMyPost(pertask, ref lastnumber);
                    resultmessage = lastnumber.ToString();
                    break;

                case "ReSetFourmTopicAPost":
                    //AdminForumStats.ReSetFourmTopicAPost(pertask, ref lastnumber);
                    AdminForumStats.ReSetFourmTopicAPost();
                    resultmessage = "-1";
                    break;

                case "ReSetUserDigestPosts":
                    //AdminForumStats.ReSetUserDigestPosts(pertask, ref lastnumber);
                    //resultmessage = lastnumber.ToString();
                    AdminForumStats.ReSetUserDigestPosts();
                    resultmessage = "-1";
                    break;

                case "ReSetUserPosts":
                    AdminForumStats.ReSetUserPosts(pertask, ref lastnumber);
                    resultmessage = lastnumber.ToString();
                    break;

                case "ReSetTopicPosts":
                    AdminForumStats.ReSetTopicPosts(pertask, ref lastnumber);
                    resultmessage = lastnumber.ToString();
                    break;

                case "ReSetFourmTopicAPost_StartEnd":
                    AdminForumStats.ReSetFourmTopicAPost(startvalue, endvalue);
                    resultmessage = "1";
                    break;

                case "ReSetUserDigestPosts_StartEnd":
                    AdminForumStats.ReSetUserDigestPosts(startvalue, endvalue);
                    resultmessage = "1";
                    break;

                case "ReSetUserPosts_StartEnd":
                    AdminForumStats.ReSetUserPosts(startvalue, endvalue);
                    resultmessage = "1";
                    break;

                case "ReSetTopicPosts_StartEnd":
                    AdminForumStats.ResetLastRepliesInfoOfTopics(startvalue, endvalue);
                    resultmessage = "1";
                    break;

                case "ftptest":
                    FTPs   ftps    = new FTPs();
                    string message = "";
                    bool   ok      = ftps.TestConnect(DNTRequest.GetString("serveraddress"), DNTRequest.GetInt("serverport", 0), DNTRequest.GetString("username"),
                                                      DNTRequest.GetString("password"), DNTRequest.GetInt("timeout", 0), DNTRequest.GetString("uploadpath"), ref message);
                    resultmessage = ok ? "ok" : "远程附件设置测试出现错误!\n描述:" + message;
                    break;

                case "setapp":
                    APIConfigInfo aci = APIConfigs.GetConfig();
                    aci.Enable = DNTRequest.GetString("allowpassport") == "1";
                    APIConfigs.SaveConfig(aci);
                    resultmessage = "ok";
                    break;

                case "location":
                    string city = DNTRequest.GetString("city");
                    resultmessage = "ok";
                    DataTable dt = MallPluginProvider.GetInstance().GetLocationsTable();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["country"].ToString() == DNTRequest.GetString("country") && dr["state"].ToString() == DNTRequest.GetString("state") && dr["city"].ToString() == city)
                        {
                            resultmessage = "<img src='../images/false.gif' title='" + city + "已经存在!'>";
                            break;
                        }
                    }
                    break;

                case "goodsinfo":
                    int       goodsid   = DNTRequest.GetInt("goodsid", 0);
                    Goodsinfo goodsinfo = MallPluginProvider.GetInstance().GetGoodsInfo(goodsid);
                    if (goodsinfo == null)
                    {
                        resultmessage = "商品不存在!";
                        break;
                    }
                    //GoodsattachmentinfoCollection attachmentinfos = GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid);
                    //string img = "";
                    //if (attachmentinfos != null)
                    //{
                    //    img = attachmentinfos[0].Filename;
                    //}
                    PostpramsInfo param = new PostpramsInfo();
                    param.Allowhtml  = 1;
                    param.Showimages = 1;
                    param.Sdetail    = goodsinfo.Message;
                    resultmessage    = "<table width='100%'><tr><td>" + UBB.UBBToHTML(param) + "</td></tr></table>";
                    break;

                case "downloadword":
                    dt = BanWords.GetBanWordList();
                    string words = "";
                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            words += dt.Rows[i][2].ToString() + "=" + dt.Rows[i][3].ToString() + "\r\n";
                        }
                    }

                    string filename = "words.txt";
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Buffer          = false;
                    HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
                    HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename));
                    HttpContext.Current.Response.ContentType = "text/plain";
                    HttpContext.Current.Response.Write(words);
                    HttpContext.Current.Response.End();
                    break;

                case "gettopicinfo":
                    StringBuilder sb   = new StringBuilder();
                    TopicInfo     info = Topics.GetTopicInfo(DNTRequest.GetInt("tid", 0));
                    sb.Append("[");
                    if (info != null)
                    {
                        sb.Append(string.Format("{{'tid':{0},'title':'{1}'}}", info.Tid, info.Title));
                    }

                    System.Web.HttpContext.Current.Response.Clear();
                    System.Web.HttpContext.Current.Response.ContentType = "application/json";
                    System.Web.HttpContext.Current.Response.Expires     = 0;
                    System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                    System.Web.HttpContext.Current.Response.Write(sb.Append("]").ToString());
                    System.Web.HttpContext.Current.Response.End();
                    break;
                }
                Response.Write(resultmessage);
                Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1);
                Response.Expires         = -1;
                Response.End();
            }
        }
コード例 #11
0
ファイル: usercpprofile.cs プロジェクト: xiongeee/BBX
        protected override void ShowPage()
        {
            this.pagetitle = "用户控制面板";
            if (!base.IsLogin())
            {
                return;
            }

            var uid = userid;

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                this.ValidateInfo();
                if (base.IsErr())
                {
                    return;
                }

                if (this.page_err == 0)
                {
                    var userInfo = Users.GetUserInfo(uid);
                    //var userInfo2 = (User)userInfo.Clone();
                    var uf = userInfo.Field;
                    this.sig = userInfo.Field.Sightml;
                    //userInfo.ID = uid;
                    userInfo.Name     = this.username;
                    userInfo.NickName = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
                    userInfo.Gender   = DNTRequest.GetInt("gender", 0);

                    uf.RealName = DNTRequest.GetHtmlEncodeString("realname");
                    uf.Idcard   = DNTRequest.GetHtmlEncodeString("idcard");
                    uf.Mobile   = DNTRequest.GetHtmlEncodeString("mobile");
                    uf.Phone    = DNTRequest.GetHtmlEncodeString("phone");

                    var email = DNTRequest.GetHtmlEncodeString("email").Trim().ToLower();
                    if (email != userInfo.Email && !Users.ValidateEmail(email, userInfo.ID))
                    {
                        base.AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        return;
                    }
                    userInfo.Email = email;

                    userInfo.Bday      = DNTRequest.GetHtmlEncodeString("bday");
                    userInfo.ShowEmail = DNTRequest.GetInt("showemail", 1) != 0;

                    if (DNTRequest.GetString("website").IndexOf(".") > -1 && !DNTRequest.GetString("website").ToLower().StartsWith("http"))
                    {
                        uf.Website = Utils.HtmlEncode("http://" + DNTRequest.GetString("website"));
                    }
                    else
                    {
                        uf.Website = DNTRequest.GetHtmlEncodeString("website");
                    }
                    uf.Icq      = DNTRequest.GetHtmlEncodeString("icq");
                    uf.qq       = DNTRequest.GetHtmlEncodeString("qq");
                    uf.Yahoo    = DNTRequest.GetHtmlEncodeString("yahoo");
                    uf.Msn      = DNTRequest.GetHtmlEncodeString("msn");
                    uf.Skype    = DNTRequest.GetHtmlEncodeString("skype");
                    uf.Location = DNTRequest.GetHtmlEncodeString("location");
                    uf.Bio      = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("bio"));

                    var postpramsInfo = new PostpramsInfo();
                    postpramsInfo.Usergroupid        = this.usergroupid;
                    postpramsInfo.Attachimgpost      = this.config.Attachimgpost;
                    postpramsInfo.Showattachmentpath = this.config.Showattachmentpath;
                    postpramsInfo.Hide                   = 0;
                    postpramsInfo.Price                  = 0;
                    postpramsInfo.Sdetail                = ForumUtils.BanWordFilter(DNTRequest.GetHtmlEncodeString("signature"));
                    postpramsInfo.Smileyoff              = 1;
                    postpramsInfo.BBCode                 = this.usergroupinfo.AllowSigbbCode;
                    postpramsInfo.Parseurloff            = 1;
                    postpramsInfo.Showimages             = this.usergroupinfo.AllowSigimgCode ? 1 : 0;
                    postpramsInfo.Allowhtml              = 0;
                    postpramsInfo.Signature              = 1;
                    postpramsInfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                    postpramsInfo.Customeditorbuttoninfo = null;
                    postpramsInfo.Smiliesmax             = this.config.Smiliesmax;
                    postpramsInfo.Signature              = 1;

                    uf.Sightml = UBB.UBBToHTML(postpramsInfo);
                    if (this.sig != uf.Sightml)
                    {
                        Sync.UpdateSignature(userInfo.ID, userInfo.Name, uf.Sightml, "");
                    }
                    if (uf.Sightml.Length >= 1000)
                    {
                        base.AddErrLine("您的签名转换后超出系统最大长度, 请返回修改");
                        return;
                    }
                    uf.Signature       = postpramsInfo.Sdetail;
                    userInfo.Sigstatus = ((DNTRequest.GetInt("sigstatus", 0) != 0) ? 1 : 0);
                    //throw new NotImplementedException("CheckModified");
                    ////if (this.CheckModified(userInfo, userInfo2))
                    //{
                    //    //Users.UpdateUserProfile(userInfo2);
                    //    Sync.UpdateProfile(userInfo.ID, userInfo.Name, "");
                    //}
                    userInfo.Save();
                    Sync.UpdateProfile(userInfo.ID, userInfo.Name, "");

                    Online.DeleteUserByUid(userInfo.ID);
                    ForumUtils.WriteCookie("sigstatus", userInfo.Sigstatus.ToString());

                    base.SetUrl("usercpprofile.aspx");
                    base.SetMetaRefresh();
                    base.SetShowBackLink(true);
                    base.AddMsgLine("修改个人档案完毕");
                    return;
                }
            }
            else
            {
                this.pagename += ((String.IsNullOrEmpty(this.action)) ? "" : ("?action=" + this.action));
                var userInfo3 = Users.GetUserInfo(uid);
                this.avatarFlashParam = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "images/common/camera.swf?nt=1&inajax=1&appid=" + (Utils.MD5(userInfo3.Name + userInfo3.Password + userInfo3.ID + this.olid)) + "&input=" + (DES.Encode(uid + "," + this.olid, this.config.Passwordkey)) + "&ucapi=" + (Utils.UrlEncode(Utils.GetRootUrl(BaseConfigs.GetForumPath) + "tools/ajax.ashx"));
                this.avatarImage      = Avatars.GetAvatarUrl(uid);
            }
        }
コード例 #12
0
 private void SaveUserInfo_Click(object sender, EventArgs e)
 {
     if (base.CheckCookie())
     {
         int    @int = DNTRequest.GetInt("uid", -1);
         string text = "";
         if (!this.AllowEditUserInfo(@int, true))
         {
             return;
         }
         if (this.userName.Text != this.ViewState["username"].ToString() && Users.GetUserId(this.userName.Text) > 0)
         {
             base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>");
             return;
         }
         if (this.userName.Text == "")
         {
             base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>");
             return;
         }
         if (this.groupid.SelectedValue == "0")
         {
             base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>");
             return;
         }
         this.userInfo             = Users.GetUserInfo(@int);
         this.userInfo.Name        = this.userName.Text;
         this.userInfo.NickName    = this.nickname.Text;
         this.userInfo.AccessMasks = Convert.ToInt32(this.accessmasks.SelectedValue);
         if (this.userInfo.GroupID.ToString() != this.groupid.SelectedValue)
         {
             this.userInfo.AdminID = UserGroup.FindByID(int.Parse(this.groupid.SelectedValue)).RadminID;
         }
         if (this.bday.Text == "0000-00-00" || (this.bday.Text == "0000-0-0" | this.bday.Text.Trim() == ""))
         {
             this.userInfo.Bday = "";
         }
         else
         {
             if (!Utils.IsDateString(this.bday.Text.Trim()))
             {
                 base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>");
                 return;
             }
             this.userInfo.Bday = this.bday.Text;
         }
         if (!Users.ValidateEmail(this.email.Text, @int))
         {
             base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>");
             return;
         }
         this.userInfo.Email       = this.email.Text;
         this.userInfo.Gender      = Convert.ToInt32(this.gender.SelectedValue);
         this.userInfo.GroupExpiry = 0;
         this.userInfo.ExtGroupIds = this.extgroupids.GetSelectString(",");
         if (this.groupid.SelectedValue != "1" && this.userInfo.ID == BaseConfigs.GetFounderUid)
         {
             base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + Request["uid"] + "';</script>");
             return;
         }
         this.userInfo.GroupID      = Convert.ToInt32(this.groupid.SelectedValue);
         this.userInfo.Invisible    = Convert.ToInt32(this.invisible.SelectedValue);
         this.userInfo.JoinDate     = DateTime.Parse(this.joindate.Text);
         this.userInfo.LastActivity = DateTime.Parse(this.lastactivity.Text);
         this.userInfo.LastIP       = this.lastip.Text;
         this.userInfo.LastPost     = DateTime.Parse(this.lastpost.Text);
         this.userInfo.LastVisit    = DateTime.Parse(this.lastvisit.Text);
         this.userInfo.Newpm        = Convert.ToInt32(this.newpm.SelectedValue);
         //this.userInfo.NewsLetter = (ReceivePMSettingType)this.GetNewsLetter();
         this.userInfo.NewsLetter  = this.GetNewsLetter();
         this.userInfo.OLTime      = Convert.ToInt32(this.oltime.Text);
         this.userInfo.PageViews   = Convert.ToInt32(this.pageviews.Text);
         this.userInfo.Pmsound     = Convert.ToInt32(this.pmsound.Text);
         this.userInfo.Posts       = Convert.ToInt32(this.posts.Text);
         this.userInfo.Ppp         = Convert.ToInt32(this.ppp.Text);
         this.userInfo.RegIP       = this.regip.Text;
         this.userInfo.DigestPosts = Convert.ToInt32(this.digestposts.Text);
         if (this.secques.SelectedValue == "1")
         {
             this.userInfo.Secques = "";
         }
         this.userInfo.ShowEmail  = Convert.ToInt32(this.showemail.SelectedValue);
         this.userInfo.Sigstatus  = Convert.ToInt32(this.sigstatus.SelectedValue);
         this.userInfo.TemplateID = Convert.ToInt32(this.templateid.SelectedValue);
         this.userInfo.Tpp        = Convert.ToInt32(this.tpp.Text);
         if (!Utils.IsNumeric(this.extcredits1.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits1 = float.Parse(this.extcredits1.Text);
         if (!Utils.IsNumeric(this.extcredits2.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits2 = float.Parse(this.extcredits2.Text);
         if (!Utils.IsNumeric(this.extcredits3.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits3 = float.Parse(this.extcredits3.Text);
         if (!Utils.IsNumeric(this.extcredits4.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits4 = float.Parse(this.extcredits4.Text);
         if (!Utils.IsNumeric(this.extcredits5.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits5 = float.Parse(this.extcredits5.Text);
         if (!Utils.IsNumeric(this.extcredits6.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits6 = float.Parse(this.extcredits6.Text);
         if (!Utils.IsNumeric(this.extcredits7.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits7 = float.Parse(this.extcredits7.Text);
         if (!Utils.IsNumeric(this.extcredits8.Text.Replace("-", "")))
         {
             base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>");
             return;
         }
         this.userInfo.ExtCredits8 = float.Parse(this.extcredits8.Text);
         this.userInfo.Credits     = CreditsFacade.GetUserCreditsByUserInfo(this.userInfo);
         //if (UserGroups.IsCreditUserGroup(this.userInfo.GroupID))
         if (userInfo.Group.IsCreditUserGroup)
         {
             var g = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits);
             this.userInfo.GroupID = g.ID;
             userInfo.Group        = g;
         }
         var uf = userInfo.Field;
         uf.Website      = this.website.Text;
         uf.Icq          = this.icq.Text;
         uf.qq           = this.qq.Text;
         uf.Yahoo        = this.yahoo.Text;
         uf.Msn          = this.msn.Text;
         uf.Skype        = this.skype.Text;
         uf.Location     = this.location.Text;
         uf.Customstatus = this.customstatus.Text;
         uf.Bio          = this.bio.Text;
         if (this.signature.Text.Length > userInfo.Group.MaxSigSize)
         {
             text = "更新的签名长度超过 " + userInfo.Group.MaxSigSize + " 字符的限制,未能更新。";
         }
         else
         {
             uf.Signature = this.signature.Text;
             PostpramsInfo postpramsInfo = new PostpramsInfo();
             postpramsInfo.Showimages = userInfo.Group.AllowSigimgCode ? 1 : 0;
             postpramsInfo.Sdetail    = this.signature.Text;
             uf.Sightml = UBB.UBBToHTML(postpramsInfo);
         }
         uf.RealName = this.realname.Text;
         uf.Idcard   = this.idcard.Text;
         uf.Mobile   = this.mobile.Text;
         uf.Phone    = this.phone.Text;
         uf.Medals   = Request["medalid"];
         if (this.IsEditUserName.Checked && this.userName.Text != this.ViewState["username"].ToString())
         {
             throw new NotImplementedException("UserNameChange");
             //AdminUsers.UserNameChange(this.userInfo, this.ViewState["username"].ToString());
             Sync.RenameUser(this.userInfo.ID, this.ViewState["username"].ToString(), this.userInfo.Name, "");
         }
         if (userInfo.Save() > 0)
         {
             OnlineUsers.DeleteUserByUid(this.userInfo.ID);
             if (this.ViewState["GroupID"].ToString() != this.userInfo.GroupID.ToString())
             {
                 if (this.userInfo.GroupID == 4)
                 {
                     if (AlbumPluginProvider.GetInstance() != null)
                     {
                         AlbumPluginProvider.GetInstance().Ban(this.userInfo.ID);
                     }
                     if (SpacePluginProvider.GetInstance() != null)
                     {
                         SpacePluginProvider.GetInstance().Ban(this.userInfo.ID);
                     }
                 }
                 else
                 {
                     if (AlbumPluginProvider.GetInstance() != null)
                     {
                         AlbumPluginProvider.GetInstance().UnBan(this.userInfo.ID);
                     }
                     if (SpacePluginProvider.GetInstance() != null)
                     {
                         SpacePluginProvider.GetInstance().UnBan(this.userInfo.ID);
                     }
                 }
             }
             if (this.delavart.Checked)
             {
                 Avatars.DeleteAvatar(this.userInfo.ID.ToString());
             }
             AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + this.userName.Text);
             if (text == "")
             {
                 base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
                 return;
             }
             base.RegisterStartupScript("PAGE", "alert('" + text + "');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';");
             return;
         }
         else
         {
             base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + Request["condition"] + "';</script>");
         }
     }
 }
コード例 #13
0
ファイル: ajaxpostinfo.cs プロジェクト: xiongeee/BBX
        public void GetPostInfo(Post pi)
        {
            if (pi != null)
            {
                this.isexist = true;
                var ppi = new PostpramsInfo();
                ppi.Fid                    = pi.Fid;
                ppi.Tid                    = pi.Tid;
                ppi.Pid                    = pi.ID;
                ppi.Jammer                 = 0;
                ppi.Attachimgpost          = this.config.Attachimgpost;
                ppi.Showattachmentpath     = 1;
                ppi.Showimages             = 1;
                ppi.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
                ppi.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
                ppi.Smiliesmax             = this.config.Smiliesmax;
                ppi.Bbcodemode             = this.config.Bbcodemode;
                ppi.Smileyoff              = pi.SmileyOff;
                ppi.BBCode                 = pi.BBCodeOff == 0;
                ppi.Parseurloff            = pi.ParseUrlOff;
                ppi.Allowhtml              = pi.HtmlOn;
                ppi.Sdetail                = pi.Message;
                this.message               = pi.Message;
                if (ppi.Jammer == 1)
                {
                    this.message = ForumUtils.AddJammer(this.message);
                }

                ppi.Sdetail = this.message;
                if (!ppi.Ubbmode)
                {
                    this.message = UBB.UBBToHTML(ppi);
                }
                else
                {
                    this.message = Utils.HtmlEncode(this.message);
                }

                if (pi.Attachment == 1 || new Regex("\\[attach\\](\\d+?)\\[\\/attach\\]", RegexOptions.IgnoreCase).IsMatch(this.message))
                {
                    var list = Attachment.FindAllByPid(pi.ID);
                    //list.Columns.Add("attachimgpost", typeof(Int16));
                    foreach (var att in list)
                    {
                        if (this.message.IndexOf("[attach]" + att.ID + "[/attach]") != -1)
                        {
                            string text;
                            if (att.FileSize > 1024)
                            {
                                text = Math.Round((Double)att.FileSize / 1024, 2) + " K";
                            }
                            else
                            {
                                text = att.FileSize + " B";
                            }

                            string newValue;
                            if (att.ImgPost)
                            {
                                att["attachimgpost"] = 1;
                                if (ppi.Showattachmentpath == 1)
                                {
                                    newValue = "<img src=\"../../upload/" + att.FileName + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                                else
                                {
                                    newValue = "<img src=\"../../attachment.aspx?attachmentid=" + att.ID + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                }
                            }
                            else
                            {
                                att["attachimgpost"] = 0;
                                newValue             = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + att["aid"].ToString() + "\" target=\"_blank\">" + att["attachment"].ToString().Trim() + "</a> (" + att["postdatetime"].ToString() + ", " + text + ")<br />该附件被下载次数 " + att["downloads"].ToString() + "</p>";
                            }
                            this.message = this.message.Replace("[attach]" + att.ID + "[/attach]", newValue);
                        }
                    }
                    //list.Dispose();
                }
                this.title = Utils.RemoveHtml(pi.Title);
            }
        }
コード例 #14
0
        /// <summary>
        /// 获取帖子信息
        /// </summary>
        /// <param name="dt"></param>
        public void GetPostInfo(DataTable dt)
        {
            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    isexist = true;
                    PostpramsInfo postPramsInfo = new PostpramsInfo();
                    postPramsInfo.Fid                    = Convert.ToInt32(dt.Rows[0]["fid"].ToString());
                    postPramsInfo.Tid                    = Convert.ToInt32(dt.Rows[0]["tid"].ToString());
                    postPramsInfo.Pid                    = Convert.ToInt32(dt.Rows[0]["pid"].ToString());
                    postPramsInfo.Jammer                 = 1;
                    postPramsInfo.Attachimgpost          = config.Attachimgpost;
                    postPramsInfo.Showattachmentpath     = 1;
                    postPramsInfo.Showimages             = 1;
                    postPramsInfo.Smiliesinfo            = Discuz.Forum.Smilies.GetSmiliesListWithInfo();
                    postPramsInfo.Customeditorbuttoninfo = Discuz.Forum.Editors.GetCustomEditButtonListWithInfo();
                    postPramsInfo.Smiliesmax             = config.Smiliesmax;
                    postPramsInfo.Bbcodemode             = config.Bbcodemode;

                    postPramsInfo.Smileyoff   = Utils.StrToInt(dt.Rows[0]["smileyoff"], 0);
                    postPramsInfo.Bbcodeoff   = Utils.StrToInt(dt.Rows[0]["bbcodeoff"], 0);
                    postPramsInfo.Parseurloff = Utils.StrToInt(dt.Rows[0]["parseurloff"], 0);
                    postPramsInfo.Allowhtml   = Utils.StrToInt(dt.Rows[0]["htmlon"], 0);
                    postPramsInfo.Sdetail     = dt.Rows[0]["message"].ToString();

                    message = dt.Rows[0]["message"].ToString();

                    //是不是加干扰码
                    if (postPramsInfo.Jammer == 1)
                    {
                        message = ForumUtils.AddJammer(message);
                    }

                    postPramsInfo.Sdetail = message;

                    if (!postPramsInfo.Ubbmode)
                    {
                        message = UBB.UBBToHTML(postPramsInfo);
                    }
                    else
                    {
                        message = Utils.HtmlEncode(message);
                    }

                    #region 附件

                    // 处理上传图片图文混排问题
                    if (dt.Rows[0]["attachment"].ToString().Equals("1") || new Regex(@"\[attach\](\d+?)\[\/attach\]", RegexOptions.IgnoreCase).IsMatch(message))
                    {
                        DataTable dtAttachment = Attachments.GetAttachmentListByPid(Utils.StrToInt(dt.Rows[0]["pid"], 0));
                        dtAttachment.Columns.Add("attachimgpost", Type.GetType("System.Int16"));

                        string replacement = "";
                        string filesize    = "";

                        foreach (DataRow drAt in dtAttachment.Rows)
                        {
                            if (message.IndexOf("[attach]" + drAt["aid"].ToString() + "[/attach]") != -1)
                            {
                                if (Convert.ToInt64(drAt["filesize"]) > 1024)
                                {
                                    filesize = Convert.ToString(Math.Round(Convert.ToDecimal(drAt["filesize"]) / 1024, 2)) + " K";
                                }
                                else
                                {
                                    filesize = drAt["filesize"].ToString() + " B";
                                }

                                if (Utils.IsImgFilename(drAt["attachment"].ToString().Trim()))
                                {
                                    drAt["attachimgpost"] = 1;

                                    if (postPramsInfo.Showattachmentpath == 1)
                                    {
                                        replacement = "<img src=\"../../upload/" + drAt["filename"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                    else
                                    {
                                        replacement = "<img src=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" onload=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.alt='点击在新窗口浏览图片 CTRL+鼠标滚轮可放大/缩小';}\" onmouseover=\"if(this.width>screen.width*0.7) {this.resized=true; this.width=screen.width*0.7; this.style.cursor='hand'; this.alt='点击在新窗口浏览图片 CTRL+Mouse 滚轮可放大/缩小';}\" onclick=\"if(!this.resized) { return true; } else { window.open(this.src); }\" onmousewheel=\"return imgzoom(this);\" />";
                                    }
                                }
                                else
                                {
                                    drAt["attachimgpost"] = 0;
                                    replacement           = "<p><img alt=\"\" src=\"../../images/attachicons/attachment.gif\" border=\"0\" /><span class=\"bold\">附件</span>: <a href=\"../../attachment.aspx?attachmentid=" + drAt["aid"].ToString() + "\" target=\"_blank\">" + drAt["attachment"].ToString().Trim() + "</a> (" + drAt["postdatetime"].ToString() + ", " + filesize + ")<br />该附件被下载次数 " + drAt["downloads"].ToString() + "</p>";
                                }

                                message = message.Replace("[attach]" + drAt["aid"].ToString() + "[/attach]", replacement);
                            }
                        }
                        dtAttachment.Dispose();
                    }

                    #endregion

                    title = Utils.RemoveHtml(dt.Rows[0]["title"].ToString().Trim());
                }
            }
        }
コード例 #15
0
        /// <summary>创建用户信息</summary>
        private static UserInfo CreateUser(GeneralConfigInfo config, IPKSPrincipal principal, bool isAdmin)
        {
            var tmpUsername = principal.Identity.Name;
            // 如果找不到0积分的用户组则用户自动成为待验证用户
            UserInfo userinfo = new UserInfo();

            userinfo.Username      = tmpUsername;
            userinfo.Nickname      = tmpUsername;
            userinfo.Password      = Guid.NewGuid().ToString();
            userinfo.Secques       = "";
            userinfo.Gender        = 0;
            userinfo.Adminid       = isAdmin ? 1 : 0;
            userinfo.Groupexpiry   = 0;
            userinfo.Extgroupids   = "";
            userinfo.Regip         = DNTRequest.GetIP();
            userinfo.Joindate      = Discuz.Common.Utils.GetDateTime();
            userinfo.Lastip        = userinfo.Regip;
            userinfo.Lastvisit     = userinfo.Joindate;
            userinfo.Lastactivity  = userinfo.Joindate;
            userinfo.Lastpost      = userinfo.Joindate;
            userinfo.Lastpostid    = 0;
            userinfo.Lastposttitle = "";
            userinfo.Posts         = 0;
            userinfo.Digestposts   = 0;
            userinfo.Oltime        = 0;
            userinfo.Pageviews     = 0;
            userinfo.Credits       = 0;
            userinfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userinfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userinfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userinfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userinfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userinfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userinfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userinfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;
            //userinfo.Avatarshowid = 0;
            userinfo.Email      = principal.Identity.Email ?? "";
            userinfo.Bday       = "";
            userinfo.Sigstatus  = 1;
            userinfo.Tpp        = 0;
            userinfo.Ppp        = 0;
            userinfo.Templateid = 0;
            userinfo.Pmsound    = 0;
            userinfo.Showemail  = 0;
            userinfo.Salt       = "";

            int receivepmsetting = 3;//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            //foreach (string rpms in DNTRequest.GetString("receivesetting").Split(','))
            //{
            //    if (!Utils.StrIsNullOrEmpty(rpms))
            //        receivepmsetting = receivepmsetting | int.Parse(rpms);
            //}

            //if (config.Regadvance == 0)
            //    receivepmsetting = 7;

            userinfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userinfo.Invisible    = 0;
            userinfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userinfo.Medals       = "";
            userinfo.Accessmasks  = 0;
            userinfo.Website      = "";
            userinfo.Icq          = "";
            userinfo.Qq           = "";
            userinfo.Yahoo        = "";
            userinfo.Msn          = "";
            userinfo.Skype        = "";
            userinfo.Location     = "";
            userinfo.Customstatus = "";
            //userinfo.Avatar = @"avatars\common\0.gif";
            //userinfo.Avatarwidth = 0;
            //userinfo.Avatarheight = 0;
            userinfo.Bio       = "";
            userinfo.Signature = "";

            var usergroupid   = isAdmin ? 1 : 7;
            var usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userinfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userinfo.Sightml = UBB.UBBToHTML(postpramsinfo);

            userinfo.Authtime = userinfo.Joindate;

            if (isAdmin)
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = usergroupid;
            }
            //邮箱激活链接验证
            else if (config.Regverify == 1)
            {
                userinfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userinfo.Authflag = 1;
                userinfo.Groupid  = 8;
                //SendEmail(tmpUsername, DNTRequest.GetString("password").Trim(), DNTRequest.GetString(config.Antispamregisteremail).Trim(), userinfo.Authstr);
                //Emails.DiscuzSmtpMail(tmpUsername, emailaddress, password, authstr);
            }
            //系统管理员进行后台验证
            else if (config.Regverify == 2)
            {
                userinfo.Authstr  = "";
                userinfo.Groupid  = 8;
                userinfo.Authflag = 1;
            }
            else
            {
                userinfo.Authstr  = "";
                userinfo.Authflag = 0;
                userinfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userinfo.Realname = "";
            userinfo.Idcard   = "";
            userinfo.Mobile   = "";
            userinfo.Phone    = principal.Identity.PhoneNumber;

            //第三方加密验证模式
            if (config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userinfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userinfo);
            }
            else
            {
                userinfo.Password = Discuz.Common.Utils.MD5(userinfo.Password);
                userinfo.Uid      = Users.CreateUser(userinfo);
            }
            return(userinfo);
        }
コード例 #16
0
        /// <summary>
        /// 创建新用户
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="email"></param>
        /// <param name="birthday"></param>
        /// <returns></returns>
        private UserInfo CreateUser(string userName, string email, string birthday)
        {
            UserInfo userInfo = new UserInfo();

            userInfo.Username      = userName;
            userInfo.Email         = email;
            userInfo.Bday          = birthday;
            userInfo.Nickname      = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
            userInfo.Password      = Utils.MD5(ForumUtils.CreateAuthStr(16));
            userInfo.Secques       = "";
            userInfo.Gender        = DNTRequest.GetInt("gender", 0);
            userInfo.Adminid       = 0;
            userInfo.Groupexpiry   = 0;
            userInfo.Extgroupids   = "";
            userInfo.Regip         = userInfo.Lastip = DNTRequest.GetIP();
            userInfo.Joindate      = userInfo.Lastvisit = userInfo.Lastactivity = userInfo.Lastpost = Utils.GetDateTime();
            userInfo.Lastpostid    = 0;
            userInfo.Lastposttitle = "";
            userInfo.Posts         = 0;
            userInfo.Digestposts   = 0;
            userInfo.Oltime        = 0;
            userInfo.Pageviews     = 0;
            userInfo.Credits       = 0;
            userInfo.Extcredits1   = Scoresets.GetScoreSet(1).Init;
            userInfo.Extcredits2   = Scoresets.GetScoreSet(2).Init;
            userInfo.Extcredits3   = Scoresets.GetScoreSet(3).Init;
            userInfo.Extcredits4   = Scoresets.GetScoreSet(4).Init;
            userInfo.Extcredits5   = Scoresets.GetScoreSet(5).Init;
            userInfo.Extcredits6   = Scoresets.GetScoreSet(6).Init;
            userInfo.Extcredits7   = Scoresets.GetScoreSet(7).Init;
            userInfo.Extcredits8   = Scoresets.GetScoreSet(8).Init;

            userInfo.Sigstatus  = DNTRequest.GetInt("sigstatus", 1) != 0 ? 1 : 0;
            userInfo.Tpp        = DNTRequest.GetInt("tpp", 0);
            userInfo.Ppp        = DNTRequest.GetInt("ppp", 0);
            userInfo.Templateid = DNTRequest.GetInt("templateid", 0);
            userInfo.Pmsound    = DNTRequest.GetInt("pmsound", 0);
            userInfo.Showemail  = DNTRequest.GetInt("showemail", 0);
            userInfo.Salt       = "";

            int receivepmsetting = config.Regadvance == 0 ? 3 : DNTRequest.GetInt("receivesetting", 3);//关于短信息枚举值的设置看ReceivePMSettingType类型注释,此处不禁止用户接受系统短信息

            userInfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userInfo.Invisible    = DNTRequest.GetInt("invisible", 0);
            userInfo.Newpm        = config.Welcomemsg == 1 ? 1 : 0;
            userInfo.Medals       = "";
            userInfo.Accessmasks  = DNTRequest.GetInt("accessmasks", 0);
            userInfo.Website      = DNTRequest.GetHtmlEncodeString("website");
            userInfo.Icq          = DNTRequest.GetHtmlEncodeString("icq");
            userInfo.Qq           = DNTRequest.GetHtmlEncodeString("qq");
            userInfo.Yahoo        = DNTRequest.GetHtmlEncodeString("yahoo");
            userInfo.Msn          = DNTRequest.GetHtmlEncodeString("msn");
            userInfo.Skype        = DNTRequest.GetHtmlEncodeString("skype");
            userInfo.Location     = DNTRequest.GetHtmlEncodeString("location");
            userInfo.Customstatus = (usergroupinfo.Allowcstatus == 1) ? DNTRequest.GetHtmlEncodeString("customstatus") : "";
            userInfo.Bio          = ForumUtils.BanWordFilter(DNTRequest.GetString("bio"));
            userInfo.Signature    = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("signature")));

            PostpramsInfo postpramsinfo = new PostpramsInfo();

            postpramsinfo.Usergroupid        = usergroupid;
            postpramsinfo.Attachimgpost      = config.Attachimgpost;
            postpramsinfo.Showattachmentpath = config.Showattachmentpath;
            postpramsinfo.Hide                   = 0;
            postpramsinfo.Price                  = 0;
            postpramsinfo.Sdetail                = userInfo.Signature;
            postpramsinfo.Smileyoff              = 1;
            postpramsinfo.Bbcodeoff              = 1 - usergroupinfo.Allowsigbbcode;
            postpramsinfo.Parseurloff            = 1;
            postpramsinfo.Showimages             = usergroupinfo.Allowsigimgcode;
            postpramsinfo.Allowhtml              = 0;
            postpramsinfo.Smiliesinfo            = Smilies.GetSmiliesListWithInfo();
            postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo();
            postpramsinfo.Smiliesmax             = config.Smiliesmax;
            userInfo.Sightml  = UBB.UBBToHTML(postpramsinfo);
            userInfo.Authtime = Utils.GetDateTime();
            userInfo.Realname = DNTRequest.GetString("realname");
            userInfo.Idcard   = DNTRequest.GetString("idcard");
            userInfo.Mobile   = DNTRequest.GetString("mobile");
            userInfo.Phone    = DNTRequest.GetString("phone");

            //系统管理员进行后台验证
            if (config.Regverify == 2)
            {
                userInfo.Authstr  = DNTRequest.GetString("website");
                userInfo.Groupid  = 8;
                userInfo.Authflag = 1;
            }
            else
            {
                userInfo.Authstr  = "";
                userInfo.Authflag = 0;
                userInfo.Groupid  = CreditsFacade.GetCreditsUserGroupId(0).Groupid;
            }
            userInfo.Uid = Users.CreateUser(userInfo);
            return(userInfo);
        }