Пример #1
0
        /// <summary>创建用户</summary>
        public static UserInfo CreateUser(this HttpContextBase context, GeneralConfigInfo config, IPKSPrincipal principal, bool isAdmin)
        {
            var userInfo = CreateUser(config, principal, isAdmin);

            #region 发送欢迎信息
            if (config.Welcomemsg == 1)
            {
                // 收件箱
                PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                privatemessageinfo.Message      = config.Welcomemsgtxt;
                privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                privatemessageinfo.Msgto        = userInfo.Username;
                privatemessageinfo.Msgtoid      = userInfo.Uid;
                privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                privatemessageinfo.Msgfromid    = 0;
                privatemessageinfo.New          = 1;
                privatemessageinfo.Postdatetime = userInfo.Joindate;
                privatemessageinfo.Folder       = 0;
                PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            }
            #endregion
            //发送同步数据给应用程序
            Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, "");
            //SetUrl("index.aspx");
            //SetShowBackLink(false);
            //SetMetaRefresh(config.Regverify == 0 ? 2 : 5);
            Statistics.ReSetStatisticsCache();
            //if (inviteCode != null)
            //{
            //    Invitation.UpdateInviteCodeSuccessCount(inviteCode.InviteId);
            //    if (config.Regstatus == 3)
            //    {
            //        if (inviteCode.SuccessCount + 1 >= inviteCode.MaxCount)
            //            Invitation.DeleteInviteCode(inviteCode.InviteId);
            //    }
            //}
            var oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            if (config.Regverify == 0)
            {
                UserCredits.UpdateUserCredits(userInfo.Uid);
                //ForumUtils.WriteUserCookie(user, -1, config.Passwordkey);
                OnlineUsers.UpdateAction(oluserinfo.Olid, UserAction.Register.ActionID, 0, config.Onlinetimeout);
                //MsgForward("register_succeed");
                //AddMsgLine("注册成功, 返回登录页");
            }
            else
            {
                if (config.Regverify == 1)
                {
                    //AddMsgLine("注册成功, 请您到您的邮箱中点击激活链接来激活您的帐号");
                }
                else if (config.Regverify == 2)
                {
                    //AddMsgLine("注册成功, 但需要系统管理员审核您的帐户后才可登录使用");
                }
            }
            //ManyouApplications.AddUserLog(userInfo.Uid, UserLogActionEnum.Add);
            return(userInfo);
        }
Пример #2
0
        /// <summary>
        /// 创建短消息
        /// </summary>
        /// <param name="folder">所属文件夹(0:收件箱,1:发件箱,2:草稿箱)</param>
        /// <param name="saveToSendBox">是否保存到发件箱</param>
        /// <param name="url">跳转链接</param>
        /// <param name="msg">提示信息</param>
        private void CreatePM(int folder, int saveToSendBox, string url, string msg)
        {
            if (folder != 2)
            {
                UserInfo touser = Users.GetUserInfo(msgtoid);
                // 检查接收人的短消息是否已超过接收人用户组的上限,管理组不受接收人短消息上限限制
                int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid;
                if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >= UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum)
                {
                    AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
                    return;
                }
                if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7"))
                {
                    AddErrLine("抱歉,接收人拒绝接收短消息");
                    return;
                }
            }

            // 检查发送人的短消息是否已超过发送人用户组的上限
            if (url != "usercpinbox.aspx" && PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum)
            {
                AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱");
                return;
            }
            pm.Folder = folder;
            if (CreditsFacade.SendPM(userid) == -1)
            {
                AddErrLine("您的积分不足, 不能发送短消息");
                return;
            }
            pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, saveToSendBox);
            //发送邮件通知
            if (DNTRequest.GetString("emailnotify") == "on")
            {
                SendNotifyEmail(Users.GetUserInfo(msgtoid).Email.Trim(), pm);
            }

            SetUrl(url);
            SetMetaRefresh();
            SetShowBackLink(true);
            MsgForward("usercppostpm_succeed");
            AddMsgLine(msg);
        }
        private void AddNewRec_Click(object sender, EventArgs e)
        {
            #region 添加公共消息

            if (subject.Text == "")
            {
                base.RegisterStartupScript("", GetMessageScript("公共消息标题不能为空"));
                return;
            }
            if (message.Text == "")
            {
                base.RegisterStartupScript("", GetMessageScript("公共消息内容不能为空"));
                return;
            }

            try
            {
                PrivateMessageInfo pm = new PrivateMessageInfo();
                pm.Message      = message.Text;
                pm.Subject      = subject.Text;
                pm.Msgto        = "";
                pm.Msgtoid      = 0;
                pm.Msgfrom      = "";
                pm.Msgfromid    = 0;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString();
                PrivateMessages.CreatePrivateMessage(pm, 0);
                BindData();
                DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncePrivateMessageCount");
                base.RegisterStartupScript("PAGE", "window.location.href='global_announceprivatemessage.aspx';");
                return;
            }
            catch
            {
                base.RegisterStartupScript("", GetMessageScript("无法更新数据库."));
                return;
            }

            #endregion
        }
Пример #4
0
        protected override void ShowPage()
        {
            pagetitle = "用户注册";

            if (userid != -1)
            {
                SetUrl(BaseConfigs.GetForumPath);
                SetMetaRefresh();
                SetShowBackLink(false);
                AddMsgLine("不能重复注册用户");
                ispost     = true;
                createuser = "******";
                agree      = "yes";
                return;
            }


            if (config.Regstatus < 1)
            {
                AddErrLine("论坛当前禁止新用户注册");
                return;
            }

            allowinvite = Utils.InArray(config.Regstatus.ToString(), "2,3");

            #region 用户IP判断
            string msg = Users.CheckRegisterDateDiff(DNTRequest.GetIP());
            if (msg != null)
            {
                AddErrLine(msg);
                return;
            }
            //if (config.Regctrl > 0)
            //{
            //    ShortUserInfo userinfo = Users.GetShortUserInfoByIP(DNTRequest.GetIP());
            //    if (userinfo != null)
            //    {
            //        int Interval = Utils.StrDateDiffHours(userinfo.Joindate, config.Regctrl);
            //        if (Interval <= 0)
            //        {
            //            AddErrLine("抱歉, 系统设置了IP注册间隔限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册");
            //            return;
            //        }
            //    }
            //}

            //if (config.Ipregctrl.Trim() != "")
            //{
            //    string[] regctrl = Utils.SplitString(config.Ipregctrl, "\n");
            //    if (Utils.InIPArray(DNTRequest.GetIP(), regctrl))
            //    {
            //        ShortUserInfo userinfo = Users.GetShortUserInfoByIP(DNTRequest.GetIP());
            //        if (userinfo != null)
            //        {
            //            int Interval = Utils.StrDateDiffHours(userinfo.Joindate, 72);
            //            if (Interval < 0)
            //            {
            //                AddErrLine("抱歉, 系统设置了特殊IP注册限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册");
            //                return;
            //            }
            //        }
            //    }
            //}
            #endregion

            //如果提交了用户注册信息...
            if (!Utils.StrIsNullOrEmpty(createuser) && ispost)
            {
                SetShowBackLink(true);
                InviteCodeInfo inviteCode = null;
                if (allowinvite)
                {
                    if (config.Regstatus == 3 && invitecode == "")
                    {
                        AddErrLine("邀请码不能为空!");
                        return;
                    }
                    if (invitecode != "")
                    {
                        inviteCode = Invitation.GetInviteCodeByCode(invitecode.ToUpper());
                        if (!Invitation.CheckInviteCode(inviteCode))
                        {
                            AddErrLine("邀请码不合法或已过期!");
                            return;
                        }
                    }
                }

                string tmpUserName = DNTRequest.GetString(config.Antispamregisterusername);
                string email       = DNTRequest.GetString(config.Antispamregisteremail).Trim().ToLower();
                string tmpBday     = DNTRequest.GetString("bday").Trim();

                if (tmpBday == "")
                {
                    tmpBday = string.Format("{0}-{1}-{2}", DNTRequest.GetString("bday_y").Trim(),
                                            DNTRequest.GetString("bday_m").Trim(), DNTRequest.GetString("bday_d").Trim());
                }
                tmpBday = (tmpBday == "--" ? "" : tmpBday);

                ValidateUserInfo(tmpUserName, email, tmpBday);

                if (IsErr())
                {
                    return;
                }

                //如果用户名符合注册规则, 则判断是否已存在
                if (Users.GetUserId(tmpUserName) > 0)
                {
                    AddErrLine("请不要重复提交!");
                    return;
                }

                UserInfo userInfo = CreateUser(tmpUserName, email, tmpBday);

                #region 发送欢迎信息
                if (config.Welcomemsg == 1)
                {
                    // 收件箱
                    PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                    privatemessageinfo.Message      = config.Welcomemsgtxt;
                    privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                    privatemessageinfo.Msgto        = userInfo.Username;
                    privatemessageinfo.Msgtoid      = userInfo.Uid;
                    privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                    privatemessageinfo.Msgfromid    = 0;
                    privatemessageinfo.New          = 1;
                    privatemessageinfo.Postdatetime = Utils.GetDateTime();
                    privatemessageinfo.Folder       = 0;
                    PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
                }
                #endregion

                //发送同步数据给应用程序
                Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, "");



                SetUrl("index.aspx");
                SetShowBackLink(false);
                SetMetaRefresh(config.Regverify == 0 ? 2 : 5);
                Statistics.ReSetStatisticsCache();

                if (inviteCode != null)
                {
                    Invitation.UpdateInviteCodeSuccessCount(inviteCode.InviteId);
                    if (config.Regstatus == 3)
                    {
                        if (inviteCode.SuccessCount + 1 >= inviteCode.MaxCount)
                        {
                            Invitation.DeleteInviteCode(inviteCode.InviteId);
                        }
                    }
                }

                if (config.Regverify == 0)
                {
                    UserCredits.UpdateUserCredits(userInfo.Uid);
                    ForumUtils.WriteUserCookie(userInfo, -1, config.Passwordkey);
                    OnlineUsers.UpdateAction(olid, UserAction.Register.ActionID, 0, config.Onlinetimeout);
                    MsgForward("register_succeed");
                    AddMsgLine("注册成功, 返回登录页");
                }
                else
                {
                    if (config.Regverify == 1)
                    {
                        AddMsgLine("注册成功, 请您到您的邮箱中点击激活链接来激活您的帐号");
                    }
                    else if (config.Regverify == 2)
                    {
                        AddMsgLine("注册成功, 但需要系统管理员审核您的帐户后才可登录使用");
                    }
                }
                //ManyouApplications.AddUserLog(userInfo.Uid, UserLogActionEnum.Add);
                agree = "yes";
            }
        }
Пример #5
0
        protected override void ShowPage()
        {
            pagetitle = "撰写短消息";

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

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

            if (!CheckPermission())
            {
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (!CheckPermissionAfterPost())
                {
                    return;
                }

                #region 创建并发送短消息

                PrivateMessageInfo pm = new PrivateMessageInfo();

                string curdatetime = Utils.GetDateTime();
                // 收件箱
                if (useradminid == 1)
                {
                    pm.Message = Utils.HtmlEncode(DNTRequest.GetString("message"));
                    pm.Subject = Utils.HtmlEncode(DNTRequest.GetString("subject"));
                }
                else
                {
                    pm.Message =
                        Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("message")));
                    pm.Subject =
                        Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("subject")));
                }

                if (ForumUtils.HasBannedWord(pm.Message) || ForumUtils.HasBannedWord(pm.Subject))
                {
                    //HasBannedWord 指定的字符串中是否含有禁止词汇

                    AddErrLine("对不起, 您提交的内容包含不良信息, 因此无法提交, 请返回修改!");
                    return;
                }


                if (ForumUtils.HasAuditWord(pm.Message) || ForumUtils.HasAuditWord(pm.Subject))
                {
                    AddErrLine("对不起, 您提交的内容包含不良信息, 因此无法提交, 请返回修改!");
                    return;
                }

                pm.Message = ForumUtils.BanWordFilter(pm.Message);
                pm.Subject = ForumUtils.BanWordFilter(pm.Subject);

                pm.Msgto        = DNTRequest.GetString("msgto");
                pm.Msgtoid      = msgtoid;
                pm.Msgfrom      = username;
                pm.Msgfromid    = userid;
                pm.New          = 1;
                pm.Postdatetime = curdatetime;


                if (!DNTRequest.GetString("savetousercpdraftbox").Equals(""))
                {
                    // 检查发送人的短消息是否已超过发送人用户组的上限
                    if (PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum)
                    {
                        AddErrLine("抱歉,您的短消息已达到上限,无法保存到草稿箱");
                        return;
                    }
                    // 只将消息保存到草稿箱
                    pm.Folder = 2;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 0);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(Discuz.Forum.Users.GetUserInfo(msgtoid).Email.Trim(), pm);
                    }

                    SetUrl("usercpdraftbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("已将消息保存到草稿箱");
                }
                else if (!DNTRequest.GetString("savetosentbox").Equals(""))
                {
                    // 检查接收人的短消息是否已超过接收人用户组的上限
                    UserInfo touser = Discuz.Forum.Users.GetUserInfo(msgtoid);
                    //管理组不受接收人短消息上限限制
                    int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid;
                    if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >=
                        UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum)
                    {
                        AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
                        return;
                    }

                    if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7"))
                    {
                        AddErrLine("抱歉,接收人拒绝接收短消息");
                        return;
                    }
                    // 检查发送人的短消息是否已超过发送人用户组的上限
                    if (PrivateMessages.GetPrivateMessageCount(userid, -1) >= usergroupinfo.Maxpmnum)
                    {
                        AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱");
                        return;
                    }
                    // 发送消息且保存到发件箱
                    pm.Folder = 0;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 1);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(touser.Email.Trim(), pm);
                    }

                    // 更新在线表中的用户最后发帖时间
                    OnlineUsers.UpdatePostPMTime(olid);

                    SetUrl("usercpsentbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("发送完毕, 且已将消息保存到发件箱");
                }
                else
                {
                    UserInfo touser = Discuz.Forum.Users.GetUserInfo(msgtoid);
                    // 检查接收人的短消息是否已超过接收人用户组的上限,管理组不受接收人短消息上限限制
                    int radminId = UserGroups.GetUserGroupInfo(usergroupid).Radminid;
                    if (!(radminId > 0 && radminId <= 3) && PrivateMessages.GetPrivateMessageCount(msgtoid, -1) >=
                        UserGroups.GetUserGroupInfo(touser.Groupid).Maxpmnum)
                    {
                        AddErrLine("抱歉,接收人的短消息已达到上限,无法接收");
                        return;
                    }
                    if (!Utils.InArray(Convert.ToInt32(touser.Newsletter).ToString(), "2,3,6,7"))
                    {
                        AddErrLine("抱歉,接收人拒绝接收短消息");
                        return;
                    }

                    // 发送消息但不保存到发件箱
                    pm.Folder = 0;
                    if (UserCredits.UpdateUserCreditsBySendpms(base.userid) == -1)
                    {
                        AddErrLine("您的金币不足, 不能发送短消息");
                        return;
                    }
                    pm.Pmid = PrivateMessages.CreatePrivateMessage(pm, 0);

                    //发送邮件通知
                    if (DNTRequest.GetString("emailnotify") == "on")
                    {
                        SendNotifyEmail(touser.Email.Trim(), pm);
                    }

                    SetUrl("usercpinbox.aspx");
                    SetMetaRefresh();
                    SetShowBackLink(true);
                    AddMsgLine("发送完毕");
                }

                #endregion
            }

            msgto = Utils.HtmlEncode(DNTRequest.GetString("msgto"));

            msgtoid = DNTRequest.GetInt("msgtoid", 0);
            if (msgtoid > 0)
            {
                msgto = Discuz.Forum.Users.GetUserName(msgtoid).Trim();
            }

            subject = Utils.HtmlEncode(DNTRequest.GetString("subject"));
            message = Utils.HtmlEncode(DNTRequest.GetString("message"));

            string action = DNTRequest.GetQueryString("action").ToLower();
            if (action.CompareTo("re") == 0 || action.CompareTo("fw") == 0) //回复或者转发
            {
                int pmid = DNTRequest.GetQueryInt("pmid", -1);
                if (pmid != -1)
                {
                    PrivateMessageInfo pm = PrivateMessages.GetPrivateMessageInfo(pmid);
                    if (pm != null)
                    {
                        if (pm.Msgtoid == userid || pm.Msgfromid == userid)
                        {
                            if (action.CompareTo("re") == 0)
                            {
                                msgto = Utils.HtmlEncode(pm.Msgfrom);
                            }
                            else
                            {
                                msgto = "";
                            }
                            subject = Utils.HtmlEncode(action) + ":" + pm.Subject;
                            message = Utils.HtmlEncode("> ") + pm.Message.Replace("\n", "\n> ") + "\r\n\r\n";
                        }
                    }
                }
            }
        }
Пример #6
0
        public static void SendMessage(int clubID, string userName, ClubSysMessageType messageType, params string[] para)
        {
            var userID = Users.GetUserId(userName);
            var club   = ClubLogic.GetClubInfo(clubID);

            PrivateMessageInfo pm;

            switch (messageType)
            {
            case ClubSysMessageType.ApplyClub:
                foreach (var aID in ConfigGlobal.PluginAdmin)
                {
                    pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder  = 0;
                    pm.Message = string.Format(ApplyClub_Message, userName, club.FullName);

                    pm.Msgtoid      = Convert.ToInt32(aID);
                    pm.Msgto        = Users.GetUserInfo(aID).Username.Trim();
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = string.Format(ApplyClub_Subject, userName);

                    PrivateMessages.CreatePrivateMessage(pm, 0);
                }
                break;

            case ClubSysMessageType.ApplyJoinClub:
                var users = ClubLogic.GetClubLeads(clubID);
                foreach (var userClub in users)
                {
                    pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder       = 0;
                    pm.Message      = string.Format(ApplyJoinClub_Message, userName, club.FullName);
                    pm.Msgto        = userClub.UserName;
                    pm.Msgtoid      = userClub.Userid.Value;
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = string.Format(ApplyJoinClub_Subject, userName);

                    PrivateMessages.CreatePrivateMessage(pm, 0);
                }
                break;

            case ClubSysMessageType.ApproveClub:
                if (club != null)
                {
                    var result = "通过";
                    if (!club.IsActive.Value)
                    {
                        result = "驳回";
                    }

                    pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder       = 0;
                    pm.Message      = string.Format(ApproveClub_Message, club.FullName, result);
                    pm.Msgto        = club.CreatorUserName;
                    pm.Msgtoid      = club.CreatorUid.Value;
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = ApproveClub_Subject;

                    PrivateMessages.CreatePrivateMessage(pm, 0);
                }
                break;

            case ClubSysMessageType.ApproveJoinClub:
                pm = new PrivateMessageInfo();

                pm.Msgfrom   = ClubSysAdminName;
                pm.Msgfromid = 0;

                pm.Folder       = 0;
                pm.Message      = string.Format(ApproveJoinClub_Message, club.FullName);
                pm.Msgto        = userName;
                pm.Msgtoid      = userID;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = ApproveJoinClub_Subject;

                PrivateMessages.CreatePrivateMessage(pm, 0);
                break;

            case ClubSysMessageType.LeaveClub:
                pm = new PrivateMessageInfo();

                pm.Msgfrom   = ClubSysAdminName;
                pm.Msgfromid = 0;

                pm.Folder       = 0;
                pm.Message      = string.Format(LeaveClub_Message, club.FullName);
                pm.Msgto        = userName;
                pm.Msgtoid      = userID;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = LeaveClub_Subject;

                PrivateMessages.CreatePrivateMessage(pm, 0);

                break;

            case ClubSysMessageType.MandatoryLeaveClub:
                pm = new PrivateMessageInfo();

                pm.Msgfrom   = ClubSysAdminName;
                pm.Msgfromid = 0;

                pm.Folder       = 0;
                pm.Message      = string.Format(MandatoryLeaveClub_Message, club.FullName);
                pm.Msgto        = userName;
                pm.Msgtoid      = userID;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = MandatoryLeaveClub_Subject;

                PrivateMessages.CreatePrivateMessage(pm, 0);

                break;

            case ClubSysMessageType.RejectJoinClub:
                pm = new PrivateMessageInfo();

                pm.Msgfrom   = ClubSysAdminName;
                pm.Msgfromid = 0;

                pm.Folder       = 0;
                pm.Message      = string.Format(RejectJoinClub_Message, club.FullName);
                pm.Msgto        = userName;
                pm.Msgtoid      = userID;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = RejectJoinClub_Subject;

                PrivateMessages.CreatePrivateMessage(pm, 0);

                break;

            case ClubSysMessageType.TransferExtcredit:
                pm = new PrivateMessageInfo();

                pm.Msgfrom   = para[0];
                pm.Msgfromid = Users.GetUserId(para[0]);

                pm.Folder       = 0;
                pm.Message      = string.Format(TransferExtcredit_Message, para[0], para[1], para[2]);
                pm.Msgto        = userName;
                pm.Msgtoid      = userID;
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = string.Format(TransferExtcredit_Subject, club.FullName);

                PrivateMessages.CreatePrivateMessage(pm, 0);

                break;

            default:
                break;
            }
        }
Пример #7
0
        /// <summary>
        /// 注册用户
        /// </summary>
        /// <returns></returns>
        public string Register()
        {
            string returnStr = string.Empty;

            if (Signature != GetParam("sig").ToString())
            {
                ErrorCode = (int)ErrorType.API_EC_SIGNATURE;
                return(returnStr);
            }

            if (CallId <= LastCallId)
            {
                ErrorCode = (int)ErrorType.API_EC_CALLID;
                return(returnStr);
            }

            if (!CheckRequiredParams("user_name,password,email"))
            {
                ErrorCode = (int)ErrorType.API_EC_PARAM;
                return(returnStr);
            }

            if (this.App.ApplicationType == (int)ApplicationType.DESKTOP)//如果是桌面程序则不允许此方法
            {
                if (Uid < 1 || Discuz.Forum.UserGroups.GetUserGroupInfo(Discuz.Forum.Users.GetShortUserInfo(Uid).Groupid).Radminid != 1)
                {
                    ErrorCode = (int)ErrorType.API_EC_PERMISSION_DENIED;
                    return("");
                }
            }
            else if (Uid > 0)//已经登录的用户不能再注册
            {
                ErrorCode = (int)ErrorType.API_EC_USER_ONLINE;
                return(returnStr);
            }

            string username = GetParam("user_name").ToString();
            string password = GetParam("password").ToString();
            string email    = GetParam("email").ToString();

            bool isMD5Passwd = GetParam("password_format") != null && GetParam("password_format").ToString() == "md5" ? true : false;

            //用户名不符合规范
            if (!CheckUsername(username))
            {
                ErrorCode = (int)ErrorType.API_EC_USERNAME_ILLEGAL;
                return(returnStr);
            }

            if (Discuz.Forum.Users.GetUserId(username) != 0)//如果用户名符合注册规则, 则判断是否已存在
            {
                ErrorCode = (int)ErrorType.API_EC_USER_ALREADY_EXIST;
                return(returnStr);
            }

            if (!isMD5Passwd && password.Length < 6)
            {
                ErrorCode = (int)ErrorType.API_EC_PARAM;
                return(returnStr);
            }

            if (!CheckEmail(email))
            {
                ErrorCode = (int)ErrorType.API_EC_EMAIL;
                return(returnStr);
            }

            UserInfo userInfo = new UserInfo();

            userInfo.Username      = username;
            userInfo.Nickname      = string.Empty;
            userInfo.Password      = isMD5Passwd ? password : Utils.MD5(password);
            userInfo.Secques       = string.Empty;
            userInfo.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.Email         = email;
            userInfo.Bday          = string.Empty;
            userInfo.Sigstatus     = 0;

            userInfo.Tpp        = 0;
            userInfo.Ppp        = 0;
            userInfo.Templateid = 0;
            userInfo.Pmsound    = 0;
            userInfo.Showemail  = 0;
            userInfo.Salt       = "0";
            int receivepmsetting = Config.Regadvance == 0 ? 7 : 1;

            userInfo.Newsletter   = (ReceivePMSettingType)receivepmsetting;
            userInfo.Invisible    = 0;
            userInfo.Newpm        = Config.Welcomemsg == 1 ? 1 : 0;
            userInfo.Medals       = "";
            userInfo.Accessmasks  = 0;
            userInfo.Website      = string.Empty;
            userInfo.Icq          = string.Empty;
            userInfo.Qq           = string.Empty;
            userInfo.Yahoo        = string.Empty;
            userInfo.Msn          = string.Empty;
            userInfo.Skype        = string.Empty;
            userInfo.Location     = string.Empty;
            userInfo.Customstatus = string.Empty;
            userInfo.Bio          = string.Empty;
            userInfo.Signature    = string.Empty;
            userInfo.Sightml      = string.Empty;
            userInfo.Authtime     = Utils.GetDateTime();

            //邮箱激活链接验证
            if (Config.Regverify == 1)
            {
                userInfo.Authstr  = ForumUtils.CreateAuthStr(20);
                userInfo.Authflag = 1;
                userInfo.Groupid  = 8;
                Emails.DiscuzSmtpMail(username, email, string.Empty, userInfo.Authstr);
            }
            //系统管理员进行后台验证
            else if (Config.Regverify == 2)
            {
                userInfo.Authstr  = string.Empty;
                userInfo.Groupid  = 8;
                userInfo.Authflag = 1;
            }
            else
            {
                userInfo.Authstr  = "";
                userInfo.Authflag = 0;
                userInfo.Groupid  = UserCredits.GetCreditsUserGroupId(0).Groupid;
            }
            userInfo.Realname = string.Empty;
            userInfo.Idcard   = string.Empty;
            userInfo.Mobile   = string.Empty;
            userInfo.Phone    = string.Empty;

            if (Config.Passwordmode > 1 && PasswordModeProvider.GetInstance() != null)
            {
                userInfo.Uid = PasswordModeProvider.GetInstance().CreateUserInfo(userInfo);
            }
            else
            {
                userInfo.Uid = Discuz.Forum.Users.CreateUser(userInfo);
            }

            if (Config.Welcomemsg == 1)
            {
                PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                // 收件箱
                privatemessageinfo.Message      = Config.Welcomemsgtxt;
                privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                privatemessageinfo.Msgto        = userInfo.Username;
                privatemessageinfo.Msgtoid      = userInfo.Uid;
                privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                privatemessageinfo.Msgfromid    = 0;
                privatemessageinfo.New          = 1;
                privatemessageinfo.Postdatetime = Utils.GetDateTime();
                privatemessageinfo.Folder       = 0;
                PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            }

            Statistics.ReSetStatisticsCache();

            //信息同步通知不会发向当前请求接口的应用程序,所以此处应保留,以支持论坛向其他关联应用程序发送通知
            Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, ApiKey);

            UserCredits.UpdateUserCredits(userInfo.Uid);

            if (Format == FormatType.JSON)
            {
                return(string.Format("\"{0}\"", userInfo.Uid));
            }

            RegisterResponse rr = new RegisterResponse();

            rr.Uid = userInfo.Uid;

            return(SerializationHelper.Serialize(rr));
        }
Пример #8
0
        private void RegisterAndBind()
        {
            if (this.userid > 0)
            {
                base.AddErrLine("当前已有用户登录,无法注册");
                return;
            }
            if (this.config.Regstatus < 1 || this.cloudconfig.Allowconnectregister == 0)
            {
                base.AddErrLine("论坛当前禁止新的QQ会员登录");
                return;
            }
            string @string = DNTRequest.GetString(this.config.Antispamregisterusername);
            string text    = DNTRequest.GetString(this.config.Antispamregisteremail).Trim().ToLower();
            string text2   = DNTRequest.GetString("bday").Trim();
            string errinfo = "";

            if (!Users.PageValidateUserName(@string, out errinfo) || !Users.PageValidateEmail(text, false, out errinfo))
            {
                base.AddErrLine(errinfo);
                return;
            }
            if (!Utils.IsDateString(text2) && !string.IsNullOrEmpty(text2))
            {
                base.AddErrLine("生日格式错误, 如果不想填写生日请置空");
                return;
            }
            if (Users.GetUserId(@string) > 0)
            {
                base.AddErrLine("请不要重复提交!");
                return;
            }
            this.userconnectinfo = DiscuzCloud.GetUserConnectInfo(this.openid);
            if (this.userconnectinfo == null || this.userconnectinfo.Uid > 0)
            {
                base.AddErrLine("Connect信息异常,登录失败,请尝试再次登录");
                return;
            }
            ConnectbindLog userConnectBindLog = DiscuzCloud.GetUserConnectBindLog(this.userconnectinfo.OpenId);

            if (this.cloudconfig.Maxuserbindcount != 0 && userConnectBindLog != null && userConnectBindLog.Type != 1 && userConnectBindLog.BindCount >= this.cloudconfig.Maxuserbindcount)
            {
                base.AddErrLine("当前QQ用户解绑次数过多,无法绑定新注册的用户");
                return;
            }
            User userInfo = this.CreateUser(@string, text, text2);

            this.userconnectinfo.Uid = userInfo.ID;
            DiscuzCloud.UpdateUserConnectInfo(this.userconnectinfo);
            if (userConnectBindLog == null)
            {
                DiscuzCloud.CreateUserConnectBindLog(new ConnectbindLog
                {
                    OpenID    = this.userconnectinfo.OpenId,
                    Uid       = this.userconnectinfo.Uid,
                    Type      = 1,
                    BindCount = 1
                });
            }
            else
            {
                userConnectBindLog.BindCount++;
                userConnectBindLog.Uid  = this.userconnectinfo.Uid;
                userConnectBindLog.Type = 1;
                DiscuzCloud.UpdateUserConnectBindLog(userConnectBindLog);
            }
            if (this.config.Welcomemsg == 1)
            {
                PrivateMessages.CreatePrivateMessage(new PrivateMessageInfo
                {
                    Message      = this.config.Welcomemsgtxt,
                    Subject      = "欢迎您的加入! (请勿回复本信息)",
                    Msgto        = userInfo.Name,
                    Msgtoid      = userInfo.ID,
                    Msgfrom      = "系统",
                    Msgfromid    = 0,
                    New          = 1,
                    Postdatetime = Utils.GetDateTime(),
                    Folder       = 0
                }, 0);
            }
            Sync.UserRegister(userInfo.ID, userInfo.Name, userInfo.Password, "");
            if (this.cloudconfig.Allowuseqzavater == 1 && DNTRequest.GetString("use_qzone_avatar") == "1")
            {
                QZoneAvatar qZoneAvatar = new QZoneAvatar();
                qZoneAvatar.AsyncGetAvatar(this.userconnectinfo);
            }
            base.SetUrl("index.aspx");
            base.SetShowBackLink(false);
            base.SetMetaRefresh((this.config.Regverify != 2) ? 2 : 5);
            Statistics.ReSetStatisticsCache();
            if (this.config.Regverify != 2)
            {
                CreditsFacade.UpdateUserCredits(userInfo.ID);
                ForumUtils.WriteUserCookie(userInfo, -1, this.config.Passwordkey);
                Utils.WriteCookie("bindconnect", "1");
                OnlineUsers.UpdateAction(this.olid, UserAction.Register.ActionID, 0, this.config.Onlinetimeout);
                base.AddMsgLine("QQ登录成功,继续浏览");
            }
            else
            {
                base.AddMsgLine("QQ数据绑定完成, 但需要系统管理员审核您的帐户后才可登录使用");
            }
            this.notifyscript = this.GetNotifyScript(this.userconnectinfo, userInfo.Name, userInfo.Bday, userInfo.Gender, userInfo.Email, userInfo.ShowEmail, DNTRequest.GetInt("useqqavatar", 2), "register");
        }
Пример #9
0
        /*
         * 每个用户UID 30秒内只能调用一次该接口
         */
        public override bool Run(CommandParameter commandParam, ref string result)
        {
            //如果是桌面程序则需要验证用户身份
            if (commandParam.AppInfo.ApplicationType == (int)ApplicationType.DESKTOP && commandParam.LocalUid < 1)
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_SESSIONKEY, commandParam.ParamList);
                return(false);
            }

            if (!commandParam.CheckRequiredParams("subject,message,to_ids"))
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PARAM, commandParam.ParamList);
                return(false);
            }

            string ids = commandParam.GetDNTParam("to_ids").ToString();

            if (!Utils.IsNumericList(ids))
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PARAM, commandParam.ParamList);
                return(false);
            }

            string[] idArray = ids.Split(',');
            if (idArray.Length > 10)
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PM_TOID_OVERFLOW, commandParam.ParamList);
                return(false);
            }
            //桌面应用程序用户强制使用session_info.uid
            int fromId = commandParam.AppInfo.ApplicationType == (int)ApplicationType.DESKTOP ?
                         commandParam.LocalUid : commandParam.GetIntParam("from_id", commandParam.LocalUid);
            ShortUserInfo fromUserInfo = Discuz.Forum.Users.GetShortUserInfo(fromId);

            if (fromUserInfo == null)
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PM_FROMID_NOT_EXIST, commandParam.ParamList);
                return(false);
            }

            //如果发送用户不是管理员,且在30秒内调用了该接口
            if (fromUserInfo.Adminid != 1 && !CommandCacheQueue <SendMessageItem> .EnQueue(new SendMessageItem(fromUserInfo.Uid, DateTime.Now.Ticks)))
            {
                result = Util.CreateErrorMessage(ErrorType.API_EC_PM_VISIT_TOOFAST, commandParam.ParamList);
                return(false);
            }

            string message       = UBB.ParseUrl(Utils.EncodeHtml(commandParam.GetDNTParam("message").ToString()));
            string successfulIds = string.Empty;

            foreach (string id in ids.Split(','))
            {
                int toUid = TypeConverter.StrToInt(id);
                if (toUid < 1 || toUid == fromId)
                {
                    continue;
                }
                ShortUserInfo toUserInfo = Discuz.Forum.Users.GetShortUserInfo(toUid);
                if (toUserInfo == null)
                {
                    continue;
                }

                PrivateMessageInfo pm = new PrivateMessageInfo();
                pm.Folder       = 0;
                pm.Message      = message;
                pm.Msgfrom      = fromUserInfo.Username;
                pm.Msgfromid    = fromId;
                pm.Msgto        = toUserInfo.Username;
                pm.Msgtoid      = TypeConverter.StrToInt(id);
                pm.New          = 1;
                pm.Postdatetime = Utils.GetDateTime();
                pm.Subject      = commandParam.GetDNTParam("subject").ToString();

                successfulIds += (PrivateMessages.CreatePrivateMessage(pm, 0) > 0) ? (id + ",") : "";
            }
            successfulIds = successfulIds.Length > 0 ? successfulIds.Remove(successfulIds.Length - 1) : successfulIds;

            if (commandParam.Format == FormatType.JSON)
            {
                result = string.Format("\"{0}\"", successfulIds);
            }
            else
            {
                MessageSendResponse nsr = new MessageSendResponse();
                nsr.Result = successfulIds;
                result     = SerializationHelper.Serialize(nsr);
            }
            return(true);
        }
Пример #10
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //validate user id and user name
            var awardUserID = int.Parse(tbUserID.Text);
            var sUser       = Users.GetShortUserInfo(awardUserID);

            var awardUserName = tbUserName.Text;

            if (awardUserName == sUser.Username.Trim())
            {
                //process the award
                float cashIncrement = 0;
                float rp            = 0;
                Guid? videoGuid     = null;
                var   AwardNotes    = string.Empty;

                //precheck
                if (tbCash.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbCash.Text.Trim(), out cashIncrement))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidCash", "alert('枪手币格式无法转换!');",
                                                               true);
                        return;
                    }
                }

                if (tbRP.Text.Trim() != string.Empty)
                {
                    if (!float.TryParse(tbRP.Text.Trim(), out rp))
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidRP", "alert('RP格式无法转换!');", true);
                        return;
                    }
                }

                if (tbVideoGuid.Text.Trim() != string.Empty)
                {
                    try
                    {
                        videoGuid = new Guid(tbVideoGuid.Text);
                    }
                    catch
                    {
                        ClientScript.RegisterClientScriptBlock(typeof(string), "invalidGuid", "alert('Guid格式无法转换!');",
                                                               true);
                        return;
                    }
                }
                if (tbNotes.Text.Trim() != string.Empty)
                {
                    AwardNotes = tbNotes.Text;
                }

                //is actually something awarded?
                var realAwarded = false;

                var awardMessageBody = "您获得奖励";

                //add cash
                if (cashIncrement != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 2, cashIncrement);

                    awardMessageBody += $" 枪手币+{cashIncrement}";

                    realAwarded = true;
                }

                //add rp
                if (rp != 0)
                {
                    Users.UpdateUserExtCredits(awardUserID, 4, rp);

                    awardMessageBody += $" RP+{rp}, ";

                    realAwarded = true;
                }

                //add card
                if (!string.IsNullOrEmpty(lstPlayer.SelectedValue) && lstPlayer.SelectedValue != Guid.Empty.ToString())
                {
                    PlayerStrip.AddCard(awardUserID, awardUserName, new Guid(lstPlayer.SelectedValue),
                                        cbCardActive.Checked);

                    awardMessageBody += $" 球星卡一张({(cbCardActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                //add video
                if (videoGuid != null)
                {
                    if (cbVideoActive.Checked)
                    {
                        //active
                        //UserVideo.InsertActiveVideo(awardUserID, awardUserName, videoGuid.Value);

                        var uv = new UserVideo();
                        uv.UserID     = awardUserID;
                        uv.UserName   = awardUserName;
                        uv.VideoGuid  = videoGuid.Value;
                        uv.ActiveDate = DateTime.Now;
                        uv.UserDesc   = string.Empty;
                        uv.IsPublic   = false;

                        uv.Insert();
                    }
                    else
                    {
                        //inactive
                        PlayerStrip.AddCard(awardUserID, awardUserName, null, false);
                    }

                    awardMessageBody += $" 视频卡一张({(cbVideoActive.Checked ? string.Empty : "未")}激活)";

                    realAwarded = true;
                }

                if (!string.IsNullOrEmpty(AwardNotes))
                {
                    awardMessageBody += $" 奖励原因:{AwardNotes}";
                }

                if (realAwarded)
                {
                    PlayerLog.LogHistory(awardUserID, awardUserName, PlayerHistoryType.Award,
                                         new AwardDesc(cashIncrement, rp,
                                                       (!string.IsNullOrEmpty(lstPlayer.SelectedValue) &&
                                                        lstPlayer.SelectedValue != Guid.Empty.ToString()), videoGuid != null).Generate());

                    var pm = new PrivateMessageInfo();

                    pm.Msgfrom   = ClubSysPrivateMessage.ClubSysAdminName;
                    pm.Msgfromid = 0;

                    pm.Folder       = 0;
                    pm.Message      = awardMessageBody;
                    pm.Msgto        = awardUserName;
                    pm.Msgtoid      = awardUserID;
                    pm.New          = 1;
                    pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    pm.Subject      = "ACN球会系统奖励(请勿回复此系统信息)";

                    PrivateMessages.CreatePrivateMessage(pm, 0);

                    ClientScript.RegisterClientScriptBlock(typeof(string), "succeed", "alert('成功颁奖!');", true);
                }
            }
            else
            {
                ClientScript.RegisterClientScriptBlock(typeof(string), "alert", "alert('用户ID与用户名不匹配!');", true);
            }

            InitDropDownList();
        }
Пример #11
0
        /// <summary>
        /// 在论坛注册一个新用户并绑定
        /// </summary>
        private void RegisterAndBind()
        {
            if (userid > 0)
            {
                AddErrLine("当前已有用户登录,无法注册");
                return;
            }

            if (config.Regstatus < 1 || cloudconfig.Allowconnectregister == 0)
            {
                AddErrLine("论坛当前禁止新的QQ会员登录");
                return;
            }

            string tmpUserName = DNTRequest.GetString(config.Antispamregisterusername);
            string email       = DNTRequest.GetString(config.Antispamregisteremail).Trim().ToLower();
            string tmpBday     = DNTRequest.GetString("bday").Trim();

            string errorMessage = "";

            if (!Users.PageValidateUserName(tmpUserName, out errorMessage) || !Users.PageValidateEmail(email, false, out errorMessage))
            {
                AddErrLine(errorMessage);
                return;
            }

            //用户注册模板中,生日可以单独用一个名为bday的文本框, 也可以分别用bday_y bday_m bday_d三个文本框, 用户可不填写
            if (!Utils.IsDateString(tmpBday) && !string.IsNullOrEmpty(tmpBday))
            {
                AddErrLine("生日格式错误, 如果不想填写生日请置空");
                return;
            }

            //如果用户名符合注册规则, 则判断是否已存在
            if (Users.GetUserId(tmpUserName) > 0)
            {
                AddErrLine("请不要重复提交!");
                return;
            }

            //读取当前用户的OPENID信息
            userconnectinfo = DiscuzCloud.GetUserConnectInfo(openid);
            if (userconnectinfo == null || userconnectinfo.Uid > 0)
            {
                AddErrLine("Connect信息异常,登录失败,请尝试再次登录");
                return;
            }

            UserBindConnectLog bindLog = DiscuzCloud.GetUserConnectBindLog(userconnectinfo.OpenId);

            if (cloudconfig.Maxuserbindcount != 0 && bindLog != null && (bindLog.Type != 1 && bindLog.BindCount >= cloudconfig.Maxuserbindcount))
            {
                AddErrLine("当前QQ用户解绑次数过多,无法绑定新注册的用户");
                return;
            }

            UserInfo userInfo = CreateUser(tmpUserName, email, tmpBday);

            userconnectinfo.Uid = userInfo.Uid;
            DiscuzCloud.UpdateUserConnectInfo(userconnectinfo);

            if (bindLog == null)
            {
                bindLog           = new UserBindConnectLog();
                bindLog.OpenId    = userconnectinfo.OpenId;
                bindLog.Uid       = userconnectinfo.Uid;
                bindLog.Type      = 1;
                bindLog.BindCount = 1;
                DiscuzCloud.CreateUserConnectBindLog(bindLog);
            }
            else
            {
                bindLog.BindCount++;
                bindLog.Uid  = userconnectinfo.Uid;
                bindLog.Type = 1;
                DiscuzCloud.UpdateUserConnectBindLog(bindLog);
            }

            #region 发送欢迎信息
            if (config.Welcomemsg == 1)
            {
                // 收件箱
                PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                privatemessageinfo.Message      = config.Welcomemsgtxt;
                privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                privatemessageinfo.Msgto        = userInfo.Username;
                privatemessageinfo.Msgtoid      = userInfo.Uid;
                privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                privatemessageinfo.Msgfromid    = 0;
                privatemessageinfo.New          = 1;
                privatemessageinfo.Postdatetime = Utils.GetDateTime();
                privatemessageinfo.Folder       = 0;
                PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            }
            #endregion

            //发送同步数据给应用程序
            Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, "");

            //如果用户选择使用QZone头像
            if (cloudconfig.Allowuseqzavater == 1 && DNTRequest.GetString("use_qzone_avatar") == "1")
            {
                QZoneAvatar qz = new QZoneAvatar();
                qz.AsyncGetAvatar(userconnectinfo);
            }

            SetUrl("index.aspx");
            SetShowBackLink(false);
            //如果不是需要管理员审核的注册,页面延时刷新为2秒,否则是5秒
            SetMetaRefresh(config.Regverify != 2 ? 2 : 5);
            Statistics.ReSetStatisticsCache();

            if (config.Regverify != 2)
            {
                CreditsFacade.UpdateUserCredits(userInfo.Uid);
                ForumUtils.WriteUserCookie(userInfo, -1, config.Passwordkey);
                Utils.WriteCookie("bindconnect", "true");//将当前登录用户是否绑定QQ互联的状态设置为true
                OnlineUsers.UpdateAction(olid, UserAction.Register.ActionID, 0, config.Onlinetimeout);
                AddMsgLine("QQ登录成功,继续浏览");
            }
            else
            {
                AddMsgLine("QQ数据绑定完成, 但需要系统管理员审核您的帐户后才可登录使用");
            }
            notifyscript = GetNotifyScript(userconnectinfo, userInfo.Username, userInfo.Bday, userInfo.Gender,
                                           userInfo.Email, userInfo.Showemail, DNTRequest.GetInt("useqqavatar", 2), "register");
        }
Пример #12
0
        private void BatchSendSM_Click(object sender, EventArgs e)
        {
            #region 批量短消息发送

            if (this.CheckCookie())
            {
                string groupidlist = Usergroups.GetSelectString(",");

                if (groupidlist == "")
                {
                    base.RegisterStartupScript("", "<script>alert('请您先选取相关的用户组,再点击提交按钮');</script>");
                    return;
                }

#if EntLib
                if (RabbitMQConfigs.GetConfig() != null && RabbitMQConfigs.GetConfig().SendShortMsg.Enable)//当开启errlog错误日志记录功能时
                {
                    PrivateMessageInfo pm = new PrivateMessageInfo()
                    {
                        Msgfrom      = username.Replace("'", "''"),
                        Msgfromid    = userid,
                        Folder       = int.Parse(folder.SelectedValue),
                        Subject      = subject.Text,
                        Postdatetime = Discuz.Common.Utils.GetDateTime(), //获取发送消息的系统时间
                        Message      = message.Text,
                        New          = 1                                  //标记为未读
                    };
                    Discuz.EntLib.ServiceBus.SendShortMsgClientHelper.GetSendShortMsgClient().AsyncSendShortMsgByUserGroup(groupidlist, pm);
                }
#else
                int percount = Discuz.Common.Utils.StrToInt(postcountpercircle.Text, 100); //每多少记录为一次等待
                int count    = 0;                                                          //当前记录数

                //foreach (DataRow dr in DbHelper.ExecuteDataset("SELECT [uid] ,[username]  From [" + BaseConfigs.GetTablePrefix + "users] WHERE [groupid] IN(" + groupidlist + ")").Tables[0].Rows)
                foreach (DataRow dr in Users.GetUserListByGroupidList(groupidlist).Rows)
                {
                    //DbHelper.ExecuteNonQuery("INSERT INTO [" + BaseConfigs.GetTablePrefix + "pms] (msgfrom,msgfromid,msgto,msgtoid,folder,new,subject,postdatetime,message) VALUES ('" + this.username.Replace("'", "''") + "','" + this.userid.ToString() + "','" + dr["username"].ToString().Replace("'", "''") + "','" + dr["uid"].ToString() + "','" + folder.SelectedValue + "','1','" + subject.Text + "','" + postdatetime.Text + "','" + message.Text + "')");
                    //DbHelper.ExecuteNonQuery("UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [newpmcount]=[newpmcount]+1  WHERE [uid] =" + dr["uid"].ToString());
                    //Discuz.Data.DatabaseProvider.GetInstance().SendPMToUser(username.Replace("'", "''"), userid, dr["username"].ToString().Replace("'", "''"), Convert.ToInt32(dr["uid"].ToString()), int.Parse(folder.SelectedValue), subject.Text, Convert.ToDateTime(postdatetime.Text), message.Text);
                    PrivateMessageInfo pm = new PrivateMessageInfo();
                    pm.Msgfrom      = username.Replace("'", "''");
                    pm.Msgfromid    = userid;
                    pm.Msgto        = dr["username"].ToString().Replace("'", "''");
                    pm.Msgtoid      = Convert.ToInt32(dr["uid"].ToString());
                    pm.Folder       = int.Parse(folder.SelectedValue);
                    pm.Subject      = subject.Text;
                    pm.Postdatetime = postdatetime.Text;
                    pm.Message      = message.Text;
                    pm.New          = 1;//标记为未读
                    PrivateMessages.CreatePrivateMessage(pm, 0);
                    if (count >= percount)
                    {
                        Thread.Sleep(500);
                        count = 0;
                    }
                    count++;
                }
#endif
                base.RegisterStartupScript("PAGE", "window.location.href='global_sendSMtogroup.aspx';");
            }

            #endregion
        }
Пример #13
0
        public void Register()
        {
            SetShowBackLink(true);
            InviteCodeInfo inviteCode = allowinvite ? ValidateInviteInfo() : null;

            if (IsErr())
            {
                return;
            }

            string tmpUserName = DNTRequest.GetString(config.Antispamregisterusername);
            string email       = config.Regverify == 1 ? verifyinfo.Email : DNTRequest.GetString(config.Antispamregisteremail).Trim().ToLower();
            string tmpBday     = DNTRequest.GetString("bday").Trim();

            if (tmpBday == "")
            {
                tmpBday = string.Format("{0}-{1}-{2}", DNTRequest.GetString("bday_y").Trim(),
                                        DNTRequest.GetString("bday_m").Trim(), DNTRequest.GetString("bday_d").Trim());
            }
            tmpBday = (tmpBday == "--" ? "" : tmpBday);

            ValidateUserInfo(tmpUserName, email, tmpBday);

            if (IsErr())
            {
                return;
            }

            //如果用户名符合注册规则, 则判断是否已存在
            if (Users.GetUserId(tmpUserName) > 0)
            {
                AddErrLine("请不要重复提交!");
                return;
            }

            UserInfo userInfo = CreateUser(tmpUserName, email, tmpBday);

            //如果开启邮箱验证注册,删除邮箱验证请求信息
            if (config.Regverify == 1)
            {
                Users.DeleteVerifyRegisterInfo(verifyinfo.RegId);
            }

            //若使用了邀请码,更新邀请码相关信息
            if (inviteCode != null)
            {
                Invitation.UpdateInviteCodeSuccessCount(inviteCode.InviteId);
                if (config.Regstatus == 3)
                {
                    if (inviteCode.SuccessCount + 1 >= inviteCode.MaxCount)
                    {
                        Invitation.DeleteInviteCode(inviteCode.InviteId);
                    }
                }
            }

            #region 发送欢迎信息
            if (config.Welcomemsg == 1)
            {
                // 收件箱
                PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                privatemessageinfo.Message      = config.Welcomemsgtxt;
                privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                privatemessageinfo.Msgto        = userInfo.Username;
                privatemessageinfo.Msgtoid      = userInfo.Uid;
                privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                privatemessageinfo.Msgfromid    = 0;
                privatemessageinfo.New          = 1;
                privatemessageinfo.Postdatetime = Utils.GetDateTime();
                privatemessageinfo.Folder       = 0;
                PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
            }
            #endregion

            //发送同步数据给应用程序
            Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, "");

            SetUrl("index.aspx");
            SetShowBackLink(false);
            //如果不是需要管理员审核的注册,页面延时刷新为2秒,否则是5秒
            SetMetaRefresh(config.Regverify != 2 ? 2 : 5);
            Statistics.ReSetStatisticsCache();

            if (config.Regverify != 2)
            {
                CreditsFacade.UpdateUserCredits(userInfo.Uid);
                ForumUtils.WriteUserCookie(userInfo, -1, config.Passwordkey);
                OnlineUsers.UpdateAction(olid, UserAction.Register.ActionID, 0, config.Onlinetimeout);
                MsgForward("register_succeed");
                AddMsgLine("注册成功, 返回登录页");
            }
            else
            {
                AddMsgLine("注册成功, 但需要系统管理员审核您的帐户后才可登录使用");
            }
            agree = "yes";
        }
Пример #14
0
        private void PassApply_Click(object sender, EventArgs e)
        {
            if (DNTRequest.GetString("uid") != "")
            {
                string uidlist = DNTRequest.GetString("uid");
                foreach (string uid in uidlist.Split(','))
                {
                    Discuz.Data.DatabaseProvider.GetInstance().UpdateUserSpaceId(Convert.ToInt32(uid));
                    //string sql = "UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [spaceid]=ABS([spaceid]) WHERE [uid]=" + uid;
                    //sql += ";SELECT [spaceid] FROM [" + BaseConfigs.GetTablePrefix + "users] WHERE [uid]=" + uid;
                    //int spceid = (int)AdminDatabase.ExecuteScalar(sql);
                    int     tabid = Spaces.GetNewTabId(Convert.ToInt32(uid));
                    TabInfo tab   = new TabInfo();
                    tab.TabID        = tabid;
                    tab.UserID       = Convert.ToInt32(uid);
                    tab.DisplayOrder = 0;
                    tab.TabName      = "首页";
                    tab.IconFile     = "";
                    tab.Template     = "template_25_75.htm";
                    Spaces.AddTab(tab);
                    //sql = "INSERT INTO [" + BaseConfigs.GetTablePrefix + "spacetabs] ([uid],[displayorder], [tabname], [iconfile],[template])  VALUES(" + uid + ",0,'默认','','template_25_75.htm');SELECT SCOPE_IDENTITY()";
                    //int tabid = Utils.StrToInt(AdminDatabase.ExecuteScalar(sql),0);
                    Spaces.AddLocalModule("builtin_calendarmodule.xml", int.Parse(uid), tabid, 1);
                    Spaces.AddLocalModule("builtin_statisticmodule.xml", int.Parse(uid), tabid, 1);
                    Spaces.AddLocalModule("builtin_postlistmodule.xml", int.Parse(uid), tabid, 2);

                    if (spaceConfig.Spacegreeting != string.Empty)
                    {
                        SpacePostInfo spacepostsinfo = new SpacePostInfo();
                        spacepostsinfo.Title          = string.Format("欢迎使用 {0} {1}", config.Forumtitle, config.Spacename);
                        spacepostsinfo.Content        = spaceConfig.Spacegreeting;
                        spacepostsinfo.Category       = string.Empty;
                        spacepostsinfo.PostStatus     = 1;
                        spacepostsinfo.CommentStatus  = 0;
                        spacepostsinfo.Postdatetime   = DateTime.Now;
                        spacepostsinfo.Author         = username;
                        spacepostsinfo.Uid            = Utils.StrToInt(uid, -1);
                        spacepostsinfo.PostUpDateTime = DateTime.Now;
                        spacepostsinfo.Commentcount   = 0;

                        DbProvider.GetInstance().AddSpacePost(spacepostsinfo);
                    }
                    ///添加最新主题到日志
                    List <TopicInfo> list = Topics.GetTopicsByUserId(userid, 1, config.Topictoblog, 0, 0);
                    foreach (TopicInfo mytopic in list)
                    {
                        int      pid  = Posts.GetFirstPostId(mytopic.Tid);
                        PostInfo post = Posts.GetPostInfo(mytopic.Tid, pid);
                        if (post != null && post.Message.Trim() != string.Empty)
                        {
                            SpacePostInfo spacepost = new SpacePostInfo();
                            spacepost.Author = username;
                            string content = Posts.GetPostMessageHTML(post, new AttachmentInfo[0]);
                            spacepost.Category       = "";
                            spacepost.Content        = content;
                            spacepost.Postdatetime   = DateTime.Now;
                            spacepost.PostStatus     = 1;
                            spacepost.PostUpDateTime = DateTime.Now;
                            spacepost.Title          = post.Title;
                            spacepost.Uid            = Utils.StrToInt(uid, -1);;

                            DbProvider.GetInstance().AddSpacePost(spacepost);
                        }
                    }

                    //短信通知用户个人空间已经开通
                    PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                    ShortUserInfo      userInfo           = Users.GetShortUserInfo(Convert.ToInt32(uid));
                    privatemessageinfo.Msgto        = userInfo == null ? "" : userInfo.Username;
                    privatemessageinfo.Msgtoid      = Convert.ToInt32(uid);
                    privatemessageinfo.Postdatetime = Utils.GetDateTime();
                    privatemessageinfo.Message      = "恭喜您,您的" + config.Spacename + "已经被管理员" + username + "开通!";
                    privatemessageinfo.Subject      = "恭喜,您的" + config.Spacename + "已经开通";
                    privatemessageinfo.Msgfrom      = username;
                    privatemessageinfo.Msgfromid    = userid;
                    privatemessageinfo.New          = 1;
                    privatemessageinfo.Folder       = 0;

                    PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
                    //AdminDatabase.ExecuteNonQuery("INSERT INTO [" + BaseConfigs.GetTablePrefix + "pms] (msgfrom,msgfromid,msgto,msgtoid,folder,new,subject,postdatetime,message) VALUES ('" + username + "','" + userid + "','" + msgto.Replace("'", "''") + "','" + uid + "','0','1','" + subject + "','" + curdatetime + "','" + message + "')");
                    //AdminDatabase.ExecuteNonQuery("UPDATE [" + BaseConfigs.GetTablePrefix + "users] SET [newpmcount]=[newpmcount]+1  WHERE [uid] =" + uid);
                }
                base.RegisterStartupScript("PAGE", "window.location.href='space_spaceapplymanage.aspx';");
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('请选择要开通的空间!');window.location.href='space_spaceapplymanage.aspx';</script>");
            }
        }
Пример #15
0
        private bool DoOperations(ForumInfo forum, AdminGroupInfo admininfo, int reasonpm)
        {
            string operationName = "";
            string next          = DNTRequest.GetFormString("next");
            string referer       = DNTRequest.GetFormString("referer");

            DataTable dt = null;

            #region DoOperation

            string reason = DNTRequest.GetString("reason");
            if (operation != "identify")
            {
                if (reason.Equals(""))
                {
                    AddErrLine("操作原因不能为空");
                    return(false);
                }
                else
                {
                    if (reason.Length > 200)
                    {
                        AddErrLine("操作原因不能多于200个字符");
                        return(false);
                    }
                }
            }

            if ("delete,highlight,close,movecategory".IndexOf(operation) == -1)
            {
                AddErrLine("未知的操作参数");
                return(false);
            }
            //执行提交操作
            if (next.Trim() != "")
            {
                referer = string.Format("goodsadmin.aspx?action={0}&categoryid={1}&goodsid={2}", next, categoryid, goodslist);
            }
            else
            {
                referer = string.Format(base.ShowGoodsListAspxRewrite(categoryid, 1));
            }

            #region switch operation

            switch (operation)
            {
            case "delete":
                operationName = "删除商品";
                if (!DoDeleteOperation(forum))
                {
                    return(false);
                }
                break;

            case "highlight":     //设置高亮
                operationName = "设置高亮";
                if (!DoHighlightOperation())
                {
                    return(false);
                }
                break;

            case "close":
                operationName = "关闭商品/取消";
                if (!DoCloseOperation())
                {
                    return(false);
                }
                break;

            case "movecategory":
                operationName = "移动商品";
                if (!DoMoveOperation())
                {
                    return(false);
                }
                break;

            default:
                operationName = "未知操作";
                break;
            }

            #endregion

            if (next.CompareTo("") == 0)
            {
                AddMsgLine("管理操作成功,现在将转入商品列表");
            }
            else
            {
                AddMsgLine("管理操作成功,现在将转入后续操作");
            }

            dt = Goods.GetGoodsList(goodslist);
            if (config.Modworkstatus == 1)
            {
                if (dt != null)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        AdminModeratorLogs.InsertLog(this.userid.ToString(), username, usergroupid.ToString(),
                                                     this.usergroupinfo.Grouptitle, Utils.GetRealIP(),
                                                     Utils.GetDateTime(), this.forumid.ToString(), this.forumname,
                                                     dr["goodsid"].ToString(), dr["title"].ToString(), operationName,
                                                     reason);

                        if (reasonpm == 1)
                        {
                            int posterid = Utils.StrToInt(dr["selleruid"], -1);
                            if (posterid != -1) //是游客,管理操作就不发短消息了
                            {
                                if (PrivateMessages.GetPrivateMessageCount(posterid, -1) <
                                    UserGroups.GetUserGroupInfo(Users.GetShortUserInfo(posterid).Groupid).Maxpmnum)
                                {
                                    PrivateMessageInfo __privatemessageinfo = new PrivateMessageInfo();

                                    string curdatetime = Utils.GetDateTime();
                                    // 收件箱
                                    __privatemessageinfo.Message =
                                        Utils.HtmlEncode(
                                            string.Format(
                                                "这是由论坛系统自动发送的通知短消息。\r\n以下您所发表的商品被 {0} {1} 执行 {2} 操作。\r\n\r\n商品: {3} \r\n操作理由: {4}\r\n\r\n如果您对本管理操作有异议,请与我取得联系。",
                                                Utils.RemoveHtml(this.usergroupinfo.Grouptitle), username,
                                                operationName, dr["title"].ToString().Trim(),
                                                reason));
                                    __privatemessageinfo.Subject      = Utils.HtmlEncode("您发表的商品被执行管理操作");
                                    __privatemessageinfo.Msgto        = dr["seller"].ToString();
                                    __privatemessageinfo.Msgtoid      = posterid;
                                    __privatemessageinfo.Msgfrom      = username;
                                    __privatemessageinfo.Msgfromid    = userid;
                                    __privatemessageinfo.New          = 1;
                                    __privatemessageinfo.Postdatetime = curdatetime;
                                    __privatemessageinfo.Folder       = 0;
                                    PrivateMessages.CreatePrivateMessage(__privatemessageinfo, 0);
                                }
                            }
                        }
                    }
                    dt.Dispose();
                }
            }


            //执行完某一操作后转到后续操作
            SetUrl(referer);
            if (next != string.Empty)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + referer, false);
            }
            else
            {
                AddScript("window.setTimeout('redirectURL()', 2000);function redirectURL() {window.location='" + referer + "';}");
            }

            SetShowBackLink(false);

            #endregion

            return(true);
        }
Пример #16
0
        /// <summary>
        /// 发送通知
        /// </summary>
        /// <returns></returns>
        public string Send()
        {
            if (Signature != GetParam("sig").ToString())
            {
                ErrorCode = (int)ErrorType.API_EC_SIGNATURE;
                return("");
            }

            //如果是桌面程序则需要验证用户身份
            if (this.App.ApplicationType == (int)ApplicationType.DESKTOP)
            {
                if (Uid < 1)
                {
                    ErrorCode = (int)ErrorType.API_EC_SESSIONKEY;
                    return("");
                }
            }

            if (CallId <= LastCallId)
            {
                ErrorCode = (int)ErrorType.API_EC_CALLID;
                return("");
            }

            if (!CheckRequiredParams("subject,message,to_ids"))
            {
                ErrorCode = (int)ErrorType.API_EC_PARAM;
                return("");
            }
            string ids = GetParam("to_ids").ToString();

            if (!CheckRequiredParams("to_ids") || !Utils.IsNumericArray(ids.Split(',')))
            {
                ErrorCode = (int)ErrorType.API_EC_PARAM;
                return("");
            }

            if ((!CheckRequiredParams("from_id") || !Utils.IsNumeric(GetParam("from_id"))) && Uid < 1)
            {
                ErrorCode = (int)ErrorType.API_EC_PARAM;
                return("");
            }
            int fromId = TypeConverter.ObjectToInt(GetParam("from_id"), Uid);

            string message = UBB.ParseUrl(Utils.EncodeHtml(GetParam("message").ToString()));

            string[] to_ids = ids.Split(',');

            string successfulIds = string.Empty;

            foreach (string id in to_ids)
            {
                if (TypeConverter.StrToInt(id) < 1)
                {
                    continue;
                }
                PrivateMessageInfo pm = new PrivateMessageInfo();
                pm.Folder       = 0;
                pm.Message      = message;
                pm.Msgfrom      = Discuz.Forum.Users.GetShortUserInfo(fromId).Username;
                pm.Msgfromid    = fromId;
                pm.Msgto        = "";//可能需要查询具体的收件人姓名
                pm.Msgtoid      = TypeConverter.StrToInt(id);
                pm.New          = 1;
                pm.Postdatetime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                pm.Subject      = GetParam("subject").ToString();

                successfulIds += (PrivateMessages.CreatePrivateMessage(pm, 0) > 0) ? (id + ",") : "";
            }
            successfulIds = successfulIds.Length > 0 ? successfulIds.Remove(successfulIds.Length - 1) : successfulIds;

            if (Format == FormatType.JSON)
            {
                return(string.Format("\"{0}\"", successfulIds));
            }

            MessageSendResponse nsr = new MessageSendResponse();

            nsr.Result = successfulIds;
            return(SerializationHelper.Serialize(nsr));
        }
Пример #17
0
        /// <summary>
        /// 获取用户id
        /// </summary>
        /// <returns></returns>
        private ShortUserInfo GetShortUserInfo(string postusername, string postpassword, string mobile, string email)
        {
            //postpassword = !Utils.StrIsNullOrEmpty(loginauth) ?
            //        DES.Decode(loginauth.Replace("[", "+"), config.Passwordkey) :
            //        DNTRequest.GetString("password");

            //postusername = Utils.StrIsNullOrEmpty(postusername) ? DNTRequest.GetString("username") : postusername;

            int uid = -1;

            switch (config.Passwordmode)
            {
            case 1:    //动网兼容模式
            {
                if (config.Secques == 1 && (!Utils.StrIsNullOrEmpty(loginauth) || !loginsubmit))
                {
                    uid = Users.CheckDvBbsPasswordAndSecques(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    uid = Users.CheckDvBbsPassword(postusername, postpassword);
                }
                break;
            }

            case 0:    //默认模式
            {
                if (config.Secques == 1 && (!Utils.StrIsNullOrEmpty(loginauth) || !loginsubmit))
                {
                    uid = Users.CheckPasswordAndSecques(postusername, postpassword, true, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer"));
                }
                else
                {
                    #region 原始登录
                    //原始的登录
                    // uid = Users.CheckPassword(postusername, postpassword, true);
                    #endregion

                    #region 现在的登录
                    //现在的登录
                    uid = Users.GetUserId(postusername);
                    if (uid > 0)        //更新用户手机号、邮箱
                    {
                        #region 更新用户手机号、邮箱
                        UserInfo oldUserInfo = Users.GetUserInfo(uid);
                        UserInfo userInfo    = oldUserInfo.Clone();
                        //需要判断签名是否修改过
                        string sig = oldUserInfo.Sightml;        //保存旧的签名
                        userInfo.Uid      = uid;
                        userInfo.Username = postusername;        //当前登录的用户名


                        #region 基本资料
                        //userInfo.Realname = DNTRequest.GetString("realname");
                        //userInfo.Gender = DNTRequest.GetInt("gender", 0);
                        //userInfo.Bday = Utils.HtmlEncode(DNTRequest.GetString("bday"));
                        //userInfo.Location = Utils.HtmlEncode(DNTRequest.GetString("location"));
                        //userInfo.Idcard = DNTRequest.GetString("idcard");
                        //userInfo.Nickname = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("nickname")));
                        //userInfo.Bio = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("bio")));
                        #endregion

                        #region 联系方式
                        userInfo.Mobile = mobile;
                        //userInfo.Phone = DNTRequest.GetString("phone");
                        userInfo.Email = email;

                        //if (userInfo.Email != oldUserInfo.Email && !Users.ValidateEmail(userInfo.Email, userid))
                        //{
                        //    AddErrLine("Email: \"" + userInfo.Email + "\" 已经被其它用户注册使用");
                        //    return;
                        //}
                        //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 = Utils.HtmlEncode(DNTRequest.GetString("website"));
                        //userInfo.Msn = Utils.HtmlEncode(DNTRequest.GetString("msn"));
                        //userInfo.Qq = Utils.HtmlEncode(DNTRequest.GetString("qq"));
                        //userInfo.Skype = Utils.HtmlEncode(DNTRequest.GetString("skype"));
                        //userInfo.Icq = Utils.HtmlEncode(DNTRequest.GetString("icq"));
                        //userInfo.Yahoo = Utils.HtmlEncode(DNTRequest.GetString("yahoo"));

                        #endregion


                        //PostpramsInfo postPramsInfo = new PostpramsInfo();
                        //postPramsInfo.Usergroupid = usergroupid;
                        //postPramsInfo.Attachimgpost = config.Attachimgpost;
                        //postPramsInfo.Showattachmentpath = config.Showattachmentpath;
                        //postPramsInfo.Hide = 0;
                        //postPramsInfo.Price = 0;
                        ////获取提交的内容并进行脏字和Html处理
                        ////postPramsInfo.Sdetail = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("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("修改个人档案完毕");
                        #endregion
                    }
                    else         //注册新用户
                    {
                        #region 注册新用户
                        //如果提交了用户注册信息...
                        InviteCodeInfo inviteCode = null;

                        string tmpUserName = postusername;
                        //string email = email;
                        string tmpBday = string.Empty;


                        UserInfo userInfo = CreateUser(tmpUserName, email, tmpBday, mobile);

                        #region 发送欢迎信息
                        if (config.Welcomemsg == 1)
                        {
                            // 收件箱
                            PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo();
                            privatemessageinfo.Message      = config.Welcomemsgtxt;
                            privatemessageinfo.Subject      = "欢迎您的加入! (请勿回复本信息)";
                            privatemessageinfo.Msgto        = userInfo.Username;
                            privatemessageinfo.Msgtoid      = userInfo.Uid;
                            privatemessageinfo.Msgfrom      = PrivateMessages.SystemUserName;
                            privatemessageinfo.Msgfromid    = 0;
                            privatemessageinfo.New          = 1;
                            privatemessageinfo.Postdatetime = Utils.GetDateTime();
                            privatemessageinfo.Folder       = 0;
                            PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0);
                        }
                        #endregion

                        #region 发送同步数据给应用程序
                        //发送同步数据给应用程序
                        Sync.UserRegister(userInfo.Uid, userInfo.Username, userInfo.Password, "");

                        Statistics.ReSetStatisticsCache();

                        if (inviteCode != null)
                        {
                            Invitation.UpdateInviteCodeSuccessCount(inviteCode.InviteId);
                            if (config.Regstatus == 3)
                            {
                                if (inviteCode.SuccessCount + 1 >= inviteCode.MaxCount)
                                {
                                    Invitation.DeleteInviteCode(inviteCode.InviteId);
                                }
                            }
                        }

                        if (config.Regverify == 0)
                        {
                            UserCredits.UpdateUserCredits(userInfo.Uid);
                            ForumUtils.WriteUserCookie(userInfo, -1, config.Passwordkey);
                            OnlineUsers.UpdateAction(olid, UserAction.Register.ActionID, 0, config.Onlinetimeout);
                        }
                        #endregion

                        uid = Users.GetUserId(postusername);
                        #endregion
                    }
                    #endregion
                }
                break;
            }

            default:     //第三方加密验证模式
            {
                return((ShortUserInfo)Users.CheckThirdPartPassword(postusername, postpassword, DNTRequest.GetFormInt("question", 0), DNTRequest.GetString("answer")));
            }
            }
            if (uid != -1)
            {
                Users.UpdateTrendStat(TrendType.Login);
            }
            return(uid > 0 ? Users.GetShortUserInfo(uid) : null);
        }