Beispiel #1
0
        public void LoadTheme()
        {
            string themecode = "";
            string language  = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");

            if (!string.IsNullOrEmpty(nv.Get("language")))
            {
                language = nv.Get("language");
            }
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("site")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, language, "", false);
        }
Beispiel #2
0
 /// <summary>
 /// 判断登录状态
 /// </summary>
 /// <returns></returns>
 public static bool LoginStatus()
 {
     if (HttpContext.Current.Session["admin"] == null)
     {
         var    nv    = CookieTool.GetCookie("Master");
         int    uid   = 0;
         string uhash = "";
         string uname = "";
         if (nv.Count > 1)
         {
             if (!string.IsNullOrEmpty(nv.Get("id")) && !string.IsNullOrEmpty(nv.Get("hash")) && !string.IsNullOrEmpty(nv.Get("name")))
             {
                 //uid = StringUtils.StrToInt(nv.Get("id"), 0);
                 int.TryParse(nv.Get("id"), out uid);
                 uhash = nv.Get("hash");
                 uname = nv.Get("name");
                 Lebi_Administrator master = B_Lebi_Administrator.GetModel(uid);
                 if (CheckAdmin(master, uhash, uname, true))
                 {
                     SetSession(master);
                     return(true);
                 }
                 else
                 {
                     return(false);
                 }
             }
             return(false);
         }
         return(false);
     }
     return(true);
 }
Beispiel #3
0
        /// <summary>
        /// 处理语言标签
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        public string Tag(string content)
        {
            var    nv       = CookieTool.GetCookie("ThemeStatus");
            string langcode = "";

            if (!string.IsNullOrEmpty(nv.Get("language")))
            {
                langcode = nv.Get("language");
                return(Language.Tag(content, langcode));
            }

            return(Language.Tag(content, CurrentLanguage.Code));
        }
Beispiel #4
0
        /// <summary>
        /// 处理语言
        /// </summary>
        /// <param name="content"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public string Lang(string content)
        {
            var    nv       = CookieTool.GetCookie("ThemeStatus");
            string langcode = "";

            //if (!string.IsNullOrEmpty(nv.Get("language")))
            //{
            //    langcode = nv.Get("language");
            //    //return langcode;
            //    return Language.Content(content, langcode);
            //}
            //return CurrentLanguage.Code;
            return(Language.Content(content, CurrentLanguage.Code));
        }
Beispiel #5
0
        /// <summary>
        /// 修改购物车产品
        /// </summary>
        public void UserBasket_Edit()
        {
            int t = 142;
            //int num = RequestTool.RequestInt("num", 1);//默认数量1
            string property               = RequestTool.RequestSafeString("property");
            string CookieName             = "UserProduct" + t;
            List <Lebi_User_Product> pros = Basket.UserProduct(CurrentUser, t);

            foreach (Lebi_User_Product pro in pros)
            {
                pro.count = RequestTool.RequestInt("BasketCount" + pro.Product_id, 1);//默认数量1
                pro.count = pro.count < 1 ? 1 : pro.count;
            }
            if (CurrentUser.id > 0 && CurrentUser.IsAnonymous == 0)//已经登录
            {
                foreach (Lebi_User_Product pro in pros)
                {
                    B_Lebi_User_Product.Update(pro);
                }
            }
            else//未登录
            {
                NameValueCollection nv = CookieTool.GetCookie(CookieName);
                string key, userproduct;
                foreach (Lebi_User_Product pro in pros)
                {
                    key         = "p" + pro.Product_id.ToString();
                    userproduct = nv.Get(key);
                    if (string.IsNullOrEmpty(userproduct))
                    {
                        //nv.Add(key, pro.count.ToString());
                        nv.Add(key, pro.count.ToString() + "|" + property);
                    }
                    else
                    {
                        nv.Set(key, pro.count.ToString() + "|" + property);
                    }
                }

                CookieTool.WriteCookie(CookieName, nv, 365);
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
Beispiel #6
0
        /// <summary>
        /// 发送手机验证码
        /// </summary>
        public void GetPhoneCheckCode()
        {
            string phone = RequestTool.RequestSafeString("phone");

            CurrentUser.MobilePhone = phone;
            CurrentUser.Language    = CurrentLanguage.Code;
            string mcode = RequestTool.RequestString("m");

            try
            {
                int phonecount = B_Lebi_User.Counts("MobilePhone=lbsql{'" + phone + "'} and IsCheckedMobilePhone=1");
                if (phonecount > 0)
                {
                    Response.Write("{\"msg\":\"" + Tag("此手机号已经注册") + "\"}");
                    return;
                }
                int    Count  = 0;
                string Count_ = CookieTool.GetCookie("GetPhoneCheckCode_" + CurrentUser.MobilePhone).Get("Count");
                int.TryParse(Count_, out Count);
                if (Count > 5)
                {
                    Response.Write("{\"msg\":\"" + Tag("已超出当日使用次数") + "\"}");
                    return;
                }
                string servermcode = Session["mcode"] == null ? "1" : (string)Session["mcode"];
                if (servermcode != mcode || servermcode == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("发送失败,请刷新页面后重试") + "" + servermcode + "\"}");
                    return;
                }
                SMS.SendSMS_checkcode(CurrentUser);
                Count++;
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("Count", Count.ToString());
                CookieTool.WriteCookie("GetPhoneCheckCode_" + CurrentUser.MobilePhone, nvs, 1);
                Response.Write("{\"msg\":\"OK\"}");
            }
            catch
            {
                Response.Write("{\"msg\":\"" + Tag("发送失败,请联系客服") + "\"}");
            }
        }
Beispiel #7
0
        /// <summary>
        /// 发送邮件验证码
        /// </summary>
        public void GetEmailCheckCode()
        {
            string email = RequestTool.RequestSafeString("email");

            CurrentUser.Email    = email;
            CurrentUser.Language = CurrentLanguage.Code;
            string mcode = RequestTool.RequestString("m");

            try
            {
                int emailcount = B_Lebi_User.Counts("Email=lbsql{'" + email + "'} and IsCheckedEmail=1");
                if (emailcount > 0)
                {
                    Response.Write("{\"msg\":\"" + Tag("此邮箱已经注册") + "\"}");
                    return;
                }
                int    Count  = 0;
                string Count_ = CookieTool.GetCookie("GetEmailCheckCode_" + CurrentUser.Email).Get("Count");
                int.TryParse(Count_, out Count);
                if (Count > 5)
                {
                    Response.Write("{\"msg\":\"" + Tag("已超出当日使用次数") + "\"}");
                    return;
                }
                string servermcode = Session["mcode"] == null ? "" : (string)Session["mcode"];
                if (servermcode != mcode || servermcode == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("发送失败,请刷新页面后重试") + "\"}");
                    return;
                }
                Email.SendEmail_checkcode(CurrentUser);
                Count++;
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("Count", Count.ToString());
                CookieTool.WriteCookie("GetEmailCheckCode_" + CurrentUser.Email, nvs, 1);
                Response.Write("{\"msg\":\"OK\"}");
            }
            catch
            {
                Response.Write("{\"msg\":\"" + Tag("发送失败,请联系客服") + "\"}");
            }
        }
Beispiel #8
0
        /// <summary>
        /// 购物车或收藏夹中删除一个商品
        /// 141购物车
        /// 142收藏
        /// 143浏览记录
        /// </summary>
        public void UserProduct_Del()
        {
            int t = RequestTool.RequestInt("type", 141);//默认收藏

            if (t != 141 && t != 142 && t != 143)
            {
                Response.Write("OK");
                return;
            }
            string productid = RequestTool.RequestSafeString("pid");

            if (productid == "all")
            {
                //清空购物车/收藏夹
                Basket.Clear(CurrentUser, t);
            }
            else
            {
                int pid = RequestTool.RequestInt("pid", 0);
                if (EX_User.LoginStatus(CurrentUser))//已经登录
                {
                    B_Lebi_User_Product.Delete("user_id=" + CurrentUser.id + " and product_id=" + pid + " and type_id_UserProductType=" + t + "");
                }
                else//未登录
                {
                    string CookieName      = "UserProduct" + t;
                    NameValueCollection nv = CookieTool.GetCookie(CookieName);
                    string key             = "p" + pid.ToString();
                    string userproduct     = nv.Get(key);
                    if (!string.IsNullOrEmpty(userproduct))
                    {
                        nv.Remove(key);
                    }
                    CookieTool.WriteCookie(CookieName, nv, 365);
                }
            }
            Response.Write("{\"msg\":\"OK\",\"mes\":\"" + Tag("操作成功") + "\"}");
        }
Beispiel #9
0
        protected override void OnLoad(EventArgs e)
        {
            //页面载入检查
            PageLoadCheck();

            site = new Site_Agent();
            string themecode    = "";
            int    siteid       = 0;
            string languagecode = "";
            var    nv           = CookieTool.GetCookie("ThemeStatus");

            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("language")))
            {
                languagecode = nv.Get("language");
            }
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }

            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, languagecode, "", true);

            DefaultCurrency = B_Lebi_Currency.GetModel("IsDefault=1");
            if (DefaultCurrency == null)
            {
                DefaultCurrency = B_Lebi_Currency.GetList("", "Sort desc").FirstOrDefault();
            }
            CurrentCurrency = DefaultCurrency;
            base.OnLoad(e);
        }
Beispiel #10
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang"))
            {
                Response.Redirect(WebPath + "/");
                Response.End();
                return;
            }
            PageLoadCheck(); //页面载入检查
            #region 当前用户信息
            int selectsupplierid = RequestTool.RequestInt("selectsupplierid");
            if (selectsupplierid > 0)
            {
                //切换超级账号
                string msg = "";
                EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg);
                CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011");
            }
            if (CurrentSupplierUser == null)
            {
                CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser);
            }

            if (CurrentSupplierUser.id == 0)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id);
            if (CurrentSupplier.Type_id_SupplierStatus != 442)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id);
            if (CurrentSupplierUserGroup == null)
            {
                CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup();
            }
            if (CurrentSupplier != null)
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);

                if (CurrentSupplierGroup == null)
                {
                    CurrentSupplierGroup = new Lebi_Supplier_Group();
                }
            }
            else
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            DateTime LastDate      = CurrentSupplier.Time_This;
            TimeSpan ts            = System.DateTime.Now - LastDate;
            int      NewEventTimes = 0;
            int.TryParse(SYS.NewEventTimes, out NewEventTimes);
            LeftNewEventTimes = Convert.ToInt32(ts.TotalSeconds % (NewEventTimes / 1000));
            LeftNewEventTimes = NewEventTimes - (LeftNewEventTimes * 1000);
            #endregion

            #region 配合前台主题
            string themecode = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("site")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true);
            #endregion

            #region 处理菜单
            MenuType = Shop.Tools.CookieTool.GetCookieString("Menu");
            if (MenuType == "")
            {
                MenuType = "Index";
            }

            string menu_ids = "";
            if (CurrentSupplierUserGroup != null && CurrentSupplierUser.User_id != CurrentSupplier.User_id)
            {
                menu_ids = CurrentSupplierUserGroup.Menu_ids;
            }
            else
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);
                if (CurrentSupplierGroup != null)
                {
                    menu_ids = CurrentSupplierGroup.Menu_ids;
                }
            }
            //lebi菜单
            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></span></li></ul>";
                string license = "Copyright 2003-" + DateTime.Now.Year + " <a href=\"http://www.lebi.cn/\" target=\"_blank\" class=\"footcopy\">Lebi.cn</a> , All Rights Reserved. Powered by <a href=\"http://www.lebi.cn/support/license/?url=" + Request.ServerVariables["SERVER_NAME"] + "\" target=\"_blank\" title=\"LebiShop\" class=\"footcopy\">LebiShop</a> V<a href=\"" + site.AdminPath + "/config/version.aspx\">" + SYS.Version + "." + SYS.Version_Son + "</a>";
                try
                {
                    Label LBLicense = (Label)this.Page.FindControl("LBLicense");
                    LBLicense.Text = license;
                }
                catch
                {
                    string strscript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><script language='javascript'>";
                    strscript += "document.onreadystatechange = loadlicense;";
                    strscript += "function loadlicense(){";
                    strscript += "if(document.readyState == \"complete\"){";
                    strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}";
                    strscript += "$('#lebicopy').html('" + license + "')";
                    strscript += "}}</script>";
                    Response.Write(strscript);
                }
            }
            else
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></ul>";
            }
            //处理菜单
            desk     = RequestTool.RequestInt("desk", 0);
            AllMenus = new List <Lebi_Supplier_Menu>();
            List <Lebi_Supplier_Menu> All = B_Lebi_Supplier_Menu.GetList("Isshow=1", "Sort desc");
            string currentgroupmenu       = "," + menu_ids + ",";
            foreach (Lebi_Supplier_Menu m in All)
            {
                if (currentgroupmenu.Contains("," + m.id + ","))
                {
                    AllMenus.Add(m);
                }
            }
            TopMenus = (from m in AllMenus
                        where m.parentid == 0
                        select m).ToList();
            if (desk != 1)
            {
                try
                {
                    var temp = from m in AllMenus
                               where reqPage.Contains(m.URL.ToLower()) && m.parentid > 0 && m.URL != ""
                               select m;
                    //if (temp == null)
                    //    CurrentLeftMenu = new Lebi_Menu();
                    //else
                    //{
                    CurrentLeftMenu = temp.ToList().FirstOrDefault();
                    CurrentTopMenu  = (from m in AllMenus
                                       where m.id == CurrentLeftMenu.parentid
                                       select m).ToList().FirstOrDefault();
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == CurrentTopMenu.parentid
                                      select m).ToList().FirstOrDefault();
                    ////写入cookie
                    NameValueCollection nvs = new NameValueCollection();
                    nvs.Add("top", CurrentTopMenu.id.ToString());
                    nvs.Add("left", CurrentLeftMenu.id.ToString());
                    CookieTool.WriteCookie("sMenu", nvs, 365);
                    //}
                }
                catch (NullReferenceException)
                {
                    var menu = CookieTool.GetCookie("sMenu");
                    int tid  = 0;
                    int lid  = 0;
                    int.TryParse(menu.Get("top"), out tid);
                    int.TryParse(menu.Get("left"), out lid);
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == tid
                                      select m).ToList().FirstOrDefault();
                    CurrentLeftMenu = (from m in AllMenus
                                       where m.id == lid
                                       select m).ToList().FirstOrDefault();
                }
            }
            else
            {
                //写入cookie
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("top", "0");
                nvs.Add("left", "0");
                CookieTool.WriteCookie("sMenu", nvs, 365);
            }
            if (CurrentTopMenu == null)
            {
                CurrentTopMenu = new Lebi_Supplier_Menu();
                desk           = 1;
            }
            #endregion
            Suppliers = GetSuppliers();


            base.OnLoad(e);
        }
Beispiel #11
0
        /// <summary>
        /// 用户注册
        /// </summary>
        public void User_Reg()
        {
            string url = "";
            bool   Checkmobilephone = false;
            bool   Checkemail       = false;
            string MobilePhone      = RequestTool.RequestSafeString("MobilePhone");
            string Email            = RequestTool.RequestSafeString("Email");

            try
            {
                Lebi_UserLevel defaultlevel = B_Lebi_UserLevel.GetModel("Grade>0 order by Grade asc");
                if (defaultlevel == null)
                {
                    defaultlevel = new Lebi_UserLevel();
                }
                if (defaultlevel.RegisterType == 0) //关闭注册
                {
                    Response.Write("{\"msg\":\"" + Tag("会员注册已关闭") + "\"}");
                    return;
                }
                if (SYS.UserRegCheckedType.Contains("mobilephone"))
                {
                    Checkmobilephone = true;
                    string MobilePhone_checkcode = RequestTool.RequestSafeString("MobilePhone_checkcode");
                    try
                    {
                        string phonecheckcode = (string)Session["phonecheckcode"];//phonecheckcode
                        if (phonecheckcode != (MobilePhone + MobilePhone_checkcode))
                        {
                            Response.Write("{\"msg\":\"" + Tag("手机验证码错误") + phonecheckcode + "(" + MobilePhone + MobilePhone_checkcode + ")\"}");
                            return;
                        }
                        if (SYS.IsMobilePhoneMutiReg == "0")
                        {
                            int phonecount = B_Lebi_User.Counts("MobilePhone=lbsql{'" + MobilePhone + "'} and IsCheckedMobilePhone=1");
                            if (phonecount > 0)
                            {
                                Response.Write("{\"msg\":\"" + Tag("此手机号已经注册") + "\"}");
                                return;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Response.Write("{\"msg\":\"" + Tag("手机验证码错误") + "" + ex.ToString() + "\"}");
                        return;
                    }
                }
                if (SYS.UserRegCheckedType.Contains("email"))
                {
                    Checkemail = true;
                    string Email_checkcode = RequestTool.RequestSafeString("Email_checkcode");
                    try
                    {
                        string emailcheckcode = (string)Session["emailcheckcode"];
                        if (emailcheckcode != (Email + Email_checkcode))
                        {
                            Response.Write("{\"msg\":\"" + Tag("邮件验证码错误") + "\"}");
                            return;
                        }
                        int emailcount = B_Lebi_User.Counts("Email=lbsql{'" + Email + "'} and IsCheckedEmail=1");
                        if (emailcount > 0)
                        {
                            Response.Write("{\"msg\":\"" + Tag("此邮箱已经注册") + "\"}");
                            return;
                        }
                    }
                    catch
                    {
                        Response.Write("{\"msg\":\"" + Tag("邮件验证码错误") + "\"}");
                        return;
                    }
                }
                if (SYS.Verifycode_UserRegister == "1")
                {
                    if (Checkemail == false && Checkmobilephone == false)
                    {
                        string verifycode = RequestTool.RequestString("verifycode");
                        if (CurrentCheckCode != verifycode)
                        {
                            Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}");
                            return;
                        }
                    }
                }
                string UserName = RequestTool.RequestSafeString("UserName");
                string PWD      = RequestTool.RequestSafeString("Password");
                string token    = RequestTool.RequestString("token");
                if (UserName == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("请输入用户名") + "\"}");
                    return;
                }
                if (PWD == "")
                {
                    Response.Write("{\"msg\":\"" + Tag("请输入密码") + "\"}");
                    return;
                }
                //检查用户名存在
                int count = B_Lebi_User.Counts("UserName=lbsql{'" + UserName + "'}");
                if (count > 0)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户名已注册") + "\"}");
                    return;
                }
                var nv           = CookieTool.GetCookie("parentuser");
                int parentuserid = 0;
                if (!string.IsNullOrEmpty(nv.Get("id")))
                {
                    string parentuserid_ = nv.Get("id");
                    int.TryParse(parentuserid_, out parentuserid);
                }
                if (parentuserid == 0)
                {
                    parentuserid = RequestTool.RequestInt("parentuserid", 0);
                }
                if (parentuserid != 0)
                {
                    Lebi_User puser = B_Lebi_User.GetModel("id=" + parentuserid + "");
                    if (puser != null)
                    {
                        if (defaultlevel.RegisterType == 2)  //邀请注册
                        {
                            Lebi_UserLevel userlevel = B_Lebi_UserLevel.GetModel(puser.UserLevel_id);
                            if (userlevel != null)
                            {
                                if (userlevel.RegisterType == 0) //关闭注册
                                {
                                    Response.Write("{\"msg\":\"" + Tag("会员注册已关闭") + "\"}");
                                    return;
                                }
                            }
                        }
                        if (SYS.IsUsedAgent == "1")
                        {
                            if (Shop.LebiAPI.Service.Instanse.Check("plugin_agent"))
                            {
                                parentuserid = puser.id;
                                puser.Count_sonuser++;
                                B_Lebi_User.Update(puser);
                            }
                        }
                    }
                }
                else
                {
                    if (defaultlevel.RegisterType == 2)  //邀请注册
                    {
                        Response.Write("{\"msg\":\"" + Tag("请输入邀请码") + "\"}");
                        return;
                    }
                }
                Lebi_User model = new Lebi_User();
                B_Lebi_User.SafeBindForm(model);
                model.NickName     = model.UserName;
                model.Password     = EX_User.MD5(PWD);
                model.UserLevel_id = defaultlevel.id;
                model.Time_Reg     = DateTime.Now;
                model.Time_This    = DateTime.Now;
                model.Time_Last    = DateTime.Now;
                model.Count_Login  = 1;
                model.IP_This      = RequestTool.GetClientIP();
                model.IP_Last      = RequestTool.GetClientIP();
                if (Checkemail)
                {
                    model.IsCheckedEmail = 1;
                }
                if (Checkmobilephone)
                {
                    model.IsCheckedMobilePhone = 1;
                }
                model.User_id_parent = parentuserid;
                if (CurrentSite != null)
                {
                    model.Site_id = CurrentSite.id;
                }
                if (CurrentLanguage != null)
                {
                    model.Language = CurrentLanguage.Code;
                }
                model.Area_id = RequestTool.RequestInt("Area_id", 0);
                int DefaultUserEndDays = 0;
                int.TryParse(SYS.DefaultUserEndDays, out DefaultUserEndDays);
                model.Time_End = System.DateTime.Now.AddDays(DefaultUserEndDays);
                Lebi_User user = EX_User.UserReg(model, PWD);
                try
                {
                    //发送邮件
                    if (ShopCache.GetBaseConfig().MailSign.ToLower().Contains("zhuce") || ShopCache.GetBaseConfig().AdminMailSign.ToLower().Contains("register"))
                    {
                        Shop.Bussiness.Email.SendEmail_newuser(user);
                    }
                    //发送短信
                    if (ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_newuser") || ShopCache.GetBaseConfig().SMS_sendmode.Contains("SMSTPL_Admin_newuser"))
                    {
                        SMS.SendSMS_newuser(user);
                    }
                }
                catch { }
                url = RequestTool.RequestString("url").Replace("<", "").Replace(">", "");
                if (EX_User.MD5(SYS.InstallCode + url) != token)
                {
                    url = URL("P_Index", "");
                }
                if (url.ToLower().IndexOf("http") > -1 || url.ToLower().IndexOf(URL("P_Register", "").ToLower()) > -1 || url.ToLower().IndexOf(URL("P_Login", "").ToLower()) > -1 || url == "")
                {
                    url = URL("P_Index", "");
                }
                Response.Write("{\"msg\":\"OK\",\"url\":\"" + url + "\"}");
            }
            catch (Exception e)
            {
                SystemLog.Add("User_Reg-" + e.ToString());
            }
        }
Beispiel #12
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang"))
            {
                Response.Write("");
                Response.End();
                return;
            }
            PageLoadCheck(); //页面载入检查

            #region 当前用户信息
            int selectsupplierid = RequestTool.RequestInt("selectsupplierid");
            if (selectsupplierid > 0)
            {
                //切换超级账号
                string msg = "";
                EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg);
                CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011");
            }
            if (CurrentSupplierUser == null)
            {
                CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser);
            }

            if (CurrentSupplierUser.id == 0)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }


            CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id);
            if (CurrentSupplier.Type_id_SupplierStatus != 442)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id);
            if (CurrentSupplierUserGroup == null)
            {
                CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup();
            }
            if (CurrentSupplier != null)
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);

                if (CurrentSupplierGroup == null)
                {
                    CurrentSupplierGroup = new Lebi_Supplier_Group();
                }
            }
            else
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            #endregion

            #region 配合前台主题
            string themecode = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true);
            #endregion

            Suppliers = GetSuppliers();
            base.OnLoad(e);
        }
Beispiel #13
0
        protected override void OnLoad(EventArgs e)
        {
            if (!EX_Admin.LoginStatus() && RequestTool.GetRequestUrlNonDomain().ToLower().IndexOf("login.aspx") < 0)
            {
                //Response.Redirect(site.AdminPath + "/login.aspx?url=" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "");
                string url = site.AdminPath + "/login.aspx?url=" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "&token=" + EX_Admin.MD5(SYS.InstallCode + RequestTool.GetRequestUrlNonDomain()) + "";
                url = "<script type=\"text/javascript\">window.location='" + url + "';</script>";
                Response.Write(url);
                Response.End();
                return;
            }
            CurrentAdmin = EX_Admin.CurrentAdmin();
            //CurrentAdminGroup = (Lebi_Admin_Group)Session["admin_group"];
            CurrentAdminGroup = B_Lebi_Admin_Group.GetModel(CurrentAdmin.Admin_Group_id);
            DateTime LastDate      = CurrentAdmin.Time_This;
            TimeSpan ts            = System.DateTime.Now - LastDate;
            int      NewEventTimes = 0;

            int.TryParse(SYS.NewEventTimes, out NewEventTimes);
            LeftNewEventTimes = Convert.ToInt32(ts.TotalSeconds % (NewEventTimes / 1000));
            LeftNewEventTimes = NewEventTimes - (LeftNewEventTimes * 1000);
            MenuType          = LB.Tools.CookieTool.GetCookieString("Menu");
            if (MenuType == "")
            {
                MenuType = "Index";
            }

            if (Shop.LebiAPI.Service.Instanse.ServicepackName(SYS.LicensePackage) == "免费版")
            {
                LicenseString = "<div class=\"licensecheck\" style=\"display:block;float:left;margin:7px 0 0 0;padding:0;height:25px;line-height:25px;color:#ffffff;\"><span><a href=\"http://www.lebi.cn/license/\" target=\"_blank\" style=\"color:#fff;font-size:12px;\">" + Tag("免费版") + "</a></span></div>";
            }
            if (Shop.Bussiness.EX_Admin.CheckPower("version"))
            {
                int vers = B_Lebi_Version.Counts("IsUpdate=0 and Version_Check like '%" + SYS.Version + "." + SYS.Version_Son + "%'");
                if (vers > 0)
                {
                    Version = "<div id=\"version\"><a href=\"" + site.AdminPath + "/config/Version.aspx\" style=\"color:red\" >" + Tag("发现新版本") + " " + Tag("点击此处更新") + " </a></div>";
                }
            }
            //lebi菜单
            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                var licenseuserurl = "username="******"&password="******"&vc=" + EX_User.MD5(SYS.LicensePWD);
                lbmenu  = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0\">" + Tag("桌面") + "</a> | <a href=\"javascript:void(0);\" onclick=\"Copyright();\">" + Tag("关于") + "</a></span></li></ul>";
                lbmenu += "<ul class=\"faq\"><li><a href=\"http://www.lebi.cn/support/checkuser.aspx?" + licenseuserurl + "\" title=\"" + Tag("客服中心") + "\" target=\"_blank\"><b></b><span>" + Tag("客服中心") + "</span></a></li></ul>";
                string license = "Copyright 2003-" + DateTime.Now.Year + " <a href=\"http://www.lebi.cn/\" target=\"_blank\" class=\"footcopy\">Lebi.cn</a> , All Rights Reserved. Powered by <a href=\"http://www.lebi.cn/support/license/?url=" + Request.ServerVariables["SERVER_NAME"] + "\" target=\"_blank\" title=\"LebiShop\" class=\"footcopy\">LebiShop</a> V<a href=\"" + site.AdminPath + "/config/version.aspx\">" + SYS.Version + "." + SYS.Version_Son + "</a>";
                try
                {
                    Label LBLicense = (Label)this.Page.FindControl("LBLicense");
                    LBLicense.Text = license;
                }
                catch
                {
                    string strscript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
                    //strscript = "<script language='javascript'>";
                    //strscript += "document.onreadystatechange = loadlicense;";
                    //strscript += "function loadlicense(){";
                    //strscript += "if(document.readyState == \"complete\"){";
                    //strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}else{";
                    //strscript += "$('#lebicopy').html('" + license + "')}";
                    //strscript += "}}</script>";
                    strscript += license;
                    Response.Write(strscript);
                }
            }
            else
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0\">" + Tag("桌面") + "</a> | <a href=\"javascript:void(0);\" onclick=\"Copyright();\">" + Tag("关于") + "</a></span></li></ul>";
            }
            //处理菜单
            desk     = RequestTool.RequestInt("desk", 0);
            AllMenus = new List <Lebi_Menu>();
            List <Lebi_Menu> All = B_Lebi_Menu.GetList("Isshow=1", "Sort desc");
            string           currentgroupmenu = "," + CurrentAdminGroup.Menu_ids + ",";

            if (CurrentAdmin.AdminType == "super")
            {
                AllMenus = All;
            }
            else
            {
                foreach (Lebi_Menu m in All)
                {
                    if (currentgroupmenu.Contains("," + m.id + ","))
                    {
                        AllMenus.Add(m);
                    }
                }
            }
            TopMenus = (from m in AllMenus
                        where m.parentid == 0
                        select m).ToList();
            string currentPage = RequestTool.GetRequestUrl().ToLower();
            int    apathindex  = currentPage.IndexOf(site.AdminPath.ToLower());

            currentPage = currentPage.Substring(apathindex, currentPage.Length - apathindex);
            currentPage = currentPage.Substring(site.AdminPath.Length, currentPage.Length - site.AdminPath.Length).TrimStart('/');
            if (desk != 1)
            {
                try
                {
                    var temp = from m in AllMenus
                               where currentPage.IndexOf(m.URL.ToLower().TrimStart('/')) == 0 && m.parentid > 0 && m.URL != ""
                               select m;
                    //if (temp == null)
                    //    CurrentLeftMenu = new Lebi_Menu();
                    //else
                    //{
                    CurrentLeftMenu = temp.ToList().FirstOrDefault();
                    CurrentTopMenu  = (from m in AllMenus
                                       where m.id == CurrentLeftMenu.parentid
                                       select m).ToList().FirstOrDefault();
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == CurrentTopMenu.parentid
                                      select m).ToList().FirstOrDefault();
                    ////写入cookie
                    NameValueCollection nvs = new NameValueCollection();
                    nvs.Add("top", CurrentTopMenu.id.ToString());
                    nvs.Add("left", CurrentLeftMenu.id.ToString());
                    CookieTool.WriteCookie("Menu", nvs, 30);
                    //}
                }
                catch (NullReferenceException)
                {
                    var menu = CookieTool.GetCookie("Menu");
                    int tid  = 0;
                    int lid  = 0;
                    int.TryParse(menu.Get("top"), out tid);
                    int.TryParse(menu.Get("left"), out lid);
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == tid
                                      select m).ToList().FirstOrDefault();
                    CurrentLeftMenu = (from m in AllMenus
                                       where m.id == lid
                                       select m).ToList().FirstOrDefault();
                }
            }
            else
            {
                //写入cookie
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("top", "0");
                nvs.Add("left", "0");
                CookieTool.WriteCookie("Menu", nvs, 365);
            }
            if (CurrentTopMenu == null)
            {
                CurrentTopMenu = new Lebi_Menu();
                desk           = 1;
            }

            CheckPagePower();
            if (CurrentAdmin.Avatar == "")
            {
                CurrentAdmin.Avatar = site.AdminImagePath + "/Avatar.jpg";
            }
            base.OnLoad(e);
        }