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); }
public string AdminMenuURL(string url) { if (url.IndexOf("http") != 0) { url = site.AdminPath + "/" + url; url = ThemeUrl.CheckURL(url); } return(url); }
/// <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 + "\"}"); }
/// <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 + "\"}"); }
private string GetPath() { string path_ = RequestTool.RequestSafeString("path"); path_ = path_.Replace(".", ""); path_ = path_.Replace("/", ""); string path = "/" + path_ + "/"; path = ThemeUrl.CheckURL(path); return(path); }
/// <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 + "\"}"); }
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); }
/// <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 + "\"}"); }
/// <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); } }
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); }
/// <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\"}"); }
/// <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); }
/// <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); } }
private string GetPath(string path) { path = path + "/userfiles/images/" + DateTime.Now.ToString("yyyy") + "/" + DateTime.Now.ToString("MMdd") + "/"; 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 + "\"}"); }
private string GetPath(string path) { path = path + "/"; path = ThemeUrl.CheckURL(path); return(path); }
/// <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\"}"); }