protected void PostMsg_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = tpuser_Bll.GetLogin();//barBll.GetUser(); if (mu.Status != 0) { function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!"); } M_Guest_Bar lastMod = barBll.SelLastModByUid(mu); M_GuestBookCate catemod = guestBll.GetCate(CateID); BarOption baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID); int usertime = baroption == null ? 120 : baroption.UserTime; int sendtime = baroption == null?5:baroption.SendTime; if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text.Trim())) { function.WriteErrMsg("验证码不正确", "/" + B_Guest_Bar.CreateUrl(1, CateID, CPage)); } else if (catemod.IsBarOwner(mu.UserID)) { } else if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限 { int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes; function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);"); } else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime) { int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes; function.WriteErrMsg("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);"); } string msg = MsgContent_T.Text; GetSubTitle(ref msg); catemod = guestBll.SelReturnModel(CateID); barMod = FillMsg(MsgTitle_T.Text, msg, catemod); int id = barBll.Insert(barMod); if (catemod.Status == 1 && mu.UserID > 0) //是否需审核 { if (catemod.IsPlat == 1) //分享到能力中心 { string siteurl = "http://" + Request.Url.Authority + "/"; string url = B_Guest_Bar.CreateUrl(2, id); string cateurl = B_Guest_Bar.CreateUrl(1, catemod.CateID); msgBll.InsertMsg(string.Format(forwardTlp, barMod.Title, siteurl + url, siteurl + url, catemod.CateName, siteurl + cateurl)); } buser.ChangeVirtualMoney(mu.UserID, new M_UserExpHis() { score = catemod.SendScore, ScoreType = (int)M_UserExpHis.SType.Point, detail = string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, catemod.CateName, MsgTitle_T.Text.Trim(), catemod.SendScore) }); Response.Redirect("/" + B_Guest_Bar.CreateUrl(2, id)); } else { Response.Redirect("/" + B_Guest_Bar.CreateUrl(1, CateID)); } }
protected void PostMsg_Btn_Click(object sender, EventArgs e) { M_UserInfo mu = tpuserBll.GetLogin();//barBll.GetUser(); if (mu.Status != 0) { function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!"); } M_Guest_Bar lastMod = barBll.SelLastModByUid(mu, false); M_GuestBookCate catemod = bookBll.GetCate(Cid); BarOption baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == Cid); int usertime = baroption == null ? 120 : baroption.UserTime; int sendtime = baroption == null ? 5 : baroption.SendTime; if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text.Trim())) { function.WriteErrMsg("验证码不正确", "/" + CreateUrl(2, Pid, CPage)); } else if (catemod.IsBarOwner(mu.UserID)) { } else if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限 { int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes; function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);"); } else if (lastMod != null && ((int)(DateTime.Now - lastMod.CDate).TotalMinutes) < sendtime) { int second = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes; function.WriteErrMsg("你回复太快了," + second + "分钟后才能再次回复", "javascript:history.go(-1);"); } barMod = FillMsg(MsgContent_T.Text, Pid); barBll.Insert(barMod); Response.Redirect(CreateUrl(2, Pid, CPage)); }
public IActionResult CateAdd_Submit(M_GuestBookCate model) { M_GuestBookCate cateMod = new M_GuestBookCate(); if (CateID > 0) { cateMod = cateBll.SelReturnModel(Mid); } cateMod.CateName = model.CateName; cateMod.NeedLog = Convert.ToInt32(GetParam("NeedLog")); cateMod.PostAuth = Convert.ToInt32(GetParam("PostAuth")); cateMod.ZipImgSize = model.ZipImgSize; cateMod.BarImage = GetParam("BarImage_t"); cateMod.GType = 1; cateMod.ParentID = DataConvert.CLng(GetParam("selected_Hid")); cateMod.BarOwner = GetParam("BarOwner_Hid"); cateMod.PermiBit = DataConvert.CLng(GetParam("PermiBit")).ToString(); cateMod.Desc = model.Desc; //cateMod.IsPlat = DataConverter.CLng(IsPlat_T.Text); cateMod.SendScore = model.SendScore; cateMod.ReplyScore = model.ReplyScore; cateMod.Status = model.Status; cateMod.IsShowUnaudit = model.IsShowUnaudit; GuestConfigInfo guestinfo = GuestConfig.GuestOption; GuestConfig config = new GuestConfig(); if (CateID < 1) { cateMod.CateID = cateBll.Insert(cateMod); guestinfo.BarOption.Add(new BarOption() { CateID = cateMod.CateID, UserTime = DataConvert.CLng(GetParam("UserTime_T")), SendTime = DataConvert.CLng(GetParam("SendTime_T")) }); config.Update(guestinfo); return(WriteOK("添加成功!", "CateList")); } else { cateBll.Update(cateMod); BarOption baroption = guestinfo.BarOption.Find(v => v.CateID == CateID); if (baroption == null) { guestinfo.BarOption.Add(new BarOption() { CateID = cateMod.CateID, UserTime = DataConvert.CLng(GetParam("UserTime_T")), SendTime = DataConvert.CLng(GetParam("SendTime_T")) }); } else { baroption.UserTime = DataConvert.CLng(GetParam("UserTime_T")); baroption.SendTime = DataConvert.CLng(GetParam("SendTime_T")); } config.Update(guestinfo); return(WriteOK("添加成功!", "CateList")); } }
protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { #region AJAX请求 string action = Request.Form["action"]; string value = Request.Form["value"]; string result = ""; switch (action) { case "GetChild": int id = DataConverter.CLng(value); DataTable dt = cateBll.Cate_SelByType(M_GuestBookCate.TypeEnum.PostBar, id); dt.Columns.Add(new DataColumn("NLogStr", typeof(string))); dt.Columns.Add(new DataColumn("CountStr", typeof(string))); //countdt=barBll.SelYTCount(id.ToString()); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; dr["BarInfo"] = GetBarStatus(dr["BarInfo"].ToString()); dr["NLogStr"] = GetNeedLog(dr["NeedLog"].ToString()); dr["CountStr"] = GetCount(dr["CateID"].ToString()); } dt.Columns.Remove("desc"); result = JsonHelper.JsonSerialDataTable(dt); Response.Write(result); break; } Response.Flush(); Response.End(); #endregion } if (!IsPostBack) { B_ARoleAuth.CheckEx(ZLEnum.Auth.content, "BarManage"); if (DelCateID > 0) { GuestConfigInfo guestinfo = GuestConfig.GuestOption; GuestConfig config = new GuestConfig(); BarOption baroption = guestinfo.BarOption.Find(v => v.CateID == DelCateID); if (baroption != null) { guestinfo.BarOption.Remove(baroption); } cateBll.Del(DelCateID); config.Update(guestinfo); } MyBind(); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx" + "'>工作台</a></li><li class='active'><a href='/admin/Guest/GuestCateMana.aspx'>栏目管理</a></li><li class='active'>[<a href='javascript:;' onclick='ShowCate(0,0);' id='showDiv'>添加栏目</a>] [<a href='javascript:ShowOrder(0);'>排序管理</a>] [<a href='TieList.aspx?status=" + (int)ZLEnum.ConStatus.Recycle + "'>回收站</a>]</li>" + Call.GetHelp(92)); } }
public void MyBind() { cateMod = cateBll.SelReturnModel(CateID); txtCateName.Text = cateMod.CateName; selected_Hid.Value = cateMod.ParentID.ToString(); NeedLog.SelectedValue = cateMod.NeedLog.ToString(); PostAuth.SelectedValue = cateMod.PostAuth.ToString(); GType_Rad.SelectedValue = cateMod.GType.ToString(); SenderScore_T.Text = cateMod.SendScore.ToString(); ReplyScore_T.Text = cateMod.ReplyScore.ToString(); PostType.SelectedValue = DataConverter.CLng(cateMod.PermiBit).ToString(); ZipImgSize_T.Text = cateMod.ZipImgSize.ToString(); IsPlat_T.Text = cateMod.IsPlat.ToString(); ImageInfo_T.Text = cateMod.BarImage; cateMod.Desc = BarDesc_T.Text; IsCheck_Ra.Checked = cateMod.Status == 1; CheckOpt_Ra.Checked = cateMod.IsShowUnaudit == 1; DataTable userDT = buser.SelectUserByIds(cateMod.BarOwner); if (userDT != null && userDT.Rows.Count > 0) { userDT = userDT.DefaultView.ToTable(true, "UserID", "UserName"); BarOwner_Json_T.Value = JsonConvert.SerializeObject(userDT); } BarOwner_Hid.Value = cateMod.BarOwner; BarOption baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID); if (baroption != null) { UserTime_T.Text = baroption.UserTime.ToString(); SendTime_T.Text = baroption.SendTime.ToString(); } if (cateMod.GType != (int)M_GuestBookCate.TypeEnum.PostBar) { function.Script(this, "HideBarSet();"); } }
public IActionResult Post_Add() { //Mid,CateID M_UserInfo mu = tuBll.GetLogin(); //buser.GetLogin(); if (mu.Status != 0) { return(WriteErr("您的账户已被锁定,无法进行发帖、回复等操作!")); } int pid = DataConvert.CLng(RequestEx["pid"]); string title = Request.Form["MsgTitle_T"]; string msg = Request.Form["MsgContent_T"]; //如果内容来源于手机编辑器,则合并图片与转化表情 if (DataConvert.CStr(Request.Form["editor"]).Equals("mbeditor")) { msg = msg.Replace("\r\n", "<br />"); string imgs = Request.Form["txt_bar"], emotions = Request.Form["ImgFace_Hid"]; if (!string.IsNullOrEmpty(emotions)) { string imgTlp = "<img src='/Plugins/Ueditor/dialogs/emotion/{0}' class='imgface_img' />"; DataTable dt = JsonHelper.JsonToDT(emotions); foreach (DataRow dr in dt.Rows) { msg = msg.Replace(dr["title"].ToString(), string.Format(imgTlp, dr["realurl"].ToString())); } } if (!string.IsNullOrEmpty(imgs) && !imgs.Equals("[]")) { string imgHtml = ""; string imgTlp = "<img src='{0}'>"; //[{"url":"/UploadFiles/User/user/admin1/20180627EvVVMk.jpg","desc":""}] DataTable dt = JsonHelper.JsonToDT(imgs); foreach (DataRow dr in dt.Rows) { imgHtml += string.Format(imgTlp, DataConvert.CStr(dr["url"])); } msg += "<div>" + imgHtml + "</div>"; } } string base64Msg = StrHelper.CompressString(msg); string rurl = RequestEx["rurl"];//操作完成后返回哪个链接 bool auth_barowner = false; if (pid > 0)//回复主贴 { M_Guest_Bar pmod = barBll.SelReturnModel(pid); CateID = pmod.CateID; } if (Mid > 0)//编辑贴子 { barMod = barBll.SelReturnModel(Mid); CateID = barMod.CateID; } M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID); if (cateMod == null) { return(WriteErr("栏目不存在")); } rurl = string.IsNullOrEmpty(rurl) ? "/PClass?id=" + cateMod.CateID : rurl; auth_barowner = cateMod.IsBarOwner(mu.UserID); if (Mid > 0)//编辑 { if (barMod.CUser != mu.UserID && !auth_barowner) { return(WriteErr("你无权修改该内容")); } barMod.Title = title; barMod.SubTitle = GetSubTitle(ref msg); barMod.MsgContent = base64Msg; barBll.UpdateByID(barMod); } else { if (pid < 1 && string.IsNullOrEmpty(title)) { return(WriteErr("贴子标题不能为空!")); } if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["VCode"])) { return(WriteErr("验证码不正确")); } if (!auth_barowner)//非管理员需要检测权限和接受限制 { //是否可在该版块发贴子 if (!authBll.AuthCheck(cateMod, mu, "send")) { return(WriteErr("你无权在[" + cateMod.CateName + "]版块发布贴子")); } //是否有时间限制 M_Guest_Bar lastMod = barBll.SelLastModByUid(mu); BarOption baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID); int usertime = baroption == null ? 120 : baroption.UserTime; int sendtime = baroption == null ? 5 : baroption.SendTime; if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限 { int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes; return(WriteErr("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);")); } else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime) { int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes; return(WriteErr("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);")); } } barMod = FillMsg(title, msg, pid, 0, cateMod); barMod.ID = barBll.Insert(barMod); if (pid < 1) { rurl = "/PItem?ID=" + barMod.ID; } if (cateMod.Status == 1 && mu.UserID > 0 && cateMod.SendScore > 0)//是否需审核 { buser.AddMoney(mu.UserID, cateMod.SendScore, M_UserExpHis.SType.Point, string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, cateMod.CateName, barMod.Title, cateMod.SendScore)); } } return(Redirect(rurl)); }
public void Post_Add() { //Mid,CateID M_UserInfo mu = tuBll.GetLogin(); //buser.GetLogin(); if (mu.Status != 0) { function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!"); return; } int pid = DataConvert.CLng(Request.QueryString["pid"]); string title = Request.Form["MsgTitle_T"]; string msg = Request.Form["MsgContent_T"]; string base64Msg = StrHelper.CompressString(msg); string rurl = Request["rurl"];//操作完成后返回哪个链接 bool auth_barowner = false; if (pid > 0)//回复主贴 { M_Guest_Bar pmod = barBll.SelReturnModel(pid); CateID = pmod.CateID; } if (Mid > 0)//编辑贴子 { barMod = barBll.SelReturnModel(Mid); CateID = barMod.CateID; } M_GuestBookCate cateMod = cateBll.SelReturnModel(CateID); if (cateMod == null) { function.WriteErrMsg("栏目不存在"); return; } rurl = string.IsNullOrEmpty(rurl) ? "/PClass?id=" + cateMod.CateID : rurl; auth_barowner = cateMod.IsBarOwner(mu.UserID); if (Mid > 0)//编辑 { if (barMod.CUser != mu.UserID && !auth_barowner) { function.WriteErrMsg("你无权修改该内容"); return; } barMod.Title = title; barMod.SubTitle = GetSubTitle(ref msg); barMod.MsgContent = base64Msg; barBll.UpdateByID(barMod); } else { if (pid < 1 && string.IsNullOrEmpty(title)) { function.WriteErrMsg("贴子标题不能为空!"); return; } if (!ZoomlaSecurityCenter.VCodeCheck(Request["VCode_hid"], Request["VCode"])) { function.WriteErrMsg("验证码不正确"); return; } if (!auth_barowner)//非管理员需要检测权限和接受限制 { //是否可在该版块发贴子 if (!authBll.AuthCheck(cateMod, mu, "send")) { function.WriteErrMsg("你无权在[" + cateMod.CateName + "]版块发布贴子"); return; } //是否有时间限制 M_Guest_Bar lastMod = barBll.SelLastModByUid(mu); BarOption baroption = GuestConfig.GuestOption.BarOption.Find(v => v.CateID == CateID); int usertime = baroption == null ? 120 : baroption.UserTime; int sendtime = baroption == null ? 5 : baroption.SendTime; if (mu.UserID > 0 && (DateTime.Now - mu.RegTime).TotalMinutes < usertime)//匿名用户不受此限 { int minute = usertime - (int)(DateTime.Now - mu.RegTime).TotalMinutes; function.WriteErrMsg("新注册用户" + usertime + "分钟内不能发贴,你还需要" + minute + "分钟", "javascript:history.go(-1);"); return; } else if (lastMod != null && (DateTime.Now - lastMod.CDate).TotalMinutes < sendtime) { int minute = sendtime - (int)(DateTime.Now - lastMod.CDate).TotalMinutes; function.WriteErrMsg("你发贴太快了," + minute + "分钟后才能再次发贴", "javascript:history.go(-1);"); return; } } barMod = FillMsg(title, msg, pid, 0, cateMod); barBll.Insert(barMod); if (cateMod.Status == 1 && mu.UserID > 0 && cateMod.SendScore > 0)//是否需审核 { buser.AddMoney(mu.UserID, cateMod.SendScore, M_UserExpHis.SType.Point, string.Format("{0} {1}在版面:{2}发表主题:{3},赠送{4}分", DateTime.Now, mu.UserName, cateMod.CateName, barMod.Title, cateMod.SendScore)); } } Response.Redirect(rurl); return; }
protected void AddBar_Btn_Click(object sender, EventArgs e) { if (CateID > 0) { cateMod = cateBll.SelReturnModel(CateID); } cateMod.CateName = txtCateName.Text; cateMod.NeedLog = Convert.ToInt32(NeedLog.SelectedValue); cateMod.PostAuth = Convert.ToInt32(PostAuth.SelectedValue); cateMod.ZipImgSize = DataConverter.CLng(ZipImgSize_T.Text); cateMod.BarImage = ImageInfo_T.Text; cateMod.GType = Convert.ToInt32(GType_Rad.SelectedValue); cateMod.ParentID = Convert.ToInt32(selected_Hid.Value); cateMod.BarOwner = BarOwner_Hid.Value; cateMod.PermiBit = PostType.SelectedValue; cateMod.Desc = BarDesc_T.Text; cateMod.IsPlat = DataConverter.CLng(IsPlat_T.Text); cateMod.SendScore = Convert.ToInt32(SenderScore_T.Text); cateMod.ReplyScore = Convert.ToInt32(ReplyScore_T.Text); cateMod.Status = IsCheck_Ra.Checked ? 1 : 0; cateMod.IsShowUnaudit = CheckOpt_Ra.Checked ? 1 : 0; string returnurl = ""; if (GType.Equals("0")) { returnurl = "GuestManage.aspx"; } else { returnurl = "GuestCateMana.aspx?Type=1"; } GuestConfigInfo guestinfo = GuestConfig.GuestOption; GuestConfig config = new GuestConfig(); if (CateID <= 0) { int cateid = cateBll.Insert(cateMod); guestinfo.BarOption.Add(new BarOption() { CateID = cateid, UserTime = Convert.ToInt32(UserTime_T.Text), SendTime = Convert.ToInt32(SendTime_T.Text) }); config.Update(guestinfo); function.WriteSuccessMsg("添加成功!", returnurl); } else if (cateBll.Update(cateMod)) { BarOption baroption = guestinfo.BarOption.Find(v => v.CateID == CateID); if (baroption == null) { guestinfo.BarOption.Add(new BarOption() { CateID = CateID, UserTime = Convert.ToInt32(UserTime_T.Text), SendTime = Convert.ToInt32(SendTime_T.Text) }); } else { baroption.UserTime = Convert.ToInt32(UserTime_T.Text); baroption.SendTime = Convert.ToInt32(SendTime_T.Text); } config.Update(guestinfo); function.WriteSuccessMsg("修改成功!", returnurl); } }