Esempio n. 1
0
    public M_Guest_Bar FillMsg(string title, string msg, M_GuestBookCate cmode)
    {
        string base64 = StrHelper.CompressString(msg);

        if (base64.Length > 40000)
        {
            function.WriteErrMsg("发贴失败,原因:内容过长,请减少内容文字");
        }
        M_UserInfo  mu    = tpuser_Bll.GetLogin("匿名用户");//barBll.GetUser();
        M_Guest_Bar model = new M_Guest_Bar();

        model.MsgType    = 1;
        model.Status     = cmode.Status > 1 ? (int)ZLEnum.ConStatus.UnAudit : (int)ZLEnum.ConStatus.Audited;//判断贴吧是否开启审核,如果是就默认设置为未审核
        model.CUser      = mu.UserID;
        model.CUName     = mu.HoneyName;
        model.R_CUName   = mu.HoneyName;
        model.Title      = title.Trim();
        model.SubTitle   = GetSubTitle(ref msg);
        model.MsgContent = base64;
        model.CateID     = cmode.CateID;
        model.IP         = EnviorHelper.GetUserIP();
        model.IDCode     = mu.UserID <= 0 ? mu.WorkNum : mu.UserID.ToString();
        string ipadd = IPScaner.IPLocation(model.IP);

        ipadd           = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd;
        model.IP        = model.IP + "|" + ipadd;
        model.Pid       = 0;
        model.ReplyID   = 0;
        model.ColledIDS = "";
        return(model);
    }
Esempio n. 2
0
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            if (Mid > 0)
            {
                desMod = desBll.SelReturnModel(Mid);
            }
            else
            {
                desMod = new M_Logo_Design();
            }
            desMod.Alias       = Alias_T.Text;
            desMod.LogoContent = StrHelper.CompressString(Save_Hid.Value);
            ImgHelper imghelp = new ImgHelper();

            System.Drawing.Bitmap bmp = imghelp.Base64ToImg(Base64_Hid.Value);
            //用于减小尺寸
            desMod.PreviewImg = "data:image/png;base64," + imghelp.ImgToBase64ByImage(bmp);

            if (desMod.ID > 0)
            {
                desMod.ZType = 1; desBll.UpdateByID(desMod);
            }
            else
            {
                M_AdminInfo adminMod = B_Admin.GetLogin();
                desMod.ZType   = 1;
                desMod.ZStatus = 99;
                desMod.AdminID = adminMod.AdminId;
                desMod.ID      = desBll.Insert(desMod);
            }
            SnsHelper.UpdateModel(desMod.ID
                                  , new string[] { "BackGround" }
                                  , new string[] { BKUrl_T.Text.Trim() });
            function.WriteSuccessMsg("操作成功", "DesTlpList.aspx");
        }
Esempio n. 3
0
        public M_Guest_Bar FillBarMsg(string msg, int pid, int rid = 0)
        {
            string base64 = StrHelper.CompressString(msg);

            if (base64.Length > 40000)
            {
                function.WriteErrMsg("发贴失败,原因:内容过长,请减少内容文字");
            }
            M_UserInfo  mu     = buser.GetLogin();
            M_Guest_Bar parent = barBll.SelReturnModel(pid);
            M_Guest_Bar model  = new M_Guest_Bar();

            model.MsgType    = 1;
            model.Status     = (int)ZLEnum.ConStatus.Audited;
            model.CUser      = mu.UserID;
            model.CUName     = mu.HoneyName;
            model.R_CUName   = mu.HoneyName;
            model.IDCode     = mu.UserID <= 0 ? mu.WorkNum : mu.UserID.ToString();
            model.MsgContent = base64;
            model.Pid        = pid;
            model.ReplyID    = rid;
            model.CateID     = parent.CateID;
            model.IP         = EnviorHelper.GetUserIP();
            string ipadd = IPScaner.IPLocation(model.IP);

            ipadd           = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd;
            model.IP        = model.IP + "|" + ipadd;
            model.ColledIDS = "";
            //AddUserExp(mu, parent.CateID, parent.Title);
            return(model);
        }
Esempio n. 4
0
 protected void Save_Btn_Click(object sender, EventArgs e)
 {
     desMod             = desBll.SelReturnModel(Mid);
     desMod.LogoContent = StrHelper.CompressString(Save_Hid.Value);
     desBll.UpdateByID(desMod);
     function.WriteSuccessMsg("操作成功,已保存至服务端");
 }
Esempio n. 5
0
        protected void Save_Btn_Click(object sender, EventArgs e)
        {
            //B_User.CheckIsLogged(Request.RawUrl);
            mu = SnsHelper.GetLogin();
            //if (Mid > 0)
            //{
            //    desMod = desBll.SelReturnModel(Mid);
            //}
            //else { desMod = new M_Logo_Design(); }
            desMod             = new M_Logo_Design();
            desMod.LogoContent = StrHelper.CompressString(Save_Hid.Value);
            ImgHelper imghelp = new ImgHelper();

            System.Drawing.Bitmap bmp = imghelp.Base64ToImg(Base64_Hid.Value);
            //用于减小尺寸
            desMod.PreviewImg = "data:image/png;base64," + imghelp.ImgToBase64ByImage(bmp);

            //if (desMod.ID > 0) { desBll.UpdateByID(desMod); }
            //else
            //{
            desMod.ZType    = 0;
            desMod.ZStatus  = 99;
            desMod.UserID   = mu.UserID;
            desMod.UserName = mu.UserName;
            desMod.ID       = desBll.Insert(desMod);
            //}
            //CreateOrder(desMod);
            CreateCart(desMod);
        }
Esempio n. 6
0
 protected void Save_Btn_Click(object sender, EventArgs e)
 {
     if (Mid > 0)
     {
         desMod = desBll.SelReturnModel(Mid);
     }
     else
     {
         desMod = new M_Logo_Design();
     }
     desMod.LogoContent = StrHelper.CompressString(Save_Hid.Value);
     desMod.PreviewImg  = Base64_Hid.Value;
     if (desMod.ID > 0)
     {
         desBll.UpdateByID(desMod);
     }
     else
     {
         desMod.ZType    = 0;
         desMod.ZStatus  = 99;
         desMod.UserID   = mu.UserID;
         desMod.UserName = mu.UserName;
         desMod.ID       = desBll.Insert(desMod);
     }
     function.WriteSuccessMsg("操作成功", "Design.aspx?ID=" + desMod.ID);
 }
Esempio n. 7
0
    protected void Save_Btn_Click(object sender, EventArgs e)
    {
        int    Mid     = DataConvert.CLng(Mid_Hid.Value);
        string content = Content_Hid.Value;

        //-------------------

        desMod             = desBll.SelReturnModel(Mid);
        desMod.LogoContent = StrHelper.CompressString(Content_Hid.Value);
        desMod.ZStatus     = 99;
        desBll.UpdateByID(desMod);
        Response.Redirect(Request.RawUrl);
    }
Esempio n. 8
0
    protected void Comp_Click(object sender, EventArgs e)
    {
        DataTable dt = SqlHelper.ExecuteTable("SELECT ID,MsgContent FROM ZL_Guest_Bar");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            DataRow dr = dt.Rows[i];
            dr["MsgContent"] = StrHelper.CompressString(dr["MsgContent"].ToString());
            SqlParameter[] sp  = new SqlParameter[] { new SqlParameter("msg", dr["MsgContent"].ToString()) };
            string         sql = "UPDATE ZL_Guest_Bar SET MsgContent=@msg WHERE ID=" + dr["ID"];
            SqlHelper.ExecuteSql(sql, sp);
        }
        function.WriteErrMsg("操作完成");
    }
Esempio n. 9
0
        private M_Guest_Bar FillMsg(string title, string msg, int pid, int rid = 0, M_GuestBookCate catemod = null)
        {
            if (pid > 0)
            {
                M_Guest_Bar pmod = barBll.SelReturnModel(pid);
                catemod = cateBll.SelReturnModel(pmod.CateID);
            }
            string base64 = StrHelper.CompressString(msg);

            if (base64.Length > 40000)
            {
                throw new Exception("取消修改,原因:内容过长,请减少内容");
            }
            M_UserInfo  mu    = tuBll.GetLogin("匿名用户"); //barBll.GetUser();
            M_Guest_Bar model = new M_Guest_Bar();

            model.MsgType    = 1;
            model.Status     = catemod.Status > 1 ? (int)ZLEnum.ConStatus.UnAudit : (int)ZLEnum.ConStatus.Audited;//判断贴吧是否开启审核,如果是就默认设置为未审核
            model.CUser      = mu.UserID;
            model.CUName     = mu.HoneyName;
            model.R_CUName   = mu.HoneyName;
            model.Title      = title;
            model.SubTitle   = GetSubTitle(ref msg);
            model.MsgContent = base64;
            model.CateID     = catemod.CateID;
            model.IP         = IPScaner.GetUserIP(HttpContext);
            string ipadd = IPScaner.IPLocation(model.IP);

            ipadd           = ipadd.IndexOf("本地") > 0 ? "未知地址" : ipadd;
            model.IP        = model.IP + "|" + ipadd;
            model.Pid       = pid;
            model.ReplyID   = rid;
            model.ColledIDS = "";
            model.IDCode    = mu.UserID == 0 ? mu.WorkNum : mu.UserID.ToString();
            model.CDate     = DateTime.Now;
            return(model);
        }
Esempio n. 10
0
    protected void PostMsg_Btn_Click(object sender, EventArgs e)
    {
        string msg       = MsgContent_T.Text;
        string base64Msg = StrHelper.CompressString(msg);

        if (Pid > 0)
        {
            barMod            = barBll.SelReturnModel(Pid);
            barMod.Title      = MsgTitle_T.Text;
            barMod.SubTitle   = GetSubTitle(ref msg);
            barMod.MsgContent = base64Msg;
            barBll.UpdateByID(barMod);
            Response.Redirect(B_Guest_Bar.CreateUrl(2, PostID));
        }
        else
        {
            if (string.IsNullOrEmpty(MsgTitle_T.Text))
            {
                function.WriteErrMsg("贴子标题不能为空!");
            }
            if (!ZoomlaSecurityCenter.VCodeCheck(Request.Form["VCode_hid"], VCode.Text.Trim()))
            {
                function.WriteErrMsg("验证码不正确");
            }
            GetSubTitle(ref msg);
            M_UserInfo mu = tpuserBll.GetLogin(); //buser.GetLogin();
            if (mu.Status != 0)
            {
                function.WriteErrMsg("您的账户已被锁定,无法进行发帖、回复等操作!");
            }
            M_Guest_Bar lastMod   = barBll.SelLastModByUid(mu);
            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 (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);");
            }

            M_GuestBookCate catemod = guestBll.GetCate(Cid);
            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(1, Cid));
            }
            else
            {
                Response.Redirect(B_Guest_Bar.CreateUrl(1, Cid));
            }
        }
    }
Esempio n. 11
0
        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;
        }