Exemple #1
0
        public static int BindAttachment(Attachment[] atts, int topicId, int postId, int userId, UserGroup userGroupInfo)
        {
            int num = 0;

            for (int i = 0; i < atts.Length; i++)
            {
                if (atts[i] != null)
                {
                    if (atts[i].Pid == 0)
                    {
                        num++;
                    }

                    var str = atts[i].ID.ToString();
                    atts[i].Uid          = userId;
                    atts[i].Tid          = topicId;
                    atts[i].Pid          = postId;
                    atts[i].PostDateTime = DateTime.Now;
                    atts[i].ReadPerm     = 0;
                    int num2 = DNTRequest.GetString("attachprice_" + str).ToInt(0);
                    atts[i].AttachPrice = num2 == 0 ? 0 : userGroupInfo.CheckMaxPrice(num2);
                    int num3 = DNTRequest.GetString("readperm_" + str).ToInt(0);
                    if (num3 != 0)
                    {
                        int num4 = num3;
                        num4             = ((num4 > 255) ? 255 : num4);
                        atts[i].ReadPerm = num4;
                    }
                    atts[i].Description = DNTRequest.GetHtmlEncodeString("attachdesc_" + str);
                }
            }
            return(num);
        }