/// <summary> /// 更新用户积分 /// </summary> private void UpdateUserCredits() { if (userid != -1) { CreditsFacade.PostReply(userid, forum, true); } }
private void SelectPass_Click(object sender, EventArgs e) { #region 将选中用户调整到相应的用户组 if (this.CheckCookie()) { string uidList = DNTRequest.GetString("uid"); if (uidList != "") { //将用户调整到相应的用户组 if (Discuz.Forum.CreditsFacade.GetCreditsUserGroupId(0) != null) { int tmpGroupId = CreditsFacade.GetCreditsUserGroupId(0).Groupid; //添加注册用户审核机制后需要修改 Users.UpdateUserGroupByUidList(tmpGroupId, uidList); foreach (string uid in uidList.Split(',')) { CreditsFacade.UpdateUserCredits(Convert.ToInt32(uid)); } Users.ClearUsersAuthstr(uidList); } if (sendemail.Checked) { Users.SendEmailForAccountCreateSucceed(uidList); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location='forum_audituser.aspx';</script>"); } } #endregion }
public void BuyInviteCode() { if (this.invitecodecount >= this.invitationconfiginfo.InviteCodeMaxCountToBuy) { base.AddErrLine("您所拥有的邀请码数量超过了系统上限,无法再购买"); return; } string[] array = Utils.SplitString(this.invitationconfiginfo.InviteCodePrice, ","); float[] array2 = new float[8]; for (int i = 0; i < 8; i++) { array2[i] = (Single)array[i].ToDouble() * -1f; } if (CreditsFacade.UpdateUserExtCredits(this.userid, array2, false) > 0) { this.CreateInviteCode(); return; } string str = ""; if (EPayments.IsOpenEPayments()) { str = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>"; } base.AddErrLine("积分不足,无法购买邀请码" + str); }
public void BuyInviteCode() { if (invitecodecount >= invitationconfiginfo.InviteCodeMaxCountToBuy) { AddErrLine("您所拥有的邀请码数量超过了系统上限,无法再购买"); return; } string[] strExtCredits = Utils.SplitString(invitationconfiginfo.InviteCodePrice, ","); float[] extCredits = new float[8]; for (int i = 0; i < 8; i++) { extCredits[i] = Utils.StrToFloat(strExtCredits[i], 0) * -1; } if (CreditsFacade.UpdateUserExtCredits(userid, extCredits, false) > 0) { CreateInviteCode(); } else { string addExtCreditsTip = ""; if (EPayments.IsOpenEPayments()) { addExtCreditsTip = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>"; } AddErrLine("积分不足,无法购买邀请码" + addExtCreditsTip); return; } }
private void UpdateUserCredits() { if (this.userid != -1) { CreditsFacade.PostReply(this.userid, this.forum.Replyperm, true); } }
/// <summary> /// 发帖成功 /// </summary> /// <param name="values">版块积分设置</param> /// <param name="topicinfo">主题信息</param> private void PostTopicSucceed(ForumInfo forum, TopicInfo topicinfo) { CreditsFacade.PostTopic(userid, forum, true); int topicid = topicinfo.Tid; //当使用伪aspx if (config.Aspxrewrite == 1) { SetUrl(ShowTopicAspxRewrite(topicid, 0)); } else { SetUrl((ShowTopicAspxRewrite(topicid, 0)) + "&forumpage=" + forumpageid); } ForumUtils.WriteCookie("postmessage", ""); ForumUtils.WriteCookie("clearUserdata", "forum"); SetLastPostedForumCookie(); SetMetaRefresh(); MsgForward("posttopic_succeed"); AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(forumid, forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />"); //通知应用有新主题 Sync.NewTopic(topicid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.Posterid.ToString(), topicinfo.Fid.ToString(), ""); }
private void SelectPass_Click(object sender, EventArgs e) { if (base.CheckCookie()) { string uid = Request["uid"]; if (uid != "") { if (CreditsFacade.GetCreditsUserGroupId(0f) != null) { int groupid = CreditsFacade.GetCreditsUserGroupId(0f).ID; //Users.UpdateUserGroupByUidList(groupid, uid); //IUser user = XUser.FindByID(uid.ToInt()); string[] array = uid.Split(','); for (int i = 0; i < array.Length; i++) { string value = array[i]; Int32 id = Convert.ToInt32(value); XUser user = XUser.FindByID(id); user.GroupID = groupid; user.Save(); CreditsFacade.UpdateUserCredits(id); } //Users.ClearUsersAuthstr(uid); XUser.ClearUsersAuthstr(uid); } if (this.sendemail.Checked) { Users.SendEmailForAccountCreateSucceed(uid); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('请选择相应的用户!');window.location='forum_audituser.aspx';</script>"); } }
private void AllPass_Click(object sender, EventArgs e) { #region 将用户调整到相应的用户组 if (this.CheckCookie()) { if (CreditsFacade.GetCreditsUserGroupId(0) != null) { int tmpGroupId = Discuz.Forum.CreditsFacade.GetCreditsUserGroupId(0).Groupid; //添加注册用户审核机制后需要修改 UserGroups.ChangeAllUserGroupId(8, tmpGroupId);; foreach (DataRow dr in Users.GetUserListByGroupid(8).Rows) { CreditsFacade.UpdateUserCredits(Convert.ToInt32(dr["uid"].ToString())); } Users.ClearUsersAuthstrByUncheckedUserGroup(); } if (sendemail.Checked) { Users.SendEmailForUncheckedUserGroup(); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } #endregion }
/// <summary> /// 更新用户积分 /// </summary> /// <param name="tidlist">审核主题id</param> /// <param name="pidlist">通过审核帖子的Pid列表</param> private void UpdateUserCredits(string tidlist, string pidlist) { string[] tidarray = tidlist.Split(','); string[] pidarray = pidlist.Split(','); //float[] values = null; //ForumInfo forum = null; PostInfo post = null; //int fid = -1; for (int i = 0; i < pidarray.Length; i++) { //Topics.get post = Discuz.Forum.Posts.GetPostInfo(int.Parse(tidarray[i]), int.Parse(pidarray[i])); //获取帖子信息 CreditsFacade.PostReply(post.Posterid, Forums.GetForumInfo(post.Fid)); //if (fid != post.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的积分设置 //{ // fid = post.Fid; // forum = Discuz.Forum.Forums.GetForumInfo(fid); // if (!forum.Replycredits.Equals("")) // { // int index = 0; // float tempval = 0; // values = new float[8]; // foreach (string ext in Utils.SplitString(forum.Replycredits, ",")) // { // if (index == 0) // { // if (!ext.Equals("True")) // { // values = null; // break; // } // index++; // continue; // } // tempval = Utils.StrToFloat(ext, 0.0f); // values[index - 1] = tempval; // index++; // if (index > 8) // { // break; // } // } // } //} //if (values != null) //{ // ///使用版块内积分 // Discuz.Forum.UserCredits.UpdateUserExtCredits(post.Posterid, values, false); // Discuz.Forum.UserCredits.UpdateUserCredits(post.Posterid); //} //else //{ // ///使用默认积分 // Discuz.Forum.UserCredits.UpdateUserCreditsByPosts(post.Posterid); //} } }
public NotifyPage() { if (EPayments.CheckPayment(DNTRequest.GetString("notify_id")))//验证请求是否来自支付宝,或者是伪造的 { //获取需要的信息 int orderStatus = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status")); string orderCode = DNTRequest.GetString("out_trade_no", true); string tradeNo = DNTRequest.GetString("trade_no", true); if (string.IsNullOrEmpty(orderCode) || string.IsNullOrEmpty(tradeNo) || orderStatus <= 0) { return; } CreditOrderInfo orderInfo = CreditOrders.GetCreditOrderInfoByOrderCode(orderCode); //如果订单状态为未成功交易 if (orderInfo != null && orderInfo.OrderStatus < 2) { float[] extcredits = new float[8]; extcredits[orderInfo.Credit - 1] = orderInfo.Amount; if (CreditsFacade.UpdateUserExtCredits(orderInfo.Uid, extcredits, true) != 1) { orderStatus = 0; } CreditsLogs.AddCreditsLog(orderInfo.Uid, orderInfo.Uid, orderInfo.Credit, orderInfo.Credit, 0, orderInfo.Amount, Utils.GetDateTime(), 3);//添加积分兑换转账和充值记录 NoticeInfo notice = new NoticeInfo(); notice.Postdatetime = Utils.GetDateTime(); notice.Type = NoticeType.GoodsTradeNotice; notice.Poster = "系统"; notice.Posterid = 0; notice.Uid = orderInfo.Uid; notice.Note = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(orderInfo.Credit, orderInfo.Amount), tradeNo); Notices.CreateNoticeInfo(notice); CreditOrders.UpdateCreditOrderInfo(orderInfo.OrderId, tradeNo, orderStatus, Utils.GetDateTime());//修改积分订单记录状态 } //判断当前请求是支付宝GET式(直接跳转)或者是服务器POST式(需返回success使得支付宝停止继续发送通知) if (DNTRequest.IsPost()) { HttpContext.Current.Response.Write("success"); } else { HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true"); } } else { HttpContext.Current.Response.Write("fail"); } }
private void UpdateUserCredits(string tidlist, string pidlist) { string[] array = tidlist.Split(','); string[] array2 = pidlist.Split(','); for (int i = 0; i < array2.Length; i++) { var postInfo = Post.FindByID(array2[i].ToInt()); CreditsFacade.PostReply(postInfo.PosterID, Forums.GetForumInfo(postInfo.Fid).Replyperm); } }
private void CalculatorScore_Click(object sender, EventArgs e) { if (base.CheckCookie()) { IUser shortUserInfo = Discuz.Entity.User.FindByID(DNTRequest.GetInt("uid", -1)); if (this.userInfo != null) { this.credits.Text = CreditsFacade.GetUserCreditsByUserInfo(shortUserInfo).ToString(); } } }
public NotifyPage() { if (!EPayments.CheckPayment(DNTRequest.GetString("notify_id"))) { HttpContext.Current.Response.Write("fail"); return; } int status = EPayments.ConvertAlipayTradeStatus(DNTRequest.GetString("trade_status")); string outTradeNo = DNTRequest.GetString("out_trade_no", true); string tradeNo = DNTRequest.GetString("trade_no", true); if (string.IsNullOrEmpty(outTradeNo) || string.IsNullOrEmpty(tradeNo) || status <= 0) { return; } //var ci = CreditOrders.GetCreditOrderInfoByOrderCode(outTradeNo); var ci = Order.FindByCode(outTradeNo); if (ci != null && ci.Status < 2) { float[] array = new float[8]; array[ci.Credit - 1] = (float)ci.Amount; if (CreditsFacade.UpdateUserExtCredits(ci.Uid, array, true) != 1) { status = 0; } //CreditsLogs.AddCreditsLog(ci.Uid, ci.Uid, ci.Credit, ci.Credit, 0f, (float)ci.Amount, Utils.GetDateTime(), 3); CreditsLog.Add(ci.Uid, ci.Uid, ci.Credit, ci.Credit, 0, ci.Amount, 3); var notice = new Notice { PostDateTime = DateTime.Now, Type = (Int32)NoticeType.GoodsTradeNotice, Poster = "系统", PosterID = 0, Uid = ci.Uid, Note = string.Format("您购买的积分 {0} 已经成功充值,请<a href=\"usercpcreaditstransferlog.aspx\">查收</a>!(支付宝订单号:{1})", ForumUtils.ConvertCreditAndAmountToWord(ci.Credit, ci.Amount), tradeNo) }; notice.Insert(); //CreditOrders.UpdateCreditOrderInfo(ci.OrderId, tradeNo, num, Utils.GetDateTime()); ci.TradeNo = tradeNo; ci.Status = status; ci.ConfirmedTime = DateTime.Now; ci.Update(); } if (DNTRequest.IsPost()) { HttpContext.Current.Response.Write("success"); return; } HttpContext.Current.Response.Redirect("../usercpcreaditstransferlog.aspx?paysuccess=true"); }
private void CalculatorScore_Click(object sender, EventArgs e) { #region 计算积分 if (this.CheckCookie()) { ShortUserInfo shortUserInfo = Users.GetShortUserInfo(DNTRequest.GetInt("uid", -1)); if (userInfo != null) { credits.Text = CreditsFacade.GetUserCreditsByUserInfo(shortUserInfo).ToString(); } } #endregion }
private void StopTalk_Click(object sender, EventArgs e) { #region 设置禁言 if (this.CheckCookie()) { userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1)); if (!AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true)) { return; } if (ViewState["Groupid"].ToString() != "4") //当用户不是系统禁言组时 { if (userInfo.Uid > 1) //判断是不是当前uid是不是系统初始化时生成的uid { if (AlbumPluginProvider.GetInstance() != null) { AlbumPluginProvider.GetInstance().Ban(userInfo.Uid); } if (SpacePluginProvider.GetInstance() != null) { SpacePluginProvider.GetInstance().Ban(userInfo.Uid); } Users.UpdateUserToStopTalkGroup(userInfo.Uid.ToString()); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>"); } } else { if (CreditsFacade.GetCreditsUserGroupId(0) != null) { int tmpGroupID = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid; Users.UpdateUserGroup(userInfo.Uid, tmpGroupID); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + userInfo.Uid + "&condition=" + DNTRequest.GetString("condition") + "';</script>"); } } OnlineUsers.DeleteUserByUid(userInfo.Uid); } #endregion }
private void InitializeComponent() { this.StopTalk.Click += new EventHandler(this.StopTalk_Click); this.DelPosts.Click += new EventHandler(this.DelPosts_Click); this.SaveUserInfo.Click += new EventHandler(this.SaveUserInfo_Click); this.ResetPassWord.Click += new EventHandler(this.ResetPassWord_Click); this.IsEditUserName.CheckedChanged += new EventHandler(this.IsEditUserName_CheckedChanged); this.DelUserInfo.Click += new EventHandler(this.DelUserInfo_Click); this.ReSendEmail.Click += new EventHandler(this.ReSendEmail_Click); this.CalculatorScore.Click += new EventHandler(this.CalculatorScore_Click); this.ResetUserDigestPost.Click += new EventHandler(this.ResetUserDigestPost_Click); this.ResetUserPost.Click += new EventHandler(this.ResetUserPost_Click); this.GivenMedal.Click += new EventHandler(this.GivenMedal_Click); //UserCredits.UpdateUserCredits(DNTRequest.GetInt("uid", -1)); userInfo = AdminUsers.GetUserInfo(DNTRequest.GetInt("uid", -1)); UserGroupInfo tmpUserGroupInfo = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits); groupid.Items.Add(new ListItem(UserGroups.GetUserGroupInfo(tmpUserGroupInfo.Groupid).Grouptitle, tmpUserGroupInfo.Groupid.ToString())); foreach (UserGroupInfo userGroupInfo in UserGroups.GetUserGroupList()) { //if (userGroupInfo.System == 0 && userInfo.Groupid != userGroupInfo.Groupid || userGroupInfo.Groupid == 7) // continue; if ((userGroupInfo.System == 0 && userGroupInfo.Radminid == 0) || userGroupInfo.Groupid == 7) { continue; } groupid.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString())); extgroupids.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString())); } templateid.AddTableData(Templates.GetValidTemplateList(), "name", "templateid"); templateid.Items[0].Text = "默认"; TabControl1.InitTabPage(); if (DNTRequest.GetString("uid") == "") { Response.Redirect("global_usergrid.aspx"); return; } LoadCurrentUserInfo(DNTRequest.GetInt("uid", -1)); LoadScoreInf(DNTRequest.GetString("uid"), DNTRequest.GetString("fieldname")); }
private void DoBanUserOperation() { this.ispost = false; if (this.usergroupinfo.ReasonPm == 1 && Utils.StrIsNullOrEmpty(DNTRequest.GetString("reason"))) { this.titlemessage = true; base.AddErrLine("请填写操作原因"); return; } int formInt = DNTRequest.GetFormInt("banexpirynew", -1); string text = (formInt == 0) ? "29990101" : string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays((double)formInt)); string title; string actions; switch (DNTRequest.GetInt("bantype", -1)) { case 0: Users.UpdateBanUser(CreditsFacade.GetCreditsUserGroupId((float)this.operateduser.Credits).ID, "0", this.operateduid); title = string.Format("取消对 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 的禁止", this.operatedusername, this.operateduid); actions = "取消禁止"; break; case 1: Users.UpdateBanUser(4, text, this.operateduid); title = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 发言", this.operatedusername, this.operateduid); actions = "禁止发言"; break; case 2: Users.UpdateBanUser(5, text, this.operateduid); title = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 访问", this.operatedusername, this.operateduid); actions = "禁止访问"; break; default: this.titlemessage = true; base.AddErrLine("错误的禁止类型"); return; } ModeratorManageLog.Add(userid, username, usergroupid, usergroupinfo.GroupTitle, 0, "", 0, title, actions, DNTRequest.GetString("reason").Trim()); this.ispost = true; base.SetShowBackLink(false); base.SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl())); base.SetMetaRefresh(); base.MsgForward("useradmin_succeed", true); }
private void StopTalk_Click(object sender, EventArgs e) { if (base.CheckCookie()) { this.userInfo = Users.GetUserInfo(DNTRequest.GetInt("uid", -1)); if (!this.AllowEditUserInfo(DNTRequest.GetInt("uid", -1), true)) { return; } if (this.ViewState["GroupID"].ToString() != "4") { if (this.userInfo.ID > 1) { if (AlbumPluginProvider.GetInstance() != null) { AlbumPluginProvider.GetInstance().Ban(this.userInfo.ID); } if (SpacePluginProvider.GetInstance() != null) { SpacePluginProvider.GetInstance().Ban(this.userInfo.ID); } Users.UpdateUserToStopTalkGroup(this.userInfo.ID.ToString()); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,你要禁言的用户是系统初始化时的用户,因此不能操作!');window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>"); } } else { if (CreditsFacade.GetCreditsUserGroupId(0f) != null) { int groupId = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits).ID; Users.UpdateUserGroup(this.userInfo.ID, groupId); base.RegisterStartupScript("PAGE", "window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败,系统未能找到合适的用户组来调整当前用户所处的组!');window.location.href='global_edituser.aspx?uid=" + this.userInfo.ID + "&condition=" + Request["condition"] + "';</script>"); } } OnlineUsers.DeleteUserByUid(this.userInfo.ID); } }
/// <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); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 初始化控件 foreach (UserGroupInfo userGroupInfo in UserGroups.GetUserGroupList()) { groupid.Items.Add(new ListItem(userGroupInfo.Grouptitle, userGroupInfo.Groupid.ToString())); } AddUserInfo.Attributes.Add("onclick", "return IsValidPost();"); //将积分设置数据加载到Javascript数组,在前台改变 string scriptText = "var creditarray = new Array("; for (int i = 1; i < groupid.Items.Count; i++) { scriptText += AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.Items[i].Value)).Creditshigher.ToString() + ","; } scriptText = scriptText.TrimEnd(',') + ");"; this.RegisterStartupScript("begin", "<script type='text/javascript'>" + scriptText + "</script>"); groupid.Attributes.Add("onchange", "document.getElementById('" + credits.ClientID + "').value=creditarray[this.selectedIndex];"); groupid.Items.RemoveAt(0); try { groupid.SelectedValue = "10"; } catch { //当新手上路不存在时 groupid.SelectedValue = CreditsFacade.GetCreditsUserGroupId(0) != null?CreditsFacade.GetCreditsUserGroupId(0).Groupid.ToString() : "3"; } try { UserGroupInfo _usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(Convert.ToInt32(groupid.SelectedValue)); credits.Text = _usergroupinfo.Creditshigher.ToString(); } catch { ; } #endregion } }
private bool CheckPermission() { var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); if (adminGroupInfo == null || !adminGroupInfo.DisablePostctrl) { var ts = DateTime.Now - this.lastpostpmtime.AddSeconds(config.Postinterval * 2); if (ts.TotalSeconds < 0) { base.AddErrLine(string.Format("系统规定发帖或发短消息间隔为{0}秒, 您还需要等待 {1} 秒", this.config.Postinterval * 2, ts.TotalSeconds * -1)); return(false); } } if (!CreditsFacade.IsEnoughCreditsPM(this.userid)) { base.AddErrLine("您的积分不足, 不能发送短消息"); return(false); } return(true); }
private void PostTopicSucceed(IXForum forum, Topic topicinfo) { CreditsFacade.PostTopic(this.userid, forum, true); int tid = topicinfo.ID; if (this.config.Aspxrewrite == 1) { base.SetUrl(base.ShowTopicAspxRewrite(tid, 0)); } else { base.SetUrl(base.ShowTopicAspxRewrite(tid, 0) + "&forumpage=" + this.forumpageid); } ForumUtils.WriteCookie("postmessage", ""); ForumUtils.WriteCookie("clearUserdata", "forum"); this.SetLastPostedForumCookie(); base.SetMetaRefresh(); base.MsgForward("posttopic_succeed"); base.AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(this.forumid, this.forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />"); Sync.NewTopic(tid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.PosterID.ToString(), topicinfo.Fid.ToString(), ""); }
private void AllPass_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (CreditsFacade.GetCreditsUserGroupId(0f) != null) { int groupid = CreditsFacade.GetCreditsUserGroupId(0f).ID; UserGroups.ChangeAllUserGroupId(8, groupid); foreach (DataRow dataRow in Users.GetUserListByGroupid(8).Rows) { CreditsFacade.UpdateUserCredits(Convert.ToInt32(dataRow["uid"].ToString())); } Users.ClearUsersAuthstrByUncheckedUserGroup(); } if (this.sendemail.Checked) { Users.SendEmailForUncheckedUserGroup(); } base.RegisterStartupScript("PAGE", "window.location='forum_audituser.aspx';"); } }
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 SelectPass_Click(object sender, EventArgs e) { if (base.CheckCookie()) { string tid = Request["tid"]; if (tid != "") { //Topics.PassAuditNewTopic(tid); var list = Topic.FindAllByIDs(tid); foreach (var item in list) { item.Post.Invisible = 0; item.Post.Save(); CreditsFacade.PostTopic(item.PosterID, item.Forum); } base.RegisterStartupScript("", "<script>window.location='forum_auditnewtopic.aspx';</script>"); return; } base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location='forum_auditnewtopic.aspx';</script>"); } }
/// <summary> /// 不论是否提交都有的权限检查 /// </summary> /// <returns></returns> private bool CheckPermission() { // 如果是受灌水限制用户, 则判断是否是灌水 AdminGroupInfo admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); if (admininfo == null || admininfo.Disablepostctrl != 1) { int Interval = Utils.StrDateDiffSeconds(lastpostpmtime, config.Postinterval * 2); if (Interval < 0) { AddErrLine(string.Format("系统规定发帖或发短消息间隔为{0}秒, 您还需要等待 {1} 秒", (config.Postinterval * 2).ToString(), (Interval * -1).ToString())); return(false); } } if (!CreditsFacade.IsEnoughCreditsPM(userid)) { AddErrLine("您的积分不足, 不能发送短消息"); return(false); } return(true); }
private void InitializeComponent() { this.StopTalk.Click += new EventHandler(this.StopTalk_Click); this.DelPosts.Click += new EventHandler(this.DelPosts_Click); this.SaveUserInfo.Click += new EventHandler(this.SaveUserInfo_Click); this.ResetPassWord.Click += new EventHandler(this.ResetPassWord_Click); this.IsEditUserName.CheckedChanged += new EventHandler(this.IsEditUserName_CheckedChanged); this.DelUserInfo.Click += new EventHandler(this.DelUserInfo_Click); this.ReSendEmail.Click += new EventHandler(this.ReSendEmail_Click); this.CalculatorScore.Click += new EventHandler(this.CalculatorScore_Click); this.ResetUserDigestPost.Click += new EventHandler(this.ResetUserDigestPost_Click); this.ResetUserPost.Click += new EventHandler(this.ResetUserPost_Click); this.GivenMedal.Click += new EventHandler(this.GivenMedal_Click); this.userInfo = Users.GetUserInfo(DNTRequest.GetInt("uid", -1)); UserGroup creditsUserGroupId = CreditsFacade.GetCreditsUserGroupId((float)this.userInfo.Credits); this.groupid.Items.Add(new ListItem(creditsUserGroupId.GroupTitle, creditsUserGroupId.ID.ToString())); foreach (UserGroup current in UserGroup.FindAllWithCache()) { if ((current.System != 0 || current.RadminID != 0) && current.ID != 7) { this.groupid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString())); this.extgroupids.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString())); } } this.templateid.AddTableData(Template.GetValids(), "name", "id"); this.templateid.Items[0].Text = "默认"; this.TabControl1.InitTabPage(); if (Request["uid"] == "") { base.Response.Redirect("usergrid.aspx"); return; } this.LoadCurrentUserInfo(DNTRequest.GetInt("uid", -1)); this.LoadScoreInf(Request["uid"], Request["fieldname"]); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { foreach (var current in UserGroup.FindAllWithCache()) { this.groupid.Items.Add(new ListItem(current.GroupTitle, current.ID.ToString())); } this.AddUserInfo.Attributes.Add("onclick", "return IsValidPost();"); string text = "var creditarray = new Array("; for (int i = 1; i < this.groupid.Items.Count; i++) { text = text + UserGroup.FindByID(Convert.ToInt32(this.groupid.Items[i].Value)).Creditshigher.ToString() + ","; } text = text.TrimEnd(',') + ");"; base.RegisterStartupScript("begin", "<script type='text/javascript'>" + text + "</script>"); this.groupid.Attributes.Add("onchange", "document.getElementById('" + this.credits.ClientID + "').value=creditarray[this.selectedIndex];"); this.groupid.Items.RemoveAt(0); try { this.groupid.SelectedValue = "10"; } catch { this.groupid.SelectedValue = ((CreditsFacade.GetCreditsUserGroupId(0f) != null) ? CreditsFacade.GetCreditsUserGroupId(0f).ID.ToString() : "3"); } try { var userGroupInfo = UserGroup.FindByID(Convert.ToInt32(this.groupid.SelectedValue)); this.credits.Text = userGroupInfo.Creditshigher.ToString(); } catch { } } }
private void DoBanUserOperation() { ispost = false; string actions = ""; string title = ""; //判断后台是否设置必须输入理由, 0-不需要 1-必须 if (usergroupinfo.Reasonpm == 1 && Utils.StrIsNullOrEmpty(DNTRequest.GetString("reason"))) { titlemessage = true; AddErrLine("请填写操作原因"); return; } int banexpirynew = DNTRequest.GetFormInt("banexpirynew", -1); string expday = (banexpirynew == 0) ? "29990101" : string.Format("{0:yyyyMMdd}", DateTime.Now.AddDays(banexpirynew)); switch (DNTRequest.GetInt("bantype", -1)) { case 0: //正常状态 //Users.UpdateUserGroup(operateduid, UserCredits.GetCreditsUserGroupId(operateduser.Credits).Groupid); Users.UpdateBanUser(CreditsFacade.GetCreditsUserGroupId(operateduser.Credits).Groupid, "0", operateduid); title = string.Format("取消对 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 的禁止", operatedusername, operateduid); actions = "取消禁止"; break; case 1: //禁止发言 //Users.UpdateUserGroup(operateduid, 4); Users.UpdateBanUser(4, expday, operateduid); title = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 发言", operatedusername, operateduid); actions = "禁止发言"; break; case 2: //禁止访问 //Users.UpdateUserGroup(operateduid, 5); Users.UpdateBanUser(5, expday, operateduid); title = string.Format("禁止 <a href=\"../../userinfo-{1}.aspx\" target=\"_blank\">{0}</a> 访问", operatedusername, operateduid); actions = "禁止访问"; break; default: titlemessage = true; actions = "错误的禁止类型"; AddErrLine("错误的禁止类型"); return; } AdminModeratorLogs.InsertLog(userid.ToString(), username, usergroupid.ToString(), usergroupinfo.Grouptitle, DNTRequest.GetIP(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "0", "", "0", title, actions, DNTRequest.GetString("reason").Trim()); // 收件箱 //if (DNTRequest.GetFormInt("sendmessage", 0) == 1) //{ // PrivateMessageInfo privatemessageinfo = new PrivateMessageInfo(); // privatemessageinfo.Message = Utils.HtmlEncode(string.Format("这是由论坛系统自动发送的通知短消息。操作理由: {0}\r\n\r\n如果您对本管理操作有异议,请与我取得联系。", DNTRequest.GetString("reason").Trim())); // privatemessageinfo.Subject = Utils.HtmlEncode("您被执行 " + actions + " 操作"); // privatemessageinfo.Msgto = operateduser.Username; // privatemessageinfo.Msgtoid = operateduid; // privatemessageinfo.Msgfrom = username; // privatemessageinfo.Msgfromid = userid; // privatemessageinfo.New = 1; // privatemessageinfo.Postdatetime = Utils.GetDateTime(); // privatemessageinfo.Folder = 0; // PrivateMessages.CreatePrivateMessage(privatemessageinfo, 0); //} ispost = true; SetShowBackLink(false); SetUrl(Utils.UrlDecode(ForumUtils.GetReUrl())); SetMetaRefresh(); MsgForward("useradmin_succeed", true); }
private void SaveUserInfo_Click(object sender, EventArgs e) { #region 保存用户信息 if (this.CheckCookie()) { int uid = DNTRequest.GetInt("uid", -1); string errorInfo = ""; if (!AllowEditUserInfo(uid, true)) { return; } if (userName.Text != ViewState["username"].ToString()) { if (AdminUsers.GetUserId(userName.Text) > 0) { base.RegisterStartupScript("", "<script>alert('您所输入的用户名已被使用过, 请输入其他的用户名!');</script>"); return; } } if (userName.Text == "") { base.RegisterStartupScript("", "<script>alert('用户名不能为空!');</script>"); return; } if (groupid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('您未选中任何用户组!');</script>"); return; } userInfo = AdminUsers.GetUserInfo(uid); userInfo.Username = userName.Text; userInfo.Nickname = nickname.Text; userInfo.Accessmasks = Convert.ToInt32(accessmasks.SelectedValue); //当用户组发生变化时则相应更新用户的管理组字段 if (userInfo.Groupid.ToString() != groupid.SelectedValue) { userInfo.Adminid = UserGroups.GetUserGroupInfo(int.Parse(groupid.SelectedValue)).Radminid; } //userInfo.Avatarshowid = 0; if ((bday.Text == "0000-00-00") || (bday.Text == "0000-0-0") | (bday.Text.Trim() == "")) { userInfo.Bday = ""; } else { if (!Utils.IsDateString(bday.Text.Trim())) { base.RegisterStartupScript("", "<script>alert('用户生日不是有效的日期型数据!');</script>"); return; } else { userInfo.Bday = bday.Text; } } if (!Users.ValidateEmail(email.Text, uid)) { base.RegisterStartupScript("", "<script>alert('当前用户的邮箱地址已被使用过, 请输入其他的邮箱!');</script>"); return; } userInfo.Email = email.Text; userInfo.Gender = Convert.ToInt32(gender.SelectedValue); //userInfo.Groupexpiry = Convert.ToInt32(groupexpiry.Text);后台操作为永久禁言和永久禁访 userInfo.Groupexpiry = 0; userInfo.Extgroupids = extgroupids.GetSelectString(","); if ((groupid.SelectedValue != "1") && (userInfo.Uid == BaseConfigs.GetFounderUid)) { base.RegisterStartupScript("", "<script>alert('创始人的所属用户组不能被修改为其它组!');window.location.href='global_edituser.aspx?uid=" + DNTRequest.GetString("uid") + "';</script>"); return; } userInfo.Groupid = Convert.ToInt32(groupid.SelectedValue); userInfo.Invisible = Convert.ToInt32(invisible.SelectedValue); userInfo.Joindate = joindate.Text; userInfo.Lastactivity = lastactivity.Text; userInfo.Lastip = lastip.Text; userInfo.Lastpost = lastpost.Text; userInfo.Lastvisit = lastvisit.Text; userInfo.Newpm = Convert.ToInt32(newpm.SelectedValue); userInfo.Newsletter = (ReceivePMSettingType)GetNewsLetter(); userInfo.Oltime = Convert.ToInt32(oltime.Text); userInfo.Pageviews = Convert.ToInt32(pageviews.Text); userInfo.Pmsound = Convert.ToInt32(pmsound.Text); userInfo.Posts = Convert.ToInt32(posts.Text); userInfo.Ppp = Convert.ToInt32(ppp.Text); userInfo.Regip = regip.Text; userInfo.Digestposts = Convert.ToInt32(digestposts.Text); if (secques.SelectedValue == "1") { userInfo.Secques = ""; //清空安全码 } userInfo.Showemail = Convert.ToInt32(showemail.SelectedValue); userInfo.Sigstatus = Convert.ToInt32(sigstatus.SelectedValue); userInfo.Templateid = Convert.ToInt32(templateid.SelectedValue); userInfo.Tpp = Convert.ToInt32(tpp.Text); if (Utils.IsNumeric(extcredits1.Text.Replace("-", ""))) { userInfo.Extcredits1 = float.Parse(extcredits1.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits2.Text.Replace("-", ""))) { userInfo.Extcredits2 = float.Parse(extcredits2.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits3.Text.Replace("-", ""))) { userInfo.Extcredits3 = float.Parse(extcredits3.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits4.Text.Replace("-", ""))) { userInfo.Extcredits4 = float.Parse(extcredits4.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits5.Text.Replace("-", ""))) { userInfo.Extcredits5 = float.Parse(extcredits5.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits6.Text.Replace("-", ""))) { userInfo.Extcredits6 = float.Parse(extcredits6.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits7.Text.Replace("-", ""))) { userInfo.Extcredits7 = float.Parse(extcredits7.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } if (Utils.IsNumeric(extcredits8.Text.Replace("-", ""))) { userInfo.Extcredits8 = float.Parse(extcredits8.Text); } else { base.RegisterStartupScript("", "<script>alert('用户扩展积分不能为空或大于7位 !');</script>"); return; } //根据公式计算用户的总积分,并更新 userInfo.Credits = CreditsFacade.GetUserCreditsByUserInfo(userInfo); //判断用户组是否为积分用户组。如果是的话,就用当前积分更新。 if (UserGroups.IsCreditUserGroup(userInfo.Groupid)) { userInfo.Groupid = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits).Groupid; } //用户扩展信息 userInfo.Website = website.Text; userInfo.Icq = icq.Text; userInfo.Qq = qq.Text; userInfo.Yahoo = yahoo.Text; userInfo.Msn = msn.Text; userInfo.Skype = skype.Text; userInfo.Location = location.Text; userInfo.Customstatus = customstatus.Text; //userInfo.Avatar = avatar.Text; //userInfo.Avatarheight = Convert.ToInt32(avatarheight.Text); //userInfo.Avatarwidth = Convert.ToInt32(avatarwidth.Text); userInfo.Bio = bio.Text; if (signature.Text.Length > UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize) { errorInfo = "更新的签名长度超过 " + UserGroups.GetUserGroupInfo(userInfo.Groupid).Maxsigsize + " 字符的限制,未能更新。"; } else { userInfo.Signature = signature.Text; //签名UBB转换HTML PostpramsInfo _postpramsinfo = new PostpramsInfo(); _postpramsinfo.Showimages = UserGroups.GetUserGroupInfo(userInfo.Groupid).Allowsigimgcode; _postpramsinfo.Sdetail = signature.Text; userInfo.Sightml = UBB.UBBToHTML(_postpramsinfo); } userInfo.Realname = realname.Text; userInfo.Idcard = idcard.Text; userInfo.Mobile = mobile.Text; userInfo.Phone = phone.Text; userInfo.Medals = DNTRequest.GetString("medalid"); if (IsEditUserName.Checked && userName.Text != ViewState["username"].ToString()) { AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString()); //用户重命名同步 Discuz.Forum.Sync.RenameUser(userInfo.Uid, ViewState["username"].ToString(), userInfo.Username, ""); } if (AdminUsers.UpdateUserAllInfo(userInfo)) { OnlineUsers.DeleteUserByUid(userInfo.Uid); //移除该用户的在线信息,使之重建在线表信息 if (ViewState["Groupid"].ToString() != userInfo.Groupid.ToString()) { if (userInfo.Groupid == 4) { if (AlbumPluginProvider.GetInstance() != null) { AlbumPluginProvider.GetInstance().Ban(userInfo.Uid); } if (SpacePluginProvider.GetInstance() != null) { SpacePluginProvider.GetInstance().Ban(userInfo.Uid); } } else { if (AlbumPluginProvider.GetInstance() != null) { AlbumPluginProvider.GetInstance().UnBan(userInfo.Uid); } if (SpacePluginProvider.GetInstance() != null) { SpacePluginProvider.GetInstance().UnBan(userInfo.Uid); } } } //if (userName.Text != ViewState["username"].ToString()) //{ // AdminUsers.UserNameChange(userInfo, ViewState["username"].ToString()); //} //删除头像 if (delavart.Checked) { Avatars.DeleteAvatar(userInfo.Uid.ToString()); } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台编辑用户", "用户名:" + userName.Text); if (errorInfo == "") { base.RegisterStartupScript("PAGE", "window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';"); } else { base.RegisterStartupScript("PAGE", "alert('" + errorInfo + "');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';"); } } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergrid.aspx?condition=" + DNTRequest.GetString("condition") + "';</script>"); } } #endregion }