Beispiel #1
0
 private string GetPath(string path)
 {
     //path = "/Product/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MMdd") + "/";
     //path = ThemeUrl.CheckURL(path);
     //return path;
     return(ThemeUrl.CheckURL(path + "/Product/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MMdd") + "/"));
 }
        private string GetPath(string path)
        {
            path = path + "/comment/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MMdd") + "/";
            path = ThemeUrl.CheckURL(path);

            return(path);
        }
Beispiel #3
0
 public string AdminMenuURL(string url)
 {
     if (url.IndexOf("http") != 0)
     {
         url = site.AdminPath + "/" + url;
         url = ThemeUrl.CheckURL(url);
     }
     return(url);
 }
Beispiel #4
0
        /// <summary>
        /// 商品页面
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="model"></param>
        /// <param name="theme"></param>
        /// <param name="urlpath"></param>
        private void P_Product(List <Lebi_Language> langs, Lebi_Theme_Page page, string urlpath)
        {
            string   url;
            string   ids   = RequestTool.RequestString("Pro_Type_id");
            DateTime time1 = RequestTool.RequestTime("time1");
            DateTime time2 = RequestTool.RequestTime("time2");

            string file      = "";
            int    pageindex = RequestTool.RequestInt("pageindex", 0);
            int    pagesize  = RequestTool.RequestInt("pagesize", 0);

            string where = "Time_Add>='" + time1 + "' and Time_Add<='" + time2 + "'";
            if (ids != "")
            {
                where += " and Pro_Type_id in (lbsql{" + ids + "})";
            }
            List <Lebi_Product> models = B_Lebi_Product.GetList(where, "", pagesize, pageindex);
            int count     = B_Lebi_Product.Counts(where);
            int pagecount = Pager.GetPageCount(pagesize, count);
            int per       = 100;

            if (pagecount > 0)
            {
                per = Convert.ToInt32(pageindex * 100 / pagecount);
            }
            List <Lebi_Site> sites = GetSites();
            Lebi_Site        site;

            foreach (Lebi_Product model in models)
            {
                foreach (Lebi_Language lang in langs)
                {
                    site = GetSite(sites, lang.Site_id);
                    file = site.Path + "/" + lang.Path + "/" + page.StaticPath + "/" + page.StaticPageName;
                    file = file.Replace("{0}", model.id.ToString());
                    file = RegexTool.ReplaceRegValue(file, @"{.*?}", "");
                    file = ThemeUrl.CheckPath(file);

                    url = page.PageName + "?" + page.PageParameter;
                    url = url.Replace("{0}", model.id.ToString());
                    url = urlpath + "/" + site.Path + "/" + lang.Path + "/" + url;
                    url = RegexTool.ReplaceRegValue(url, @"{.*?}", "");
                    url = ThemeUrl.CheckURL(url);
                    try
                    {
                        HtmlEngine.Instance.CreatHtml(url, file);
                    }
                    catch (System.Net.WebException)
                    {
                        //Log.Add(url + "---------" + file);
                        continue;
                    }
                }
            }
            Response.Write("{\"msg\":\"OK\",\"per\":\"" + per + "\"}");
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="theme"></param>
        /// <param name="skin"></param>
        /// <returns></returns>
        private string GetSkinStr(Lebi_Theme theme, Lebi_Theme_Skin skin)
        {
            string str  = "";
            string path = theme.Path_Files + "/" + skin.Path_Skin;

            path = ThemeUrl.GetFullPath(path);
            str  = HtmlEngine.ReadTxt(path);

            return(str);
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="theme"></param>
        /// <param name="skin"></param>
        /// <returns></returns>
        private string GetSkinStr(Lebi_Supplier_Skin skin)
        {
            string str  = "";
            string path = skin.Path.TrimEnd('/') + "/index.html";

            path = ThemeUrl.GetFullPath(path);
            str  = HtmlEngine.ReadTxt(path);

            return(str);
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="theme"></param>
        /// <param name="skin"></param>
        /// <returns></returns>
        private string GetSkinStr(Lebi_AdminSkin skin)
        {
            string str  = "";
            string path = site.AdminPath + "/custom/skin/" + skin.Code + ".html";

            path = ThemeUrl.GetFullPath(path);
            str  = HtmlEngine.ReadTxt(path);

            return(str);
        }
        private string GetPath()
        {
            string path_ = RequestTool.RequestSafeString("path");

            path_ = path_.Replace(".", "");
            path_ = path_.Replace("/", "");
            string path = "/" + path_ + "/";

            path = ThemeUrl.CheckURL(path);
            return(path);
        }
Beispiel #9
0
        /// <summary>
        /// 文章查看页面
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="model"></param>
        /// <param name="theme"></param>
        /// <param name="urlpath"></param>
        private void P_ArticleDetails(List <Lebi_Language> langs, Lebi_Theme_Page model, string urlpath)
        {
            string   url;
            string   file    = "";
            DateTime time1   = RequestTool.RequestTime("time1");
            DateTime time2   = RequestTool.RequestTime("time2");
            string   nodeids = RequestTool.RequestString("node");

            if (nodeids == null)
            {
                return;
            }
            int pageindex = RequestTool.RequestInt("pageindex", 0);
            int pagesize  = RequestTool.RequestInt("pagesize", 0);

            string where = "Time_Add>='" + time1 + "' and Time_Add<='" + time2 + "'";
            if (nodeids != "")
            {
                where += " and Node_id in (" + nodeids + ") ";
            }
            List <Lebi_Page> pages = B_Lebi_Page.GetList(where, "", pagesize, pageindex);
            int count     = B_Lebi_Page.Counts(where);
            int pagecount = Pager.GetPageCount(pagesize, count);
            int per       = 100;

            if (pagecount > 0)
            {
                per = Convert.ToInt32(pageindex * 100 / pagecount);
            }
            List <Lebi_Site> sites = GetSites();
            Lebi_Site        site;

            foreach (Lebi_Page page in pages)
            {
                foreach (Lebi_Language lang in langs)
                {
                    if (page.Language.ToLower().Contains(lang.Code.ToLower()))
                    {
                        site = GetSite(sites, lang.Site_id);
                        file = site.Path + "/" + lang.Path + "/" + model.StaticPath + "/" + model.StaticPageName;
                        file = file.Replace("{0}", page.id.ToString());
                        file = RegexTool.ReplaceRegValue(file, @"{.*?}", "");
                        file = ThemeUrl.CheckPath(file);

                        url = model.PageName + "?" + model.PageParameter;
                        url = url.Replace("{0}", page.id.ToString());
                        url = urlpath + "/" + site.Path + "/" + lang.Path + "/" + url;
                        url = ThemeUrl.CheckURL(url);
                        HtmlEngine.Instance.CreatHtml(url, file);
                    }
                }
            }
            Response.Write("{\"msg\":\"OK\",\"per\":\"" + per + "\"}");
        }
Beispiel #10
0
        /// <summary>
        /// 编辑页面
        /// </summary>
        public void ThemePage_Edit()
        {
            int             id    = RequestTool.RequestInt("id", 0);
            Lebi_Theme_Page model = B_Lebi_Theme_Page.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Theme_Page();
            }
            B_Lebi_Theme_Page.BindForm(model);
            //model.Name = Language.RequestString("Name");
            model.StaticPath = "/" + model.StaticPath;
            model.StaticPath = ThemeUrl.CheckURL(model.StaticPath).TrimEnd('/');
            if (model.id == 0)
            {
                if (!EX_Admin.Power("themepage_add", "添加页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Page.Add(model);
                id = B_Lebi_Theme_Page.GetMaxId();
                string action = Tag("添加页面");
                Log.Add(action, "ThemePage", model.id.ToString(), CurrentAdmin);
            }
            else
            {
                if (!EX_Admin.Power("themepage_edit", "编辑页面"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Theme_Page.Update(model);
                string action = Tag("编辑页面");
                Log.Add(action, "ThemePage", model.id.ToString(), CurrentAdmin);
            }
            //更新模板中的生成路径
            List <Lebi_Theme_Skin> pages = B_Lebi_Theme_Skin.GetList("Code='" + model.Code + "'", "");

            foreach (Lebi_Theme_Skin page in pages)
            {
                page.PageName       = model.PageName;
                page.PageParameter  = model.PageParameter;
                page.StaticPageName = model.StaticPageName;
                B_Lebi_Theme_Skin.Update(page);
            }
            //处理静态
            ThemeUrl.CreateURLRewrite();
            ShopCache.SetThemePage();
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + id + "\"}");
        }
Beispiel #11
0
        /// <summary>
        /// 生成页面皮肤
        /// 针对单个皮肤生成的情况
        /// </summary>
        /// <returns></returns>
        public void CreateSkin()
        {
            string Msg      = "";
            int    ThemeID  = 0;
            int    SkinID   = 0;
            string Content  = "";
            string SkinPath = ""; //皮肤路径
            string Path     = ""; //输入Path要包含路径及文件名

            SkinID = RequestTool.RequestInt("id", 0);
            Lebi_Theme_Skin skin = B_Lebi_Theme_Skin.GetModel(SkinID);
            Lebi_Theme      theme;

            if (skin == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            ThemeID  = skin.Theme_id;
            theme    = B_Lebi_Theme.GetModel(ThemeID);
            SkinPath = theme.Path_Files + "/" + skin.Path_Skin;
            SkinPath = ThemeUrl.GetFullPath(SkinPath);
            Content  = HtmlEngine.ReadTxt(SkinPath);
            List <Lebi_Language> langs = B_Lebi_Language.GetList("Theme_id=" + theme.id + "", "");

            if (langs.Count == 0)
            {
                Response.Write("{\"msg\":\"" + Tag("请在站点语言设置中关联此模板") + "\"}");
                return;
            }
            Site site = new Site();

            foreach (Lebi_Language lang in langs)
            {
                if (lang.Theme_id != ThemeID)
                {
                    continue;
                }
                Lebi_Site s = B_Lebi_Site.GetModel(lang.Site_id);
                if (s == null)
                {
                    Path = lang.Path + "/" + skin.PageName;
                }
                else
                {
                    Path = s.Path + lang.Path + "/" + skin.PageName;
                }
                Msg = Shop.Bussiness.Theme.CreatAspx(s, lang, theme, skin, Path, Content);
            }
            Response.Write("{\"msg\":\"" + Msg + "\"}");
        }
        private string GetPath(string path)
        {
            string path_ = RequestTool.RequestSafeString("path");

            path_ = path_.Replace(".", "");
            path_ = path_.Replace("/", "");
            if (path_ == "")
            {
                path_ = "Temp";
            }
            path = path + "/" + path_ + "/";
            path = ThemeUrl.CheckURL(path);
            return(path);
        }
Beispiel #13
0
        /// <summary>
        /// 生成自定义页面文件
        /// </summary>
        /// <param name="FileName">生成路径</param>
        /// <param name="SkinContent">内容</param>
        private void CreatAdminSkin(string FileName, string SkinContent)
        {
            FileName = ThemeUrl.GetFullPath(FileName);
            string PhysicsPath = HttpContext.Current.Server.MapPath(@"~/" + ThemeUrl.GetPath(FileName));

            if (!Directory.Exists(PhysicsPath))
            {
                Directory.CreateDirectory(PhysicsPath);
            }
            string PhysicsFileName = HttpContext.Current.Server.MapPath(FileName);

            if (System.IO.File.Exists(PhysicsFileName))
            {
                System.IO.File.Delete(PhysicsFileName);
            }
            HtmlEngine.Instance.WriteFile(PhysicsFileName, SkinContent);
        }
Beispiel #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="theme"></param>
        /// <param name="skin"></param>
        /// <returns></returns>
        private string GetSkinStr(Lebi_AdminSkin skin)
        {
            string str  = "";
            string path = "";

            if (!string.IsNullOrEmpty(RequestTool.GetConfigKey("SystemAdmin").Trim()))
            {
                path = site.AdminPath + "/custom/skin2/" + skin.Code + ".html";
            }
            else
            {
                path = site.AdminPath + "/custom/skin/" + skin.Code + ".html";
            }
            path = ThemeUrl.GetFullPath(path);
            str  = HtmlEngine.ReadTxt(path);

            return(str);
        }
Beispiel #15
0
        /// <summary>
        /// 帮助中心页面
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="model"></param>
        /// <param name="theme"></param>
        /// <param name="urlpath"></param>
        private void P_Help(List <Lebi_Language> langs, Lebi_Theme_Page model, string urlpath)
        {
            string    url;
            Lebi_Node pnode     = NodePage.GetNodeByCode("Help");
            string    file      = "";
            int       pageindex = RequestTool.RequestInt("pageindex", 0);
            int       pagesize  = RequestTool.RequestInt("pagesize", 0);

            string where = "parentid=" + pnode.id + "";
            List <Lebi_Node> nodes = B_Lebi_Node.GetList(where, "", pagesize, pageindex);
            int count     = B_Lebi_Node.Counts(where);
            int pagecount = Pager.GetPageCount(pagesize, count);
            int per       = 100;

            if (pagecount > 0)
            {
                per = Convert.ToInt32(pageindex * 100 / pagecount);
            }
            List <Lebi_Site> sites = GetSites();
            Lebi_Site        site;

            foreach (Lebi_Node node in nodes)
            {
                foreach (Lebi_Language lang in langs)
                {
                    if (node.Language.ToLower().Contains(lang.Code.ToLower()))
                    {
                        site = GetSite(sites, lang.Site_id);
                        file = site.Path + "/" + lang.Path + "/" + model.StaticPath + "/" + model.StaticPageName;
                        file = file.Replace("{0}", node.id.ToString());
                        file = RegexTool.ReplaceRegValue(file, @"{.*?}", "");
                        file = ThemeUrl.CheckPath(file);

                        url = model.PageName + "?" + model.PageParameter;
                        url = url.Replace("{0}", node.id.ToString());
                        url = urlpath + "/" + site.Path + "/" + lang.Path + "/" + url;
                        url = RegexTool.ReplaceRegValue(url, @"{.*?}", "");
                        url = ThemeUrl.CheckURL(url);
                        HtmlEngine.Instance.CreatHtml(url, file);
                    }
                }
            }
            Response.Write("{\"msg\":\"OK\",\"per\":\"" + per + "\"}");
        }
Beispiel #16
0
        /// <summary>
        /// 品牌页面
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="model"></param>
        /// <param name="theme"></param>
        /// <param name="urlpath"></param>
        private void P_Brand(Lebi_Language lang, Lebi_Theme_Page page, Lebi_Theme theme, string urlpath)
        {
            string            url;
            string            path   = lang.Path + "/" + page.StaticPath + "/" + page.StaticPageName;
            string            file   = "";
            List <Lebi_Brand> models = B_Lebi_Brand.GetList("", "");

            foreach (Lebi_Brand model in models)
            {
                url  = page.PageName + "?" + page.PageParameter;
                url  = url.Replace("{0}", model.id.ToString());
                url  = urlpath + "/" + url;
                file = path.Replace("{0}", model.id.ToString());
                file = RegexTool.ReplaceRegValue(file, @"{.*?}", "");
                url  = RegexTool.ReplaceRegValue(url, @"{.*?}", "");
                url  = ThemeUrl.CheckURL(url);
                HtmlEngine.Instance.CreatHtml(url, file);
            }
        }
Beispiel #17
0
        /// <summary>
        /// 单个页面
        /// </summary>
        /// <param name="lang"></param>
        private void OnePage(List <Lebi_Language> langs, Lebi_Theme_Page model, string urlpath)
        {
            string           url   = "";
            string           file  = "";
            List <Lebi_Site> sites = GetSites();
            Lebi_Site        site;

            foreach (Lebi_Language lang in langs)
            {
                site = GetSite(sites, lang.Site_id);

                file = site.Path + "/" + lang.Path + "/" + model.StaticPath + "/" + model.StaticPageName;
                file = RegexTool.ReplaceRegValue(file, @"{.*?}", "");
                file = ThemeUrl.CheckPath(file);
                url  = urlpath + "/" + site.Path + "/" + lang.Path + "/" + model.PageName;
                url  = RegexTool.ReplaceRegValue(url, @"{.*?}", "");
                url  = ThemeUrl.CheckURL(url);
                HtmlEngine.Instance.CreatHtml(url, file);
            }
            Response.Write("{\"msg\":\"OK\",\"per\":\"100\"}");
        }
Beispiel #18
0
 public string MenuUrl(string url, int t)
 {
     if (url.IndexOf("http") == 0)
     {
         return(url);
     }
     url = site.AdminPath + "/" + url;
     if (t == 1)
     {
         if (url.Contains("?"))
         {
             url = url + "&desk=1";
         }
         else
         {
             url = url + "?desk=1";
         }
     }
     url = ThemeUrl.CheckURL(url);
     return(url);
 }
Beispiel #19
0
        /// <summary>
        /// 生成单个自定义页面
        /// </summary>
        public void AdminSkin_Create()
        {
            int            id    = RequestTool.RequestInt("id", 0);
            Lebi_AdminSkin model = B_Lebi_AdminSkin.GetModel(id);

            if (model == null)
            {
                model = new Lebi_AdminSkin();
            }
            string FileName = site.AdminPath + "/custom/" + model.Code + ".aspx";

            FileName = ThemeUrl.GetFullPath(FileName);
            //string PhysicsPath = HttpContext.Current.Server.MapPath(@"~/" + ThemeUrl.GetPath(FileName));
            //if (!Directory.Exists(PhysicsPath))
            //{
            //    Directory.CreateDirectory(PhysicsPath);
            //}
            string PhysicsFileName = HttpContext.Current.Server.MapPath(FileName);

            if (System.IO.File.Exists(PhysicsFileName))
            {
                System.IO.File.Delete(PhysicsFileName);
            }
            string SkinContent = Request["SkinContent"];

            SkinContent = Shop.Bussiness.Theme.AdminSkin_DoCodeConvert(SkinContent);
            string top = "<%@ Page Language=\"C#\" AutoEventWireup=\"true\" CodeBehind=\"Shop.Bussiness.PageBase.AdminCustomPageBase.cs\" Inherits=\"Shop.Bussiness.AdminCustomPageBase\" %>\r\n";

            top        += "<%@ Import Namespace=\"DB.LebiShop\" %>\r\n";
            top        += "<%@ Import Namespace=\"Shop.Bussiness\" %>\r\n";
            top        += "<%@ Import Namespace=\"Shop.Model\" %>\r\n";
            top        += "<%@ Import Namespace=\"System.Collections.Generic\" %>\r\n";
            SkinContent = top + SkinContent;
            HtmlEngine.Instance.WriteFile(PhysicsFileName, SkinContent);
            string result = "{\"msg\":\"OK\"}";

            Response.Write(result);
        }
Beispiel #20
0
        /// <summary>
        /// 文章列表页面
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="model"></param>
        /// <param name="theme"></param>
        /// <param name="urlpath"></param>
        private void P_Article(Lebi_Language lang, Lebi_Theme_Page model, Lebi_Theme theme, string urlpath)
        {
            string url;
            string nodeids = RequestTool.RequestString("node");

            if (nodeids == null)
            {
                return;
            }
            string           path   = lang.Path + "/" + model.StaticPath + "/" + model.StaticPageName;
            string           pathto = "";
            List <Lebi_Node> nodes  = B_Lebi_Node.GetList("id in (lbsql{" + nodeids + "}) and Language_Code like '%" + lang.Code + "%'", "");

            foreach (Lebi_Node node in nodes)
            {
                url    = model.PageName + "?" + model.PageParameter;
                url    = url.Replace("{0}", node.id.ToString());
                url    = urlpath + "/" + url;
                pathto = path.Replace("{0}", node.id.ToString());
                url    = ThemeUrl.CheckURL(url);
                HtmlEngine.Instance.CreatHtml(url, pathto);
            }
        }
Beispiel #21
0
        /// <summary>
        /// 下载头像
        /// </summary>
        /// <param name="url"></param>
        /// <param name="pro"></param>
        /// <returns></returns>
        public static string DownLoadImage(string url)
        {
            BaseConfig conf = ShopCache.GetBaseConfig();

            System.Net.WebClient myWebClient = new System.Net.WebClient();
            string ServerPath = AppDomain.CurrentDomain.BaseDirectory;
            string savepath   = ShopCache.GetBaseConfig().UpLoadPath + "/userface/" + DateTime.Now.ToString("yyyy") + "/user/";

            savepath = ThemeUrl.CheckURL(savepath);
            if (!Directory.Exists(ServerPath + savepath))   //如果路径不存在,则创建
            {
                Directory.CreateDirectory(ServerPath + savepath);
            }
            string name     = DateTime.Now.ToString("yyMMddssfff") + "_w$h_.jpg";
            string OldImage = savepath + name;

            if (File.Exists(OldImage))
            {
                File.Delete(OldImage);
            }
            myWebClient.DownloadFile(url, ServerPath + OldImage);
            return(OldImage);
        }
Beispiel #22
0
        /// <summary>
        ///生成邮件任务
        /// </summary>
        public void EmailTask_Create()
        {
            if (!EX_Admin.Power("emailtask_edit", "群发邮件"))
            {
                AjaxNoPower();
                return;
            }
            int            id    = RequestTool.RequestInt("id", 0);
            Lebi_EmailTask model = B_Lebi_EmailTask.GetModel(id);

            if (model == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            model.EmailContent  = Language.RequestString("EmailContent");
            model.EmailTitle    = Language.RequestString("EmailTitle");
            model.UserLevel_ids = RequestTool.RequestString("UserLevel_ids");
            model.Time_task     = RequestTool.RequestTime("Time_task");
            B_Lebi_EmailTask.Update(model);
            //=================
            //处理图片
            string          content = model.EmailContent;
            Regex           r       = new Regex(@"[sS][rR][cC]=\\\"".*?\\\""", RegexOptions.Singleline);
            MatchCollection mc      = r.Matches(content);
            string          temp    = "";
            string          src     = "";

            foreach (Match m in mc)
            {
                temp = m.Value;

                src = RegexTool.GetRegValue(temp, @"[sS][rR][cC]=\\\""(.*?)\\\""");
                if (!Regex.IsMatch(src.ToLower(), @"http://.*?", RegexOptions.IgnoreCase))
                //if (!src.ToLower().Contains("http://"))
                {
                    src     = SYS.Domain + "/" + src;
                    src     = ThemeUrl.CheckURL(src);
                    content = content.Replace(temp, "src=\\\"" + src + "\"");
                }
            }
            //处理图片结束
            //====================
            List <Lebi_User> users = B_Lebi_User.GetList("UserLevel_id in (" + model.UserLevel_ids + ")", "");
            Lebi_Email       email = new Lebi_Email();

            foreach (Lebi_User user in users)
            {
                email.Content             = Language.Content(content, user.Language);
                email.Title               = Language.Content(model.EmailTitle, user.Language);
                email.Time_Task           = model.Time_task;
                email.User_id             = user.id;
                email.User_Name           = user.UserName;
                email.EmailTask_id        = model.id;
                email.Email               = user.Email;
                email.Count_send          = 0;
                email.Type_id_EmailStatus = 270;//排队中的邮件
                B_Lebi_Email.Add(email);
            }
            model.IsSubmit = 1;
            B_Lebi_EmailTask.Update(model);
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #23
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopProductCategory";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = RequestTool.RequestInt("id", 0);          //商家ID
            cid       = RequestTool.RequestInt("cid", 0);         //商品分类
            list      = RequestTool.RequestString("list");        //列表或网格
            sort      = RequestTool.RequestString("sort");        //排序
            keyword   = RequestTool.RequestSafeString("keyword"); //关键词
            pageindex = RequestTool.RequestInt("page", 1);
            parentcid = 0;
            supplier  = B_Lebi_Supplier.GetModel("id = " + id);
            if (supplier == null)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int Supplier_id = supplier.User_id;

            if (cid != 0)
            {
                producttype = B_Lebi_Supplier_ProductType.GetModel(cid);
                if (producttype.parentid > 0)
                {
                    parentcid = producttype.parentid;
                }
                else
                {
                    parentcid = cid;
                }
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a><em>&raquo;</em><a href=\"" + URL("P_ShopProductCategory", "" + id + "," + cid + "," + list + "," + sort + ",1," + keyword + "") + "\"><span>" + Tag("商品列表") + "</span></a>";

            where = ProductWhere + " and Type_id_ProductType = 320 and Supplier_id = " + id + "";
            if (cid > 0)
            {
                where += " and " + ShopCategoryWhere(cid);
            }
            if (keyword != "")
            {
                //增加空格划词搜索 by kingdge 2013-09-18
                string wherekeyword = "";
                if (keyword.IndexOf(" ") > -1)
                {
                    string[] keywordsArr;
                    keywordsArr = keyword.Split(new char[1] {
                        ' '
                    });
                    foreach (string keywords in keywordsArr)
                    {
                        if (keywords != "")
                        {
                            if (wherekeyword == "")
                            {
                                wherekeyword = "Name like lbsql{'%" + keywords + "%'}";
                            }
                            else
                            {
                                wherekeyword += " and Name like lbsql{'%" + keywords + "%'}";
                            }
                        }
                    }
                }
                else
                {
                    wherekeyword = "Name like lbsql{'%" + keyword + "%'}";
                }
                where += " and ((" + wherekeyword + ") or Number like lbsql{'%" + keyword + "%'} or Code like lbsql{'%" + keyword + "%'})";
                path  += "<em>&raquo;</em><a class=\"text\"><span>“" + keyword + "”</span></a>";
            }
            if (sort == "")
            {
                sort = "1";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ShopProductCategory", id + "," + cid + "," + list + "," + sort + ",{0}," + keyword + "");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage = URL("P_ShopProductCategory", id + "," + cid + "," + list + "," + sort + "," + (pageindex + 1) + "," + keyword + "");
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
            //跳转至设置的皮肤页面
            Lebi_Supplier_Skin skin = B_Lebi_Supplier_Skin.GetModel(supplier.Supplier_Skin_id);

            if (skin != null)
            {
                string filename = HttpContext.Current.Request.Url.AbsolutePath.ToString().ToLower();
                if (!filename.Contains("default" + skin.id + ".aspx") && filename.Contains("default.aspx"))
                {
                    string tourl = Shop.Bussiness.Site.Instance.WebPath + "/" + CurrentLanguage.Path + "/shop/default" + skin.id + ".aspx?id=" + supplier.id + "&cid=" + cid + "&list=" + list + "&sort=" + sort + "&page=" + pageindex + "&keyword=" + keyword;
                    tourl = ThemeUrl.CheckPath(tourl);
                    Response.Redirect(tourl);
                    //Response.Write(tourl);
                }
            }
        }
Beispiel #24
0
        /// <summary>
        /// 编辑商家
        /// </summary>
        public void User_Edit()
        {
            if (!EX_Admin.Power("supplier_user_edit", "编辑商家"))
            {
                AjaxNoPower();
                return;
            }
            int       id                  = RequestTool.RequestInt("id", 0);
            string    UserName            = RequestTool.RequestString("UserName");
            int       Level_id            = RequestTool.RequestInt("Level_id", 0);
            int       IsCash              = RequestTool.RequestInt("IsCash", 0);
            int       IsSupplierTransport = RequestTool.RequestInt("IsSupplierTransport", 0);
            Lebi_User user                = new Lebi_User();

            if (UserName != "")
            {
                user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"帐号不存在\"}");
                    return;
                }
                string where = "User_id='" + user.id + "'";
                if (id > 0)
                {
                    where += " and id!=" + id + "";
                }
                int count = B_Lebi_Supplier.Counts(where);
                if (count > 0)
                {
                    Response.Write("{\"msg\":\"此帐号已注册\"}");
                    return;
                }
            }
            if (IsCash == 1 && IsSupplierTransport == 0)
            {
                Response.Write("{\"msg\":\"独立收款的商家必须独立发货\"}");
                return;
            }
            Lebi_Supplier model = B_Lebi_Supplier.GetModel(id);

            //model.IsCash = 0;
            //model.IsSupplierTransport = 0;
            if (model == null)
            {
                model = new Lebi_Supplier();
            }
            B_Lebi_Supplier.SafeBindForm(model);
            model.Name              = Language.RequestString("Name");
            model.Description       = Language.RequestString("Description");
            model.ClassName         = Language.RequestString("ClassName");
            model.SEO_Title         = Language.RequestString("SEO_Title");
            model.SEO_Keywords      = Language.RequestString("SEO_Keywords");
            model.SEO_Description   = Language.RequestString("SEO_Description");
            model.Supplier_Group_id = Level_id;
            if (model.id == 0)
            {
                Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(Level_id);
                if (group != null)
                {
                    model.Supplier_Group_id = group.id;
                    model.Money_Service     = group.ServicePrice;
                    model.Money_Margin      = group.MarginPrice;
                    model.BillingDays       = group.BillingDays;
                }
                model.User_id  = user.id;
                model.UserName = user.UserName;
                B_Lebi_Supplier.Add(model);
                model.id = B_Lebi_Supplier.GetMaxId();
            }
            else
            {
                if (IsSupplierTransport != model.IsSupplierTransport)
                {
                    string sql = "update [Lebi_Order_Product] set IsSupplierTransport=" + model.IsSupplierTransport + " where Supplier_id=" + id + "";
                    Common.ExecuteSql(sql);
                    string sql2 = "update [Lebi_Product] set IsSupplierTransport=" + model.IsSupplierTransport + " where Supplier_id=" + id + "";
                    Common.ExecuteSql(sql2);
                }
                user = B_Lebi_User.GetModel(model.User_id);
                B_Lebi_Supplier.Update(model);
            }
            if (model.Type_id_SupplierStatus == 442)
            {
                try
                {
                    Lebi_Supplier_User suser = B_Lebi_Supplier_User.GetModel("User_id=" + model.User_id + " and Supplier_id=" + model.id + "");
                    if (suser == null)
                    {
                        suser            = new Lebi_Supplier_User();
                        suser.RemarkName = user.RealName;
                        if (suser.RemarkName == "")
                        {
                            suser.RemarkName = user.UserName;
                        }
                        suser.Supplier_id = model.id;
                        suser.User_id     = model.User_id;
                        suser.Type_id_SupplierUserStatus = 9011;
                        B_Lebi_Supplier_User.Add(suser);
                    }
                    else
                    {
                        suser.Supplier_id = model.id;
                        suser.User_id     = model.User_id;
                        suser.Type_id_SupplierUserStatus = 9011;
                        B_Lebi_Supplier_User.Update(suser);
                    }
                }
                catch
                { }
            }
            if (model.Domain != "")
            {
                ThemeUrl.CreateURLRewrite_shop();
            }
            if (model.Type_id_SupplierStatus == 444) //如果状态冻结 商品全部冻结 by lebi.kingdge 2015-02-09
            {
                string sql = "update [Lebi_Product] set Type_id_ProductStatus=103 where Supplier_id=" + id + "";
                Common.ExecuteSql(sql);
            }
            Log.Add("编辑商家信息", "Supplier_User", id.ToString(), CurrentAdmin, model.UserName);
            string result = "{\"msg\":\"OK\", \"id\":\"" + model.id + "\"}";

            Response.Write(result);
        }
Beispiel #25
0
        /// <summary>
        /// 忘记密码的处理
        /// </summary>
        public void User_forgetpwd()
        {
            int    type       = RequestTool.RequestInt("type", 0);
            string Email_     = RequestTool.RequestSafeString("Email");
            string UserName   = RequestTool.RequestSafeString("UserName");
            string verifycode = RequestTool.RequestString("verifycode");

            if (SYS.Verifycode_ForgetPassword == "1")
            {
                if (CurrentCheckCode != verifycode)
                {
                    Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}");
                    return;
                }
            }
            if (type == 0)
            {
                //发送邮件
                Lebi_User user = B_Lebi_User.GetModel("Email=lbsql{'" + Email_ + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                try
                {
                    //发送邮件
                    Email.SendEmail_forgetpwd(user, CurrentTheme);
                    //发送短信
                    SMS.SendSMS_forgetpwd(user);
                }
                catch (Exception ex)
                {
                    Response.Write("{\"msg\":\"" + ex.Message + "\"}");
                }
                Response.Write("{\"msg\":\"OK\"}");
            }
            else if (type == 1)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                Lebi_User_Answer user_answer = B_Lebi_User_Answer.GetModel("User_id= " + user.id);
                if (user_answer == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("未设置安全问题") + "\"}");
                    return;
                }
                BaseConfig conf = ShopCache.GetBaseConfig();
                user.CheckCode = EX_User.MD5(System.DateTime.Now.ToString() + conf.InstallCode);
                B_Lebi_User.Update(user);
                Response.Write("{\"msg\":\"OK\",\"url\":\"" + ThemeUrl.GetURL("P_FindPassword", "", "", user.Language) + "?id=" + user.id + "&v=" + user.CheckCode + "&type=1\"}");
            }
            else if (type == 2)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                if (user.MobilePhone == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("未设置手机号码") + "\"}");
                    return;
                }
                Random Random  = new Random();
                int    RandNum = Random.Next(100000, 999999);
                user.Password = EX_User.MD5(RandNum.ToString());
                B_Lebi_User.Update(user);
                //发送短信
                SMS.SendSMS_newpwd(user, RandNum.ToString());
                Response.Write("{\"msg\":\"OK\",\"url\":\"" + ThemeUrl.GetURL("P_Login", "", "", user.Language) + "\"}");
            }
        }
 private string GetPath(string path)
 {
     path = path + "/";
     path = ThemeUrl.CheckURL(path);
     return(path);
 }
        public void LoadPage()
        {
            if (!AjaxLoadCheck())
            {
                return;
            }
            string     msg      = "";
            string     name     = "";
            int        theme_id = RequestTool.RequestInt("theme_id", 0);
            Lebi_Theme theme    = B_Lebi_Theme.GetModel(theme_id);

            if (theme == null)
            {
                Response.Write("{\"msg\":\"" + Language.Tag("参数错误") + "\"}");
                return;
            }
            HttpFileCollection files = HttpContext.Current.Request.Files;
            BaseConfig         conf  = ShopCache.GetBaseConfig();
            B_WaterConfig      bc    = new B_WaterConfig();
            WaterConfig        mx    = bc.LoadConfig();

            if (files.Count > 0)
            {
                ///'检查文件扩展名字
                HttpPostedFile postedFile = files[0];
                string         savepath = GetPath(theme.Path_Advert);
                string         fileName, fileExtension;
                fileName      = System.IO.Path.GetFileName(postedFile.FileName);
                fileExtension = System.IO.Path.GetExtension(fileName);
                if (conf.UpLoadSaveName == "" || conf.UpLoadSaveName == null)
                {
                    conf.UpLoadSaveName = "0";
                }
                if (conf.UpLoadSaveName == "0")
                {
                    name = DateTime.Now.ToString("yyMMddssfff") + "_w$h_";
                }
                else
                {
                    name = System.IO.Path.GetFileNameWithoutExtension(fileName) + "_w$h_";
                }
                name = conf.UpLoadRName + name + fileExtension;
                int status = ImageHelper.SaveImage(postedFile, savepath, name);
                if (status != 290)
                {
                    msg = Language.Tag(EX_Type.TypeName(status));
                    Response.Write("{\"msg\":\"" + msg + "\"}");
                    return;
                }

                string OldImage = savepath + name;
                OldImage = ThemeUrl.CheckURL(OldImage);
                string ImageSmall = name.Replace("_w$h_", "_100$100_");
                string size       = "100$100";


                ImageHelper.UPLoad(OldImage, savepath, ImageSmall, Convert.ToInt32(conf.ImageSmallWidth), Convert.ToInt32(conf.ImageSmallHeight));

                //写入数据库
                Lebi_Image model = new Lebi_Image();
                model.Image     = savepath + name;
                model.Keyid     = 0;
                model.Size      = size;
                model.TableName = "temp";
                B_Lebi_Image.Add(model);
                msg = "OK";
                Response.Write("{\"msg\":\"" + msg + "\",\"url\":\"" + savepath + name + "\",\"Image\":\"" + name + "\",\"ImageSmall\":\"" + ImageSmall + "\"}");
                return;
            }
            msg = Language.Tag("没有选择任何文件", "");
            Response.Write("{\"msg\":\"" + msg + "\"}");
        }
Beispiel #28
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopIndex";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = RequestTool.RequestInt("id", 0);          //商家ID
            cid       = RequestTool.RequestInt("cid", 0);         //商品分类
            list      = RequestTool.RequestString("list");        //列表或网格
            sort      = RequestTool.RequestString("sort");        //排序
            key       = RequestTool.RequestSafeString("keyword"); //关键词
            pageindex = RequestTool.RequestInt("page", 1);
            parentcid = 0;
            supplier  = B_Lebi_Supplier.GetModel("id = " + id);
            if (supplier == null)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int Supplier_id = supplier.User_id;

            if (cid != 0)
            {
                producttype = B_Lebi_Supplier_ProductType.GetModel(cid);
                if (producttype.parentid > 0)
                {
                    parentcid = producttype.parentid;
                }
                else
                {
                    parentcid = cid;
                }
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a>";

            where = ProductWhere + " and Supplier_id = " + id + "";
            if (cid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + cid + ",',','+Supplier_ProductType_ids+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Supplier_ProductType_ids+',','," + cid + ",')>0";
                }
            }
            if (key != "")
            {
                where += " and Name like '%" + key + "%'";
            }
            if (sort == "")
            {
                sort = "1";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ShopIndex", id + "," + cid + "," + list + "," + sort + ",{0}," + key + "");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
            NextPage = URL("P_ShopIndex", id + "," + cid + "," + list + "," + sort + "," + (pageindex + 1) + "," + key + "");
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
            if (CurrentSite.IsMobile == 0)  //只针对PC站点 lebi.kingdge 2015-12-30
            {
                //跳转至设置的皮肤页面
                Lebi_Supplier_Skin skin = B_Lebi_Supplier_Skin.GetModel(supplier.Supplier_Skin_id);
                if (skin != null)
                {
                    string filename = HttpContext.Current.Request.Url.AbsolutePath.ToString().ToLower();
                    if (!filename.Contains("default" + skin.id + ".aspx"))
                    {
                        string tourl = Shop.Bussiness.Site.Instance.WebPath + "/" + CurrentLanguage.Path + "/shop/default" + skin.id + ".aspx?id=" + supplier.id + "&cid=" + cid + "&list=" + list + "&sort=" + sort + "&page=" + pageindex;
                        tourl = ThemeUrl.CheckPath(tourl);
                        Response.Redirect(tourl);
                        //Response.Write(tourl);
                    }
                }
            }
        }
 private string GetPath(string path)
 {
     path = path + "/userfiles/images/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MMdd") + "/";
     path = ThemeUrl.CheckURL(path);
     return(path);
 }