public static string GetURL(string code, string ParaStr, string url, string langcode) { Lebi_Site site = new Lebi_Site(); if (ShopPage.IsAPP() || ShopPage.IsWechat() || ShopPage.IsWap()) { site = B_Lebi_Site.GetModel("IsMobile = 1 order by Sort asc"); if (site == null) { site = B_Lebi_Site.GetModel("IsMobile = 0 order by Sort asc"); } } else { site = B_Lebi_Site.GetModel("IsMobile = 0 order by Sort asc"); if (site == null) { site = B_Lebi_Site.GetModel("IsMobile = 1 order by Sort asc"); } } Lebi_Language lang = B_Lebi_Language.GetModel("Site_id =" + site.id + " and Code = '" + langcode + "'"); if (lang == null) { lang = new Lebi_Language(); } return(GetURL(code, ParaStr, url, lang)); }
/// <summary> /// 关于我们页面/新闻/文章 /// </summary> public static bool Greate_InfoPage(Lebi_Page model, Lebi_Theme_Page page) { Site site = new Site(); string[] langcodes = model.Language.Split(','); string urlpath = "http://" + HttpContext.Current.Request.Url.Authority + site.WebPath; string url = ""; string file = ""; foreach (string langcode in langcodes) { Lebi_Language lang = B_Lebi_Language.GetModel("Code='" + langcode + "'"); string path = lang.Path + "/" + page.StaticPath + "/" + page.StaticPageName; 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); } return(true); }
/// <summary> /// 载入主题 /// </summary> /// <param name="themecode"></param> /// <param name="siteid"></param> /// <param name="languagecode"></param> /// <param name="pcode"></param> /// <param name="checklogin">是否检查用户登录</param> public void LoadTheme(string themecode, int siteid, string languagecode, string pcode, bool checklogin) { CurrentSite_ = B_Lebi_Site.GetModel(siteid); if (ShopCache.GetMainSite().id == CurrentSite_.id || CurrentSite_.Domain == "") { IsMainSite = true; } CurrentLanguage_ = B_Lebi_Language.GetModel("Code='" + languagecode + "' and Site_id=" + siteid + ""); if (CurrentLanguage_ == null) { CurrentLanguage_ = new Lebi_Language(); } if (IsMainSite) { CurrentLanguage_.Path = (CurrentSite_.Path + CurrentLanguage_.Path).Replace("//", "/").TrimEnd('/'); } if (checklogin) { if (CurrentUser.id == 0 || CurrentUser.IsAnonymous == 1) { HttpContext.Current.Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + "")); } } CurrentTheme_ = B_Lebi_Theme.GetModel("Code='" + themecode + "'"); CurrentPage = B_Lebi_Theme_Page.GetModel("Code='" + pcode + "'"); if (CurrentTheme_ == null) { CurrentTheme_ = new Lebi_Theme(); } Lebi_Theme_Skin skin = B_Lebi_Theme_Skin.GetModel("Theme_id=" + CurrentTheme_.id + " and Code='" + pcode + "'"); if (skin != null) { if (skin.PageSize > 0) { PageSize = skin.PageSize; } } if (CurrentSite_ != null) { SYS.Copyright = CurrentSite_.Copyright; SYS.Domain = CurrentSite_.Domain; SYS.Email = CurrentSite_.Email; SYS.Fax = CurrentSite_.Fax; SYS.Keywords = CurrentSite_.Keywords; SYS.Logoimg = CurrentSite_.Logoimg; SYS.Description = CurrentSite_.Description; SYS.Phone = CurrentSite_.Phone; SYS.QQ = CurrentSite_.QQ; SYS.ServiceP = CurrentSite_.ServiceP; SYS.Name = CurrentSite_.Name; SYS.Title = CurrentSite_.Title; SYS.FootHtml = CurrentSite_.FootHtml; SYS.TopAreaid = CurrentLanguage_.TopAreaid.ToString(); } LBTITLE = ""; LBTITLE += " - Powered by LebiShop"; //底部版权信息 //if (CurrentPage != null) //{ // StringBuilder sb = new StringBuilder(); // sb.Append("Powered by <a style=\"font-size:12px;color:#00497f\" href=\"http://www.lebi.cn\" target=\"_blank\" title=\"LebiShop多语言网上商店系统\">LebiShop</a> "); // sb.Append("V" + SYS.Version + "." + SYS.Version_Son); // try // { // Label label = (Label)this.Page.FindControl("LeBiLicense"); // label.Text = sb.ToString(); // } // catch (System.NullReferenceException) // { // Response.Write("<div style=\"height:100px;padding-top:10px;text-align:left;font-size:12;\">内部错误,请到【配置】=》【站点语言】栏目中重新生成网站<br>"); // Response.Write(sb.ToString() + "</div>"); // Response.End(); // } //} Session["CurrentTheme"] = CurrentTheme_;//session主要是为那些没有LoadTheme方法的页面服务的,如ajax Session["CurrentLanguage"] = CurrentLanguage_; Session["CurrentSite"] = CurrentSite_; //写入cookie NameValueCollection nvs = new NameValueCollection(); nvs.Add("theme", CurrentTheme_.Code); nvs.Add("language", CurrentLanguage_.Code); nvs.Add("site", CurrentSite_.id.ToString()); CookieTool.WriteCookie("ThemeStatus", nvs, 10); //多站点商品显示 if (Shop.Bussiness.Site.Instance.SiteCount > 1) { //if (Shop.LebiAPI.Service.Instanse.Check("domain3admin")) //{ if (DataBase.DBType == "sqlserver") { ProductWhere = "(Charindex('," + CurrentSite_.id + ",',','+Site_ids+',')>0 or Site_ids='') and Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "(Charindex('," + CurrentSite_.id + ",',','+Site_ids+',')>0 or Site_ids='')"; } if (DataBase.DBType == "access") { ProductWhere = "(Instr(','+Site_ids+',','," + CurrentSite_.id + ",')>0 or Site_ids='') and Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "(Instr(','+Site_ids+',','," + CurrentSite_.id + ",')>0 or Site_ids='')"; } //} //else //{ // ProductWhere = "Product_id = 0 and Type_id_ProductStatus = 101"; //} } else { ProductWhere = "Product_id = 0 and Type_id_ProductStatus = 101"; ProductCategoryWhere = "1=1"; } //ProductWhere += " and (UserLevel_ids_show='' or UserLevel_ids_show is null or ','+UserLevel_ids_show+',' like '%," + CurrentUserLevel.id + ",%' )"; ProductWhere += " and (IsDel!=1 or IsDel is null)"; }