private void AddNewRec_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(this.subject.Text)) { base.RegisterStartupScript("", this.GetMessageScript("公共消息标题不能为空")); return; } if (String.IsNullOrEmpty(this.message.Text)) { base.RegisterStartupScript("", this.GetMessageScript("公共消息内容不能为空")); return; } try { var msg = new ShortMessage { Message = this.message.Text, Subject = this.subject.Text, Msgto = "", MsgtoID = 0, Msgfrom = "", MsgfromID = 0 }; msg.Create(false); this.BindData(); //XCache.Remove("/Forum/AnnouncePrivateMessageCount"); base.RegisterStartupScript("PAGE", "window.location.href='global_announceprivatemessage.aspx';"); } catch { base.RegisterStartupScript("", this.GetMessageScript("无法更新数据库.")); } }
//public static DataTable GetUserListByGroupidList(string groupIdList) //{ // return BBX.Data.Users.GetUserListByGroupid(groupIdList); //} public static int SendPMByGroupidList(string groupidlist, int topnumber, ref int start_uid, string msgfrom, int msguid, int folder, string subject, string postdatetime, string message) { //DataTable userListByGroupid = BBX.Data.Users.GetUserListByGroupid(groupidlist, topnumber, start_uid); //foreach (DataRow dataRow in userListByGroupid.Rows) var list = User.FindAllByGroupID(groupidlist, start_uid, topnumber); foreach (var item in list) { var msg = new ShortMessage(); msg.Msgfrom = msgfrom.Replace("'", "''"); msg.MsgfromID = msguid; msg.Msgto = item.Name.Replace("'", "''"); msg.MsgtoID = item.ID; msg.Folder = (Int16)folder; msg.Subject = subject; msg.PostDateTime = postdatetime.ToDateTime(); msg.Message = message; msg.Create(false); start_uid = msg.MsgtoID; var entity = Online.FindByUserID(msg.MsgtoID); //if (OnlineUsers.GetOlidByUid(msg.MsgtoID) > 0) if (entity != null) { Users.UpdateUserNewPMCount(msg.MsgtoID, entity.ID); } } return(list.Count); }
private void CreatePM(int folder, int saveToSendBox, string url, string msg) { if (folder != 2) { User userInfo = Users.GetUserInfo(this.msgtoid); var ug = UserGroup.FindByID(this.usergroupid); if (!ug.Is管理团队 && ShortMessage.GetPrivateMessageCount(this.msgtoid, -1) >= UserGroup.FindByID(userInfo.GroupID).MaxPmNum) { base.AddErrLine("抱歉,接收人的短消息已达到上限,无法接收"); return; } if (!Utils.InArray(userInfo.NewsLetter.ToInt().ToString(), "2,3,6,7")) { base.AddErrLine("抱歉,接收人拒绝接收短消息"); return; } } if (url != "usercpinbox.aspx" && ShortMessage.GetPrivateMessageCount(this.userid, -1) >= this.usergroupinfo.MaxPmNum) { base.AddErrLine("抱歉,您的短消息已达到上限,无法保存到发件箱"); return; } this.pm.Folder = (Int16)folder; if (CreditsFacade.SendPM(this.userid) == -1) { base.AddErrLine("您的积分不足, 不能发送短消息"); return; } //this.pm.Pmid = PrivateMessages.CreatePrivateMessage(this.pm, saveToSendBox); pm.Create(saveToSendBox != 0); if (DNTRequest.GetString("emailnotify") == "on") { this.SendNotifyEmail(Users.GetUserInfo(this.msgtoid).Email.Trim(), this.pm); } base.SetUrl(url); base.SetMetaRefresh(); base.SetShowBackLink(true); base.MsgForward("usercppostpm_succeed"); base.AddMsgLine(msg); }
private void BindPure() { if (this.userid > 0) { base.AddErrLine("当前已有用户登录,无法注册"); return; } //if (this.config.Regstatus < 1 || this.cloudconfig.Allowconnectregister == 0) //{ // base.AddErrLine("论坛当前禁止新的QQ会员登录"); // return; //} var connect = QzoneConnectContext.Current; var storedToken = QzoneConnectToken.FindByOpenId(connect.Token.OpenId); if (storedToken != null) { var url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Host, BaseConfigInfo.Current.Forumpath + qzconfig.QzoneConnectPage + "?act=access"); XTrace.WriteLine("BindNew -> redirect -> " + url); Response.Redirect(url); return; } var nickName = connect.GetQqNickname(); User userInfo = this.CreateUser(connect.Token.AccessToken.Substring(0, 10), nickName, "", ""); //修复bug,保存后才能有userid connect.Token.Uid = userInfo.ID; // 更新用户名为友好名称,优先使用QQ昵称 if (BBX.Entity.User.FindByName(nickName) == null) { userInfo.Name = nickName; } else { userInfo.Name = "QQ#" + userInfo.ID; } userInfo.Update(); connect.Token.IsPure = true; connect.Token.Save(); //QzoneConnectToken.Insert(connect.Token); XTrace.WriteLine("BindPure -> success, uid=" + connect.Token.Uid); //Statistic.UpdateStatisticsLastUserName(userInfo.ID, userInfo.Name); Statistic.Reset(); if (this.config.Welcomemsg == 1) { var msg = new ShortMessage { Message = this.config.Welcomemsgtxt, Subject = "欢迎您的加入! (请勿回复本信息)", Msgto = userInfo.Name, MsgtoID = userInfo.ID, Msgfrom = "系统", MsgfromID = 0, Folder = 0 }; msg.Create(); } //Sync.UserRegister(userInfo.ID, userInfo.Name, userInfo.Password, ""); LoginUser(userInfo); //Statistics.ReSetStatisticsCache(); Statistic.Reset(); if (this.config.Regverify != 2) { CreditsFacade.UpdateUserCredits(userInfo.ID); Online.UpdateAction(this.olid, UserAction.Register, 0, this.config.Onlinetimeout); base.AddMsgLine("QQ登录成功,继续浏览"); } else { base.AddMsgLine("QQ数据绑定完成, 但需要系统管理员审核您的帐户后才可登录使用"); } base.SetUrl(connect.Callback); base.SetMetaRefresh(); base.SetShowBackLink(false); XTrace.WriteLine("BindPure -> finish, uid=" + connect.Token.Uid); }
private void BindNew() { if (userid > 0) { base.AddErrLine("当前已有用户登录,无法注册"); return; } //if (config.Regstatus < 1 || cloudconfig.Allowconnectregister == 0) //{ // base.AddErrLine("论坛当前禁止新的QQ会员登录"); // return; //} string username = DNTRequest.GetString(config.Antispamregisterusername); string email = DNTRequest.GetString(config.Antispamregisteremail).Trim().ToLower(); string birthday = DNTRequest.GetString("bday").Trim(); string errinfo = ""; if (!Users.PageValidateUserName(username, out errinfo) || !Users.PageValidateEmail(email, false, out errinfo)) { base.AddErrLine(errinfo); return; } if (!Utils.IsDateString(birthday) && !string.IsNullOrEmpty(birthday)) { base.AddErrLine("生日格式错误, 如果不想填写生日请置空"); return; } if (Users.GetUserId(username) > 0) { base.AddErrLine("请不要重复提交!"); return; } var connect = QzoneConnectContext.Current; var storedToken = QzoneConnectToken.FindByOpenId(connect.Token.OpenId); if (storedToken != null) { var url = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Host, BaseConfigInfo.Current.Forumpath + qzconfig.QzoneConnectPage + "?act=access"); XTrace.WriteLine("BindNew -> redirect -> " + url); Response.Redirect(url); return; } User userInfo = this.CreateUser(username, connect.GetQqNickname(), email, birthday); connect.Token.Uid = userInfo.ID; connect.Token.Save(); //QzoneConnectToken.Insert(connect.Token); XTrace.WriteLine("BindNew -> success, uid=" + connect.Token.Uid); if (this.config.Welcomemsg == 1) { var msg = new ShortMessage { Message = this.config.Welcomemsgtxt, Subject = "欢迎您的加入! (请勿回复本信息)", Msgto = userInfo.Name, MsgtoID = userInfo.ID, Msgfrom = "系统", MsgfromID = 0, Folder = 0 }; msg.Create(false); } //Sync.UserRegister(userInfo.ID, userInfo.Name, userInfo.Password, ""); if (qzconfig.AllowUseQZAvater && DNTRequest.GetString("use_qzone_avatar") == "1") { var qZoneAvatar = new QZoneAvatar(); qZoneAvatar.AsyncGetAvatar(connect); } LoginUser(userInfo); //Statistics.ReSetStatisticsCache(); Statistic.Reset(); if (this.config.Regverify != 2) { CreditsFacade.UpdateUserCredits(userInfo.ID); Online.UpdateAction(this.olid, UserAction.Register, 0, this.config.Onlinetimeout); base.AddMsgLine("QQ登录成功,继续浏览"); } else { base.AddMsgLine("QQ数据绑定完成, 但需要系统管理员审核您的帐户后才可登录使用"); } base.SetUrl(connect.Callback); base.SetMetaRefresh(); base.SetShowBackLink(false); XTrace.WriteLine("BindNew -> finish, uid=" + connect.Token.Uid); }
public void Register() { base.SetShowBackLink(true); var inviteCodeInfo = this.allowinvite ? this.ValidateInviteInfo() : null; if (base.IsErr()) { return; } string username = DNTRequest.GetString(this.config.Antispamregisterusername); string email = (this.config.Regverify == 1) ? this.verifyinfo.Email : DNTRequest.GetString(this.config.Antispamregisteremail).Trim().ToLower(); string bday = DNTRequest.GetString("bday").Trim(); if (String.IsNullOrEmpty(bday)) { bday = string.Format("{0}-{1}-{2}", DNTRequest.GetString("bday_y").Trim(), DNTRequest.GetString("bday_m").Trim(), DNTRequest.GetString("bday_d").Trim()); } if (bday == "--") { bday = ""; } this.ValidateUserInfo(username, email, bday); if (base.IsErr()) { return; } if (Users.GetUserId(username) > 0) { base.AddErrLine("请不要重复提交!"); return; } var userInfo = this.CreateUser(username, email, bday); if (this.config.Regverify == 1) { //Users.DeleteVerifyRegisterInfo(this.verifyinfo.RegId); //var vi = VerifyReg.FindByID(verifyinfo.ID); verifyinfo.Delete(); } if (inviteCodeInfo != null) { //Invitation.UpdateInviteCodeSuccessCount(inviteCodeInfo.InviteId); inviteCodeInfo.SuccessCount++; if (this.config.Regstatus == 3 && inviteCodeInfo.SuccessCount + 1 >= inviteCodeInfo.MaxCount) { //Invitation.DeleteInviteCode(inviteCodeInfo.InviteId); inviteCodeInfo.IsDeleted = true; } inviteCodeInfo.Save(); } if (this.config.Welcomemsg == 1) { var msg = new ShortMessage { Message = this.config.Welcomemsgtxt, Subject = "欢迎您的加入! (请勿回复本信息)", Msgto = userInfo.Name, MsgtoID = userInfo.ID, Msgfrom = "系统", MsgfromID = 0, Folder = 0 }; msg.Create(); } Sync.UserRegister(userInfo.ID, userInfo.Name, userInfo.Password, ""); base.SetUrl("index.aspx"); base.SetShowBackLink(false); base.SetMetaRefresh((this.config.Regverify != 2) ? 2 : 5); //Statistic.ReSetStatisticsCache(); //Statistic.UpdateStatisticsLastUserName(userInfo.ID, userInfo.Name); Statistic.Reset(); if (this.config.Regverify != 2) { CreditsFacade.UpdateUserCredits(userInfo.ID); ForumUtils.WriteUserCookie(userInfo, -1, this.config.Passwordkey); Online.UpdateAction(this.olid, UserAction.Register, 0, this.config.Onlinetimeout); base.MsgForward("register_succeed"); base.AddMsgLine("注册成功, 返回登录页"); } else { base.AddMsgLine("注册成功, 但需要系统管理员审核您的帐户后才可登录使用"); } this.agree = "yes"; }