Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string str;

            this.InitJavaScript();
            UserInfo userInfo = PEContext.Current.User.UserInfo;

            this.PurviewInfo = PEContext.Current.User.PurviewInfo;
            UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(userInfo.GroupId);

            this.m_IsAgent = userGroupById.GroupType == GroupType.Agent;
            if (this.PurviewInfo == null)
            {
                this.PurviewInfo = new UserPurviewInfo(true);
            }
            this.xmlDoc = new XmlDocument();
            HttpContext current = HttpContext.Current;

            if (current != null)
            {
                str = current.Server.MapPath("~/User/Common/MainMenu.xml");
            }
            else
            {
                str = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "User/Common/MainMenu.xml");
            }
            this.xmlDoc.Load(str);
            this.RptTopMenu.ItemDataBound += new RepeaterItemEventHandler(this.RptTopMenu_ItemDataBound);
            this.RptTopMenu.DataSource     = this.xmlDoc.SelectNodes("/menu/TopMenu");
            this.RptTopMenu.DataBind();
            this.RptMenu.ItemDataBound += new RepeaterItemEventHandler(this.RptMenu_ItemDataBound);
            this.RptMenu.DataSource     = this.xmlDoc.SelectNodes("/menu/TopMenu");
            this.RptMenu.DataBind();
        }
Exemplo n.º 2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            if (!this.UseCoupon)
            {
                this.PresentId = base.Request.Form["RdbPresentId"];
            }
            string userName = string.Empty;
            IList <ShoppingCartInfo> list = ShoppingCart.GetList(0, 0x7fffffff, 4, this.m_CartId);

            if (this.m_IsPreview == 3)
            {
                foreach (ShoppingCartInfo info in list)
                {
                    userName = info.UserName;
                    break;
                }
            }
            else
            {
                userName = PEContext.Current.User.UserName;
            }
            if (!string.IsNullOrEmpty(userName))
            {
                this.m_UserInfo = Users.GetUsersByUserName(userName);
                UserPurviewInfo userPurview = this.m_UserInfo.UserPurview;
                this.ViewState["HaveWholesalePurview"] = userPurview.Enablepm;
            }
            else
            {
                this.ViewState["HaveWholesalePurview"] = false;
            }
            this.RptShoppingCart.DataSource = list;
            this.RptShoppingCart.DataBind();
            if (this.m_IsPreview == 0)
            {
                PresentProjectInfo presentProjectByTotalMoney = PresentProject.GetPresentProjectByTotalMoney(this.total);
                if (!presentProjectByTotalMoney.IsNull && presentProjectByTotalMoney.PresentContent.Contains("1"))
                {
                    this.RptPresentList.Visible = true;
                    this.Note.Visible           = true;
                    this.LblPrice.Visible       = true;
                    this.LblPrice.Text          = presentProjectByTotalMoney.Price.ToString("0.00");
                    string[]            strArray = presentProjectByTotalMoney.PresentId.Split(new char[] { ',' });
                    IList <PresentInfo> list2    = new List <PresentInfo>();
                    foreach (string str2 in strArray)
                    {
                        list2.Add(Present.GetPresentById(DataConverter.CLng(str2)));
                    }
                    this.RptPresentList.DataSource = list2;
                    this.RptPresentList.DataBind();
                }
            }
            else if (this.m_IsPreview == 1)
            {
                this.RptPresentList.Visible = false;
                this.Note.Visible           = false;
                this.LblPrice.Visible       = false;
            }
        }
Exemplo n.º 3
0
        public bool SaveUserPurview(UserPurviewInfo userPurviewInfo, int userId)
        {
            Parameters cmdParams = new Parameters();

            cmdParams.AddInParameter("@UserId", DbType.Int32, userId);
            cmdParams.AddInParameter("@UserSetting", DbType.String, ser.SerializeField(userPurviewInfo));
            return(DBHelper.ExecuteSql("UPDATE PE_Users SET UserSetting = @UserSetting WHERE UserId = @UserId", cmdParams));
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);

            this.m_UserId = usersByUserName.UserId;
            this.OdsFavorite.SelectParameters["userId"].DefaultValue = this.m_UserId.ToString();
            if (!base.IsPostBack)
            {
                FavoriteInfo favoriteInfo = new FavoriteInfo();
                favoriteInfo.FavoriteTime = DateTime.Now;
                favoriteInfo.InfoId       = BasePage.RequestInt32("Id");
                favoriteInfo.UserId       = this.m_UserId;
                string str = BasePage.RequestStringToLower("Action");
                if (str != null)
                {
                    if (!(str == "add"))
                    {
                        if (!(str == "delete"))
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (favoriteInfo.InfoId <= 0)
                        {
                            DynamicPage.WriteErrMsg("你收藏的内容不存在!", "Index.aspx");
                        }
                        UserPurviewInfo userPurview  = usersByUserName.UserPurview;
                        int             maxSaveInfos = 0;
                        if (!userPurview.IsNull)
                        {
                            maxSaveInfos = userPurview.MaxSaveInfos;
                        }
                        if (maxSaveInfos <= 0)
                        {
                            DynamicPage.WriteErrMsg("你没有收藏权限,请与网站管理员联系!", "Index.aspx");
                        }
                        if (maxSaveInfos > Favorite.GetUserFavoiteCount(this.m_UserId))
                        {
                            Favorite.Add(favoriteInfo);
                            DynamicPage.WriteSuccessMsg("收藏成功", "~/Item/" + favoriteInfo.InfoId.ToString() + ".aspx");
                            return;
                        }
                        DynamicPage.WriteErrMsg("你收藏的内容已达到最大收藏数");
                        return;
                    }
                    if (favoriteInfo.InfoId <= 0)
                    {
                        DynamicPage.WriteUserErrMsg("你收藏的内容不存在!", "Favorite.aspx");
                    }
                    if (!Favorite.Delete(this.m_UserId, BasePage.RequestInt32("Id")))
                    {
                        DynamicPage.WriteUserErrMsg("取消失败");
                    }
                }
            }
        }
Exemplo n.º 5
0
        private static void Application_AuthenticateRequest(object sender, EventArgs e)
        {
            HttpApplication application = (HttpApplication)sender;
            HttpContext     context     = application.Context;

            if ((context.Request.Url.ToString().IndexOf("/Install/Default.aspx", StringComparison.OrdinalIgnoreCase) < 0) && (context.Request.Url.ToString().IndexOf("/Install/Upgrade.aspx", StringComparison.OrdinalIgnoreCase) < 0))
            {
                FormsAuthenticationTicket ticket = null;
                //获取用于FORM身份验证票证
                string     formsCookieName = FormsAuthentication.FormsCookieName;
                HttpCookie cookie          = context.Request.Cookies[formsCookieName];
                if (cookie == null)
                {
                    //使用新的验证标识创建用户基本功能对象
                    UserPrincipal principal = new UserPrincipal(new AnonymousAuthenticateIdentity());
                    principal.UserInfo                    = new UserInfo(true);
                    principal.UserInfo.GroupId            = -2;
                    principal.UserInfo.IsInheritGroupRole = true;
                    PEContext.Current.User                = principal;
                }
                else
                {
                    try
                    {
                        //根据票证传递的参数而获取票证
                        ticket = FormsAuthentication.Decrypt(cookie.Value);
                    }
                    catch (ArgumentException)
                    {
                        return;
                    }
                    catch (CryptographicException)
                    {
                        //移除Forms验证Cookies
                        context.Request.Cookies.Remove(formsCookieName);
                    }
                    if (ticket != null)
                    {
                        UserPrincipal principal2 = UserPrincipal.CreatePrincipal(ticket);
                        if (principal2.Identity.IsAuthenticated)
                        {
                            principal2.UserInfo = Users.GetUsersByUserName(principal2.UserName);
                            UserPurviewInfo userPurview = principal2.UserInfo.UserPurview;
                            principal2.PurviewInfo = userPurview;
                            PEContext.Current.User = principal2;
                            FormsIdentity    identity   = new FormsIdentity(ticket);
                            GenericPrincipal principal3 = new GenericPrincipal(identity, new string[] { principal2.RoleId.ToString(CultureInfo.CurrentCulture) });
                            context.User = principal3;
                        }
                        else
                        {
                            GenericPrincipal principal4 = new GenericPrincipal(new NoAuthenticateIdentity(), null);
                            context.User = principal4;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public bool ExecuteContentCharge()
        {
            object obj2 = HttpContext.Current.Items["IsPay"];

            if ((obj2 != null) && ((bool)obj2))
            {
                return(true);
            }
            if ((this.m_contentChargeInfo.InfoPoint <= 0) || (this.m_contentChargeInfo.InfoPoint > 0x270f))
            {
                return(true);
            }
            if ((this.m_UserInfo.Status & UserStatus.WaitValidateByEmail) == UserStatus.WaitValidateByEmail)
            {
                this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_NoMail;
                return(false);
            }
            if ((this.m_UserInfo.Status & UserStatus.WaitValidateByAdmin) == UserStatus.WaitValidateByAdmin)
            {
                this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_NoCheck;
                return(false);
            }
            if (!this.CheckIsAuthenticated())
            {
                return(false);
            }
            UserPurviewInfo purviewInfo = PEContext.Current.User.PurviewInfo;

            if (purviewInfo.ChargeByPoint)
            {
                this.Pointfirst();
            }
            else
            {
                int num = 0;
                if (this.m_UserInfo.EndTime.HasValue)
                {
                    TimeSpan span = (TimeSpan)(Convert.ToDateTime(this.m_UserInfo.EndTime) - DateTime.Now.Date);
                    num = Convert.ToInt32(Convert.ToDecimal(span.TotalDays));
                }
                if (num <= 0)
                {
                    this.OverdueDisposal(purviewInfo);
                }
                else
                {
                    this.InValidate(purviewInfo);
                }
            }
            return(string.IsNullOrEmpty(this.m_ErrMsg));
        }
Exemplo n.º 7
0
        private void InitPrivew(UserInfo usersInfo)
        {
            UserPurviewInfo userPurview = usersInfo.UserPurview;

            if (!userPurview.EnableExchangePoint)
            {
                this.BtnExchangePoint.Visible = false;
            }
            if (!userPurview.EnableExchangeValidDate)
            {
                this.BtnExchangeValidDate.Visible = false;
            }
            this.BtnRecharge.Visible = true;
            this.BtnOrder.Visible    = true;
            this.BtnReceive.Visible  = true;
        }
Exemplo n.º 8
0
 private static decimal GetGroupPrice(ProductInfo productInfo, UserInfo userInfo, decimal price, string property)
 {
     if (price == -1M)
     {
         return(GetProductPriceInfo(productInfo.ProductId, productInfo.TableName, userInfo.GroupId, property).Price);
     }
     if (price == 0M)
     {
         double          input       = 100.0;
         UserPurviewInfo userPurview = userInfo.UserPurview;
         if (userPurview != null)
         {
             input = userPurview.Discount;
         }
         return((productInfo.PriceInfo.Price * DataConverter.CDecimal(input)) / 100M);
     }
     return(price);
 }
Exemplo n.º 9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.m_ModelId = BasePage.RequestInt32("ModelID");
     this.m_NodeId  = BasePage.RequestInt32("NodeID");
     this.m_Action  = BasePage.RequestStringToLower("Action");
     if (((this.m_ModelId <= 0) || (this.m_NodeId <= 0)) || string.IsNullOrEmpty(this.m_Action))
     {
         DynamicPage.WriteUserErrMsg("添加信息参数错误!", "NavContent.aspx");
     }
     this.m_User            = Users.GetUsersByUserName(PEContext.Current.User.UserName);
     this.m_UserPurviewInfo = this.m_User.UserPurview;
     if (!base.IsPostBack)
     {
         if (this.m_Action == "add")
         {
             if (!EasyOne.Contents.Nodes.CheckNodePermission(this.m_NodeId))
             {
                 DynamicPage.WriteUserErrMsg("此栏目设置了有子节点时不允许向该栏目添加信息!", "ContentManage.aspx");
             }
             IList <FieldInfo> fieldList = Field.GetFieldList(this.m_ModelId, false);
             this.RepContentForm.DataSource = fieldList;
             this.RepContentForm.DataBind();
         }
         if (this.m_Action == "modify")
         {
             int generalId = BasePage.RequestInt32("GeneralID");
             this.m_ContentData = ContentManage.GetUserContentDataById(generalId);
             if (this.m_ContentData.Rows.Count <= 0)
             {
                 DynamicPage.WriteUserErrMsg("信息不存在", "ContentManage.aspx");
             }
             if (!this.m_UserPurviewInfo.ManageSelfPublicInfo && (DataConverter.CLng(this.m_ContentData.Rows[0]["Status"].ToString()) == 0x63))
             {
                 DynamicPage.WriteUserErrMsg("不能修改审核通过的信息", "ContentManage.aspx");
             }
             IList <FieldInfo> list2 = Field.GetFieldList(DataConverter.CLng(this.m_ContentData.Rows[0]["ModelID"].ToString()), false);
             this.RepContentForm.DataSource = list2;
             this.RepContentForm.DataBind();
         }
     }
 }
Exemplo n.º 10
0
        private void Add()
        {
            DataTable newContentData = ContentManage.GetNewContentData(this.GetDataTableFromRepeater());

            if (this.m_UserPurviewInfo == null)
            {
                this.m_UserPurviewInfo = new UserPurviewInfo();
                this.m_UserPurviewInfo.MaxPublicInfoOneDay = -1;
                this.m_UserPurviewInfo.GetExp = 1;
            }
            if ((this.m_UserPurviewInfo.MaxPublicInfoOneDay == 0) || (this.m_UserPurviewInfo.MaxPublicInfoOneDay > ContentManage.GetTodayPublicInfoCountByUserName(PEContext.Current.User.UserName)))
            {
                if (this.m_UserPurviewInfo.PublicInfoNoNeedCheck)
                {
                    DataRow[] rowArray = newContentData.Select("FieldName = 'status'");
                    if (rowArray[0]["FieldValue"].ToString() == "0")
                    {
                        rowArray[0]["FieldValue"] = "99";
                    }
                }
                this.SavePresentExp(newContentData, this.m_UserPurviewInfo, this.m_User);
                if (ContentManage.Add(this.m_ModelId, newContentData))
                {
                    if (ModelManager.GetModelInfoById(this.m_ModelId).EnableCharge)
                    {
                        this.AddCharge(newContentData);
                    }
                    this.AddKeywordsToTable(newContentData);
                    DynamicPage.WriteUserSuccessMsg("添加成功!", "ContentManage.aspx");
                }
                else
                {
                    DynamicPage.WriteUserErrMsg("添加失败!");
                }
            }
            else
            {
                DynamicPage.WriteUserErrMsg("你今天发布的内容信息总数大于网站设定的值,如要添加请与管理员联系!");
            }
        }
Exemplo n.º 11
0
 private void OverdueDisposal(UserPurviewInfo userPurviewInfo)
 {
     if (userPurviewInfo.ChargeByValidDate || userPurviewInfo.ChargeByPointOrValidDate)
     {
         this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_OutTime;
     }
     else
     {
         int logId = UserPointLog.GetValidPointLogId(this.m_UserInfo.UserName, this.m_ModelInfo.ModelId, this.m_CommonModelInfo.GeneralId, this.m_contentChargeInfo.ChargeType, this.m_contentChargeInfo.PitchTime, this.m_contentChargeInfo.ReadTimes);
         if (logId == 0)
         {
             if (this.m_UserInfo.UserPoint < this.m_contentChargeInfo.InfoPoint)
             {
                 this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_NeedPoint;
             }
             else if (this.m_Pay != "yes")
             {
                 this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_UsePoint;
             }
             else if (Users.MinusPoint(this.m_contentChargeInfo.InfoPoint, this.m_UserInfo.UserName))
             {
                 UserPointLogInfo userPointLogInfo = this.AddPointLogInfo();
                 userPointLogInfo.Point  = this.m_contentChargeInfo.InfoPoint;
                 userPointLogInfo.Remark = "用于查看收费" + this.m_ModelInfo.ItemName + this.m_CommonModelInfo.Title;
                 UserPointLog.Add(userPointLogInfo);
                 if ((this.m_contentChargeInfo.DividePercent > 0) && (this.m_contentChargeInfo.DividePercent < 100))
                 {
                     this.DividePoint(userPointLogInfo);
                 }
                 HttpContext.Current.Items.Add("IsPay", true);
             }
         }
         else
         {
             UserPointLog.UpdateTimes(this.m_UserTrueIP, logId);
             HttpContext.Current.Items.Add("IsPay", true);
         }
     }
 }
Exemplo n.º 12
0
        private static void PresentExp(CommonModelInfo commonInfo, int status)
        {
            UserInfo usersByUserName = Users.GetUsersByUserName(commonInfo.Inputer);

            if (!usersByUserName.IsNull)
            {
                UserPurviewInfo userPurview = usersByUserName.UserPurview;
                if (userPurview.IsNull)
                {
                    userPurview.MaxPublicInfoOneDay = -1;
                    userPurview.GetExp = 1;
                }
                if (userPurview.GetExp == 0)
                {
                    userPurview.GetExp = 1;
                }
                int num = EasyOne.Contents.Nodes.GetCacheNodeById(commonInfo.NodeId).Settings.PresentExp *userPurview.GetExp;
                if ((status == 0x63) && (commonInfo.Status < 0x63))
                {
                    usersByUserName.UserExp += num;
                    usersByUserName.PassedItems++;
                }
                if ((commonInfo.Status == 0x63) && (status < 0x63))
                {
                    usersByUserName.UserExp -= num;
                    if (status == -2)
                    {
                        usersByUserName.RejectItems++;
                    }
                    if (status == -3)
                    {
                        usersByUserName.DelItems++;
                    }
                }
                Users.Update(usersByUserName);
            }
        }
Exemplo n.º 13
0
        private static decimal GetMargin(OrderInfo orderInfo, UserInfo userInfo)
        {
            IList <OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(orderInfo.OrderId);
            decimal         num                  = 0M;
            decimal         totalMoney           = 0M;
            double          goodsWeight          = 0.0;
            decimal         num4                 = 0M;
            UserPurviewInfo userPurview          = userInfo.UserPurview;
            bool            haveWholesalePurview = false;

            if (userPurview != null)
            {
                haveWholesalePurview = userPurview.Enablepm;
            }
            foreach (OrderItemInfo info2 in infoListByOrderId)
            {
                if (string.IsNullOrEmpty(info2.TableName))
                {
                    PresentInfo presentById = Present.GetPresentById(info2.ProductId);
                    goodsWeight += presentById.Weight * info2.Amount;
                    totalMoney  += info2.SubTotal;
                }
                else
                {
                    ProductInfo productById = Product.GetProductById(info2.ProductId, info2.TableName);
                    if (!productById.IsNull)
                    {
                        AbstractItemInfo info5 = new ConcreteProductInfo(info2.Amount, info2.Property, productById, userInfo, orderInfo.NeedInvoice, true, haveWholesalePurview);
                        info5.GetItemInfo();
                        totalMoney  += info5.SubTotal;
                        goodsWeight += info5.TotalWeight;
                    }
                }
            }
            PackageInfo packageByGoodsWeight = Package.GetPackageByGoodsWeight(goodsWeight);

            if (!packageByGoodsWeight.IsNull)
            {
                goodsWeight += packageByGoodsWeight.PackageWeight;
            }
            num4 = DeliverCharge.GetDeliverCharge(orderInfo.DeliverType, goodsWeight, orderInfo.ZipCode, totalMoney, orderInfo.NeedInvoice);
            int couponId = orderInfo.CouponId;

            if (couponId > 0)
            {
                CouponInfo couponInfoById = Coupon.GetCouponInfoById(couponId);
                if (!couponInfoById.IsNull)
                {
                    totalMoney -= couponInfoById.Money;
                    if (totalMoney < 0M)
                    {
                        totalMoney = 0M;
                    }
                }
            }
            totalMoney += num4;
            num         = orderInfo.MoneyTotal - totalMoney;
            if (num < 0M)
            {
                num = 0M;
            }
            return(num);
        }
Exemplo n.º 14
0
 private void InValidate(UserPurviewInfo userPurviewInfo)
 {
     if (!userPurviewInfo.NotMinusPointNotWriteToLog)
     {
         int logId = UserPointLog.GetValidPointLogId(this.m_UserInfo.UserName, this.m_ModelInfo.ModelId, this.m_CommonModelInfo.GeneralId, this.m_contentChargeInfo.ChargeType, this.m_contentChargeInfo.PitchTime, this.m_contentChargeInfo.ReadTimes);
         if (logId == 0)
         {
             if ((userPurviewInfo.TotalViewInfoNumber > 0) && (UserPointLog.ViewTotalInfos(this.m_UserInfo.UserName) >= userPurviewInfo.TotalViewInfoNumber))
             {
                 this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_Overflow_Total;
             }
             else if ((userPurviewInfo.ViewInfoNumberOneDay > 0) && (UserPointLog.ViewInfosOneDay(this.m_UserInfo.UserName) >= userPurviewInfo.ViewInfoNumberOneDay))
             {
                 this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_Overflow_Today;
             }
             else if (string.IsNullOrEmpty(this.m_ErrMsg))
             {
                 if (userPurviewInfo.WriteToLog)
                 {
                     UserPointLogInfo userPointLogInfo = this.AddPointLogInfo();
                     userPointLogInfo.Point  = 0;
                     userPointLogInfo.Remark = string.Concat(new object[] { "有效期内查看收费", this.m_ModelInfo.ItemName, "应扣点数:", this.m_ModelInfo.ItemName, this.m_CommonModelInfo.Title, ",应扣点数:", this.m_contentChargeInfo.InfoPoint });
                     UserPointLog.Add(userPointLogInfo);
                 }
                 else if (this.m_UserInfo.UserPoint <= this.m_contentChargeInfo.InfoPoint)
                 {
                     if (userPurviewInfo.ChargeByPointOrValidDate)
                     {
                         this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_NeedPoint;
                     }
                     else
                     {
                         UserPointLogInfo info3 = this.AddPointLogInfo();
                         info3.Point  = 0;
                         info3.Remark = string.Concat(new object[] { "有效期内查看收费", this.m_ModelInfo.ItemName, "应扣点数:", this.m_ModelInfo.ItemName, this.m_CommonModelInfo.Title, ",应扣点数:", this.m_contentChargeInfo.InfoPoint });
                         UserPointLog.Add(info3);
                     }
                 }
                 else if (this.m_Pay != "yes")
                 {
                     this.m_ErrMsg = this.m_ErrMsg + this.m_errMsg_UsePoint;
                 }
                 else if (Users.MinusPoint(this.m_contentChargeInfo.InfoPoint, this.m_UserInfo.UserName))
                 {
                     UserPointLogInfo info2 = this.AddPointLogInfo();
                     info2.Point  = this.m_contentChargeInfo.InfoPoint;
                     info2.Remark = "有效期内查看收费" + this.m_ModelInfo.ItemName + this.m_CommonModelInfo.Title;
                     UserPointLog.Add(info2);
                     if ((this.m_contentChargeInfo.DividePercent > 0) && (this.m_contentChargeInfo.DividePercent < 100))
                     {
                         this.DividePoint(info2);
                     }
                     HttpContext.Current.Items.Add("IsPay", true);
                 }
             }
         }
         else
         {
             UserPointLog.UpdateTimes(this.m_UserTrueIP, logId);
             HttpContext.Current.Items.Add("IsPay", true);
         }
     }
 }
Exemplo n.º 15
0
        protected void BtnUpload_Click(object sender, EventArgs e)
        {
            if (!this.FupFile.HasFile)
            {
                this.ReturnManage("上传失败,重新上传。");
                return;
            }
            int  uploadFileMaxSize = 0;
            int  uploadSize        = 0;
            bool flag  = false;
            bool flag2 = false;

            if (!SiteConfig.SiteOption.EnableUploadFiles)
            {
                this.ReturnManage("权限错误:对不起网站没有开启上传权限。");
                return;
            }
            if (!PEContext.Current.Admin.Identity.IsAuthenticated)
            {
                if (!PEContext.Current.User.Identity.IsAuthenticated)
                {
                    UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(-2);
                    if (string.IsNullOrEmpty(userGroupById.GroupSetting))
                    {
                        this.ReturnManage("匿名会员组不存在!");
                        return;
                    }
                    UserPurviewInfo groupSetting = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
                    if (groupSetting.IsNull)
                    {
                        this.ReturnManage("匿名会员组没有进行权限设置!");
                        return;
                    }
                    if (!groupSetting.EnableUpload)
                    {
                        this.ReturnManage("匿名会员组没有开启上传权限!");
                        return;
                    }
                    uploadSize = groupSetting.UploadSize;
                }
                else
                {
                    if (!PEContext.Current.User.UserInfo.UserPurview.EnableUpload)
                    {
                        this.ReturnManage("所属会员组没有开启上传权限!");
                        return;
                    }
                    uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
                }
            }
            string str = Path.GetExtension(this.FupFile.FileName).ToLower();

            if (!this.CheckFilePostfix(str.Replace(".", "")))
            {
                this.ReturnManage("上传文件类型不对!必须上传" + this.m_FileExtArr + "的后缀名!");
                return;
            }
            if (string.Compare(this.m_ModuleName, "Node", StringComparison.OrdinalIgnoreCase) == 0)
            {
                FieldInfo           fieldInfoByFieldName = Field.GetFieldInfoByFieldName(this.m_ModelId, this.m_FieldName);
                Collection <string> settings             = fieldInfoByFieldName.Settings;
                switch (fieldInfoByFieldName.FieldType)
                {
                case FieldType.PictureType:
                    uploadFileMaxSize = DataConverter.CLng(settings[1]);
                    flag2             = DataConverter.CBoolean(settings[4]);
                    flag = DataConverter.CBoolean(settings[5]);
                    goto Label_01EA;

                case FieldType.FileType:
                    uploadFileMaxSize = DataConverter.CLng(settings[0]);
                    goto Label_01EA;
                }
            }
            else
            {
                uploadFileMaxSize = SiteConfig.SiteOption.UploadFileMaxSize;
            }
Label_01EA:
            if (!PEContext.Current.Admin.Identity.IsAuthenticated && (uploadFileMaxSize > uploadSize))
            {
                uploadFileMaxSize = uploadSize;
            }
            if (((int)this.FupFile.FileContent.Length) > (uploadFileMaxSize * 0x400))
            {
                this.ReturnManage("请上传小于" + uploadFileMaxSize.ToString() + "KB的文件!");
            }
            else
            {
                string str2     = DataSecurity.MakeFileRndName();
                string filename = FileSystemObject.CreateFileFolder((VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + this.FileSavePath()).Replace("//", "/"), HttpContext.Current) + str2 + str;
                this.FupFile.SaveAs(filename);
                string thumbnailPath = "";
                if (flag)
                {
                    thumbnailPath = this.m_ShowPath + str2 + "_S" + str;
                    Thumbs.GetThumbsPath(this.m_ShowPath + str2 + str, thumbnailPath);
                }
                else
                {
                    thumbnailPath = this.m_ShowPath + str2 + str;
                }
                if (flag2)
                {
                    WaterMark.AddWaterMark(this.m_ShowPath + str2 + str);
                }
                EasyOne.Model.Accessories.FileInfo fileInfo = new EasyOne.Model.Accessories.FileInfo();
                fileInfo.Name  = this.FupFile.FileName;
                fileInfo.Path  = thumbnailPath;
                fileInfo.Size  = (int)this.FupFile.FileContent.Length;
                fileInfo.Quote = 1;
                if (string.Compare(this.m_ModuleName, "soft", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    Files.Add(fileInfo);
                }
                this.GetScriptByModuleName(fileInfo);
                this.ReturnManage("上传成功!");
            }
        }
Exemplo n.º 16
0
        private void AddComment(XmlDocument xmlDoc)
        {
            CommentInfo commentInfo = new CommentInfo();

            commentInfo.CommentTitle = GetNodeInnerText(xmlDoc, "//commenttitle");
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                commentInfo.UserName = "******";
            }
            else
            {
                commentInfo.UserName = PEContext.Current.User.UserName;
            }
            commentInfo.Content        = GetNodeInnerText(xmlDoc, "//content");
            commentInfo.Email          = GetNodeInnerText(xmlDoc, "//email");
            commentInfo.Face           = GetNodeInnerText(xmlDoc, "//face");
            commentInfo.GeneralId      = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//gid"));
            commentInfo.NodeId         = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//nid"));
            commentInfo.TopicId        = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//tid"));
            commentInfo.IsPrivate      = DataConverter.CBoolean(GetNodeInnerText(xmlDoc, "//private", "true"));
            commentInfo.Position       = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//position"));
            commentInfo.Score          = DataConverter.CLng(GetNodeInnerText(xmlDoc, "//score", "3"));
            commentInfo.IP             = this.GetClientIP();
            commentInfo.UpdateDateTime = DateTime.Now.ToLocalTime();
            commentInfo.ReplyUserName  = GetNodeInnerText(xmlDoc, "//username", "游客");
            int      num           = string.Compare(commentInfo.UserName, "游客", StringComparison.OrdinalIgnoreCase);
            string   str           = "";
            NodeInfo cacheNodeById = Nodes.GetCacheNodeById(ContentManage.GetCommonModelInfoById(commentInfo.GeneralId).NodeId);

            commentInfo.Status = cacheNodeById.Settings.CommentNeedCheck;
            UserPurviewInfo userPurview = null;

            if (num != 0)
            {
                userPurview = PEContext.Current.User.UserInfo.UserPurview;
                if (userPurview.CommentNeedCheck)
                {
                    commentInfo.Status = true;
                }
                else
                {
                    commentInfo.Status = !cacheNodeById.Settings.CommentNeedCheck;
                }
            }
            else if (!cacheNodeById.Settings.EnableTouristsComment)
            {
                str = "noTourists";
            }
            else
            {
                commentInfo.Status = !cacheNodeById.Settings.CommentNeedCheck;
            }
            bool enableComment    = false;
            bool commentNeedCheck = false;

            if (userPurview != null)
            {
                enableComment    = userPurview.EnableComment;
                commentNeedCheck = userPurview.CommentNeedCheck;
            }
            if (string.IsNullOrEmpty(str))
            {
                if (cacheNodeById.Settings.EnableComment || enableComment)
                {
                    if (Comment.Add(commentInfo))
                    {
                        if (commentInfo.Status || commentNeedCheck)
                        {
                            str = "ok";
                        }
                        else
                        {
                            str = "check";
                        }
                    }
                    else
                    {
                        str = "err";
                    }
                }
                else
                {
                    str = "nopurview";
                }
            }
            this.XmlResponseWriter.WriteElementString("status", str);
        }
Exemplo n.º 17
0
 public static bool SaveUserPurview(UserPurviewInfo userPurviewInfo, int userId)
 {
     return(dal.SaveUserPurview(userPurviewInfo, userId));
 }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userName = PEContext.Current.User.UserName;

            if (!base.IsPostBack)
            {
                UserPurviewInfo userPurview = PEContext.Current.User.UserInfo.UserPurview;
                if (userPurview.MaxSendToUsers <= 0)
                {
                    DynamicPage.WriteErrMsg("对不起,你没有发送短消息的权限!");
                }
                this.LblMaxSendNum.Text = userPurview.MaxSendToUsers.ToString();
                string str2      = BasePage.RequestString("Action");
                int    messageId = BasePage.RequestInt32("MessageID");
                if (string.IsNullOrEmpty(BasePage.RequestString("inceptUser")))
                {
                    this.TxtInceptUser.Text = BasePage.RequestString("UserName");
                }
                else
                {
                    this.TxtInceptUser.Text = BasePage.RequestString("inceptUser");
                }
                if (!string.IsNullOrEmpty(str2) && (messageId == 0))
                {
                    DynamicPage.WriteErrMsg("指定的短消息ID错误!");
                }
                else
                {
                    string str3 = str2;
                    if (str3 != null)
                    {
                        if (!(str3 == "Edit"))
                        {
                            if (str3 == "Reply")
                            {
                                this.ShowModifyInfo(EasyOne.Accessories.Message.GetMessageOfReply(messageId, userName), str2);
                            }
                            else if (str3 == "Forward")
                            {
                                this.ShowModifyInfo(EasyOne.Accessories.Message.GetMessageOfForward(messageId, userName), str2);
                            }
                            else if (str3 == "Complain")
                            {
                                this.ShowComplain();
                            }
                            else if (str3 == "Commend")
                            {
                                this.ShowCommend();
                            }
                        }
                        else
                        {
                            this.ShowModifyInfo(EasyOne.Accessories.Message.GetMessageOfEdit(messageId, userName), str2);
                        }
                    }
                }
                this.DropFriends.DataSource = UserFriend.GetFriendNameList(PEContext.Current.User.UserName);
                this.DropFriends.DataBind();
                this.DropFriends.Items.Insert(0, new ListItem("请选择..."));
                this.DropFriends.Attributes.Add("onchange", "SelectFromFriend()");
            }
        }
        protected void BtnUpload_Click(object sender, EventArgs e)
        {
            int uploadSize = 0;

            if (!SiteConfig.SiteOption.EnableUploadFiles)
            {
                this.LblMessage.Text = "权限错误:你当前的网站没有开启上传功能,请检查你的网站配置。";
            }
            else
            {
                if (!PEContext.Current.Admin.Identity.IsAuthenticated)
                {
                    if (!PEContext.Current.User.Identity.IsAuthenticated)
                    {
                        UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(-2);
                        if (string.IsNullOrEmpty(userGroupById.GroupSetting))
                        {
                            this.LblMessage.Text = "匿名会员组不存在!";
                            return;
                        }
                        UserPurviewInfo groupSetting = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
                        if (groupSetting.IsNull)
                        {
                            this.LblMessage.Text = "匿名会员组没有进行权限设置!";
                            return;
                        }
                        if (!groupSetting.EnableUpload)
                        {
                            this.LblMessage.Text = "匿名会员组没有开启上传权限!";
                            return;
                        }
                        uploadSize = groupSetting.UploadSize;
                    }
                    else
                    {
                        if (!PEContext.Current.User.UserInfo.UserPurview.EnableUpload)
                        {
                            this.LblMessage.Text = "所属会员组没有开启上传权限!";
                            return;
                        }
                        uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
                    }
                }
                string str  = BasePage.RequestString("ReturnJSFunction");
                int    num2 = DataConverter.CLng(base.Request.Form["ThumbIndex"]);
                if (string.IsNullOrEmpty(str))
                {
                    str = "DealwithUpload";
                }
                StringBuilder builder = new StringBuilder();
                builder.Append("<script language=\"javascript\" type=\"text/javascript\">");
                if (!PEContext.Current.Admin.Identity.IsAuthenticated && (this.m_PhotoSize > uploadSize))
                {
                    this.m_PhotoSize = uploadSize;
                }
                int           num3     = 0;
                StringBuilder builder2 = new StringBuilder();
                for (int i = 0; i < 10; i++)
                {
                    num3++;
                    System.Web.UI.WebControls.FileUpload upload = (System.Web.UI.WebControls.FileUpload) this.FindControl("FileUpload" + i.ToString());
                    if (upload.HasFile)
                    {
                        string str2 = Path.GetExtension(upload.FileName).ToLower();
                        if (!this.CheckFilePostfix(str2.Replace(".", "")))
                        {
                            builder2.Append("文件" + upload.FileName + "上传文件类型不对!必须上传" + this.m_FileExtArr + @"的后缀名!\n");
                        }
                        else if (((int)upload.FileContent.Length) > (this.m_PhotoSize * 0x400))
                        {
                            builder2.Append("文件" + upload.FileName + "请上传小于" + this.m_PhotoSize.ToString() + @"KB的文件!\n");
                        }
                        else
                        {
                            string str3     = DataSecurity.MakeFileRndName() + i.ToString();
                            string filename = FileSystemObject.CreateFileFolder((VirtualPathUtility.AppendTrailingSlash(SiteConfig.SiteOption.UploadDir) + this.FileSavePath(upload.FileName)).Replace("//", "/"), HttpContext.Current) + str3 + str2;
                            upload.SaveAs(filename);
                            Thumbs.GetThumbsPath(this.m_ShowPath + str3 + str2, this.m_ShowPath + str3 + "_S" + str2);
                            if (this.m_Watermark)
                            {
                                WaterMark.AddWaterMark(this.m_ShowPath + str3 + str2);
                            }
                            EasyOne.Model.Accessories.FileInfo fileInfo = new EasyOne.Model.Accessories.FileInfo();
                            fileInfo.Name  = upload.FileName;
                            fileInfo.Path  = this.m_ShowPath + str3 + str2;
                            fileInfo.Size  = (int)upload.FileContent.Length;
                            fileInfo.Quote = 1;
                            Files.Add(fileInfo);
                            if (i == num2)
                            {
                                builder.Append("parent." + str + "ChangeThumbField(\"" + fileInfo.Path + "\",\"" + this.m_ShowPath + str3 + "_S" + str2 + "\");");
                            }
                            else
                            {
                                builder.Append("parent." + str + "DealwithUpload(\"" + fileInfo.Path + "\",\"" + fileInfo.Size.ToString() + "\",\"" + fileInfo.Id.ToString() + "\",\"" + this.m_ShowPath + str3 + "_S" + str2 + "\");");
                            }
                            builder2.Append("文件" + upload.FileName + @"上传成功!\n");
                        }
                    }
                }
                if (builder2.Length > 0)
                {
                    builder.Append("parent." + str + "ErrMessage(\"" + builder2.ToString() + "\");");
                }
                builder.Append("</script>");
                this.Page.ClientScript.RegisterStartupScript(base.GetType(), "UpdateParent", builder.ToString());
            }
        }
Exemplo n.º 20
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            int num = BasePage.RequestInt32("NodeId");

            if (num < 1)
            {
                DynamicPage.WriteErrMsg("<li>请选择隶属栏目!</li>");
            }
            CommentInfo commentInfo = new CommentInfo();

            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                commentInfo.UserName = "******";
            }
            else
            {
                commentInfo.UserName = PEContext.Current.User.UserName;
            }
            commentInfo.GeneralId      = BasePage.RequestInt32("ID");
            commentInfo.TopicId        = 1;
            commentInfo.NodeId         = num;
            commentInfo.CommentTitle   = StringHelper.RemoveXss(this.TxtCommentTitle.Text);
            commentInfo.Content        = StringHelper.RemoveXss(this.TxtCommentRestore.Text);
            commentInfo.UpdateDateTime = DateTime.Now;
            commentInfo.Score          = DataConverter.CLng(this.RadlScore.SelectedValue);
            commentInfo.Position       = DataConverter.CLng(this.RadlPosition.SelectedValue);
            commentInfo.IP             = PEContext.Current.UserHostAddress;
            commentInfo.IsPrivate      = this.ChkIsPrivate.Checked;
            int             num2 = string.Compare(commentInfo.UserName, "游客", StringComparison.CurrentCultureIgnoreCase);
            CommonModelInfo commonModelInfoById = ContentManage.GetCommonModelInfoById(commentInfo.GeneralId);

            if (commonModelInfoById.IsNull)
            {
                DynamicPage.WriteErrMsg("<li>评论不存在,请检查评论是否被删除!</li>");
            }
            NodeInfo cacheNodeById = Nodes.GetCacheNodeById(commonModelInfoById.NodeId);

            if (cacheNodeById.IsNull)
            {
                DynamicPage.WriteErrMsg("<li>栏目不存在,请检查栏目!</li>");
            }
            commentInfo.Status = cacheNodeById.Settings.CommentNeedCheck;
            UserPurviewInfo userPurview = null;

            if (num2 != 0)
            {
                userPurview = PEContext.Current.User.UserInfo.UserPurview;
                if (userPurview.CommentNeedCheck)
                {
                    commentInfo.Status = true;
                }
                else
                {
                    commentInfo.Status = !cacheNodeById.Settings.CommentNeedCheck;
                }
            }
            else if (!cacheNodeById.Settings.EnableTouristsComment)
            {
                DynamicPage.WriteErrMsg("<li>此栏目已禁止游客发表评论!</li>");
            }
            else
            {
                commentInfo.Status = !cacheNodeById.Settings.CommentNeedCheck;
            }
            bool enableComment    = false;
            bool commentNeedCheck = false;

            if (userPurview != null)
            {
                enableComment    = userPurview.EnableComment;
                commentNeedCheck = userPurview.CommentNeedCheck;
            }
            if (cacheNodeById.Settings.EnableComment || enableComment)
            {
                if (Comment.Add(commentInfo))
                {
                    string returnurl = "../Item/" + BasePage.RequestInt32("ID").ToString() + ".aspx";
                    if (commentInfo.Status || commentNeedCheck)
                    {
                        DynamicPage.WriteSuccessMsg("<li>添加评论成功!</li>", returnurl);
                    }
                    else
                    {
                        DynamicPage.WriteSuccessMsg("<li>发表评论成功,请等待管理员审核。</li>", returnurl);
                    }
                }
                else
                {
                    DynamicPage.WriteErrMsg("<li>添加评论失败,请返回!</li>");
                }
            }
            else
            {
                DynamicPage.WriteErrMsg("<li>此栏目已禁止发表评论!</li>");
            }
        }
Exemplo n.º 21
0
        protected override void OnLoad(EventArgs e)
        {
            HttpPostedFile file              = base.Request.Files["NewFile"];
            string         str               = Path.GetExtension(file.FileName).ToLower();
            string         uploaderType      = base.Request.Form["UploaderType"];
            bool           flag              = DataConverter.CBoolean(base.Request.Form["IsWatermark"]);
            bool           flag2             = DataConverter.CBoolean(base.Request.Form["IsThumb"]);
            int            modelId           = DataConverter.CLng(base.Request.Form["ModelId"]);
            string         str3              = DataSecurity.FilterBadChar(base.Request.Form["FieldName"]);
            string         allowSuffix       = "";
            int            uploadFileMaxSize = 0;
            int            uploadSize        = 0;
            string         customMsg         = "请检查网站信息配置是否设置允许的上传文件大小!";

            if (!SiteConfig.SiteOption.EnableUploadFiles)
            {
                this.SendResults(0xcc);
            }
            else
            {
                if (!PEContext.Current.Admin.Identity.IsAuthenticated)
                {
                    if (!PEContext.Current.User.Identity.IsAuthenticated)
                    {
                        UserGroupsInfo userGroupById = UserGroups.GetUserGroupById(-2);
                        if (string.IsNullOrEmpty(userGroupById.GroupSetting))
                        {
                            this.SendResults(1, "", "", "匿名会员组不存在!");
                            return;
                        }
                        UserPurviewInfo groupSetting = UserGroups.GetGroupSetting(userGroupById.GroupSetting);
                        if (groupSetting.IsNull)
                        {
                            this.SendResults(1, "", "", "匿名会员组没有进行权限设置!");
                            return;
                        }
                        if (!groupSetting.EnableUpload)
                        {
                            this.SendResults(1, "", "", "匿名会员组没有开启上传权限!");
                            return;
                        }
                        uploadSize = groupSetting.UploadSize;
                    }
                    else
                    {
                        if (!PEContext.Current.User.UserInfo.UserPurview.EnableUpload)
                        {
                            this.SendResults(1, "", "", "所属会员组没有开启上传权限!");
                            return;
                        }
                        uploadSize = PEContext.Current.User.UserInfo.UserPurview.UploadSize;
                    }
                }
                if ((file == null) || (file.ContentLength == 0))
                {
                    this.SendResults(0xca);
                }
                else
                {
                    if ((modelId == 0) || string.IsNullOrEmpty(str3))
                    {
                        if (!ConfigurationManager.AppSettings["EasyOne:DefaultUploadSuffix"].ToLower().Contains(str))
                        {
                            this.SendResults(1, "", "", "不允许上传动态页文件!");
                            return;
                        }
                        uploadFileMaxSize = SiteConfig.SiteOption.UploadFileMaxSize;
                    }
                    else
                    {
                        IList <FieldInfo> fieldListByModelId = ModelManager.GetFieldListByModelId(modelId);
                        if ((fieldListByModelId != null) && (fieldListByModelId.Count > 0))
                        {
                            foreach (FieldInfo info3 in fieldListByModelId)
                            {
                                if (string.CompareOrdinal(info3.FieldName, str3) == 0)
                                {
                                    allowSuffix = GetAllowSuffix(info3, uploaderType);
                                    if (info3.Settings.Count > 7)
                                    {
                                        uploadFileMaxSize = DataConverter.CLng(info3.Settings[7]);
                                    }
                                    break;
                                }
                            }
                        }
                        if (string.IsNullOrEmpty(allowSuffix))
                        {
                            this.SendResults(1, "", "", "字段内容控件没有填写允许上传的后缀!");
                            return;
                        }
                        if (!allowSuffix.Contains(str.Replace(".", "")))
                        {
                            this.SendResults(1, "", "", "这种文件类型不允许上传!只允许上传这几种文件类型:" + allowSuffix);
                            return;
                        }
                        customMsg = "请检查所属字段控件是否设置了允许上传文件大小!";
                    }
                    if (uploadFileMaxSize <= 0)
                    {
                        this.SendResults(1, "", "", customMsg);
                    }
                    else
                    {
                        if (!PEContext.Current.Admin.Identity.IsAuthenticated && (uploadFileMaxSize > uploadSize))
                        {
                            uploadFileMaxSize = uploadSize;
                        }
                        if (file.ContentLength > (uploadFileMaxSize * 0x400))
                        {
                            this.SendResults(1, "", "", "请上传小于" + uploadFileMaxSize.ToString() + "KB的文件!");
                        }
                        else
                        {
                            string str9;
                            int    errorNumber = 0;
                            string fileUrl     = "";
                            string str7        = DataSecurity.MakeFileRndName();
                            string str8        = str7 + str;
                            int    num5        = 0;
                            while (true)
                            {
                                str9 = Path.Combine(base.UserFilesDirectory, str8);
                                if (!File.Exists(str9))
                                {
                                    break;
                                }
                                num5++;
                                str8        = string.Concat(new object[] { Path.GetFileNameWithoutExtension(file.FileName), "(", num5, ")", Path.GetExtension(file.FileName) });
                                errorNumber = 0xc9;
                            }
                            file.SaveAs(str9);
                            fileUrl = base.UserFilesPath + str8;
                            if (!string.IsNullOrEmpty(uploaderType) && (string.CompareOrdinal(uploaderType, "Photo") == 0))
                            {
                                string oldValue = "";
                                if (base.Request.ApplicationPath.EndsWith("/", StringComparison.Ordinal))
                                {
                                    oldValue = ("/" + SiteConfig.SiteOption.UploadDir + "/").Replace("//", "/");
                                }
                                else
                                {
                                    oldValue = base.Request.ApplicationPath + "/" + SiteConfig.SiteOption.UploadDir;
                                }
                                if (flag2)
                                {
                                    string str11 = base.UserFilesPath + str7 + "_S" + str;
                                    Thumbs.GetThumbsPath(fileUrl.Replace(oldValue, ""), str11.Replace(oldValue, ""));
                                }
                                if (flag)
                                {
                                    WaterMark.AddWaterMark(fileUrl.Replace(oldValue, ""));
                                }
                            }
                            this.SendResults(errorNumber, fileUrl, str8);
                        }
                    }
                }
            }
        }