示例#1
0
        private static bool CheckUserCreditsIsEnough(int uid, int mount, CreditsOperationType creditsOperationType, int pos)
        {
            DataTable scoreSet = Scoresets.GetScoreSet();

            scoreSet.PrimaryKey = new DataColumn[]
            {
                scoreSet.Columns["id"]
            };
            float[] array = new float[8];
            for (int i = 0; i < 8; i++)
            {
                array[i] = (Single)scoreSet.Rows[(int)creditsOperationType]["extcredits" + (i + 1)].ToDouble();
            }
            if (pos < 0)
            {
                for (int j = 0; j < 8; j++)
                {
                    if (array[j].ToDouble() < 0f)
                    {
                        return(User.CheckUserCreditsIsEnough(uid, array, pos, mount));
                    }
                }
            }
            return(true);
        }
示例#2
0
        private static DataTable CreateGroupScoreTable()
        {
            DataTable dataTable = new DataTable("templateDT");

            dataTable.Columns.Add("id", typeof(Int32));
            dataTable.Columns.Add("available", typeof(Boolean));
            dataTable.Columns.Add("ScoreCode", typeof(Int32));
            dataTable.Columns.Add("ScoreName", typeof(String));
            dataTable.Columns.Add("Min", typeof(String));
            dataTable.Columns.Add("Max", typeof(String));
            dataTable.Columns.Add("MaxInDay", typeof(String));
            dataTable.Columns.Add("Options", typeof(String));
            for (int i = 0; i < 8; i++)
            {
                DataRow dataRow = dataTable.NewRow();
                dataRow["id"]        = i + 1;
                dataRow["available"] = false;
                dataRow["ScoreCode"] = i + 1;
                dataRow["ScoreName"] = "";
                dataRow["Min"]       = "";
                dataRow["Max"]       = "";
                dataRow["MaxInDay"]  = "";
                dataTable.Rows.Add(dataRow);
            }
            DataRow dataRow2 = Scoresets.GetScoreSet().Rows[0];

            for (int j = 0; j < 8; j++)
            {
                if (!Utils.StrIsNullOrEmpty(dataRow2[j + 2].ToString()) && dataRow2[j + 2].ToString().Trim() != "0")
                {
                    dataTable.Rows[j]["ScoreName"] = dataRow2[j + 2].ToString().Trim();
                }
            }
            return(dataTable);
        }
示例#3
0
        //public static bool NeedAudit(Int32 fid, Int32 modnewposts, int useradminid, int userid, UserGroup userGroup, Topic topicInfo = null)
        //{
        //    //return useradminid != 1 && !Moderators.IsModer(useradminid, userid, fid) && (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods) || modnewposts == 1 || userGroup != null && userGroup.ModNewPosts == 1 || topicInfo != null && topicInfo.Displayorder == -2);

        //    if (useradminid == 1) return false;
        //    if (Moderators.IsModer(useradminid, userid, fid)) return false;

        //    if (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods)) return true;
        //    if (modnewposts == 1) return true;
        //    if (userGroup != null && userGroup.ModNewPosts == 1) return true;
        //    if (topicInfo != null && topicInfo.DisplayOrder == -2) return true;

        //    return false;
        //}

        public static bool NeedAudit(Int32 fid, Int32 modnewposts, int useradminid, int userid, UserGroup userGroup, Topic topicInfo = null)
        {
            //return useradminid != 1 && !Moderators.IsModer(useradminid, userid, fid) && (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods) || modnewposts == 1 || userGroup != null && userGroup.ModNewPosts == 1 || topicInfo != null && topicInfo.Displayorder == -2);

            if (useradminid == 1)
            {
                return(false);
            }
            if (Moderators.IsModer(useradminid, userid, fid))
            {
                return(false);
            }

            if (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods))
            {
                return(true);
            }
            if (modnewposts == 1)
            {
                return(true);
            }
            if (userGroup != null && userGroup.ModNewPosts == 1)
            {
                return(true);
            }
            if (topicInfo != null && topicInfo.DisplayOrder == -2)
            {
                return(true);
            }

            return(false);
        }
示例#4
0
 public static string ConvertCreditAndAmountToWord(int credit, int amount)
 {
     if (credit < 1 || credit > 8)
     {
         return("0");
     }
     string[] validScoreName = Scoresets.GetValidScoreName();
     string[] validScoreUnit = Scoresets.GetValidScoreUnit();
     return(string.Format("{0}:{1}{2}", validScoreName[credit], amount, validScoreUnit[credit]));
 }
示例#5
0
        //public static string GetTopicCountCondition(out string type, string gettype, Int32 getnewtopic)
        //{
        //    return BBX.Data.Topics.GetTopicCountCondition(out type, gettype, getnewtopic);
        //}

        //public static Int32 GetTopicListCount(string postName, Int32 forumId, string posterList, string keyList, string startDate, string endDate)
        //{
        //    return BBX.Data.Topics.GetTopicListCount(postName, forumId, posterList, keyList, startDate, endDate);
        //}

        //public static Int32 GetHotTopicsCount(Int32 fid, Int32 timeBetween)
        //{
        //    return BBX.Data.Topics.GetHotTopicsCount(fid, timeBetween);
        //}

        //public static DataTable GetTopicList(string postName, Int32 forumId, string posterList, string keyList, string startDate, string endDate, Int32 pageSize, Int32 currentPage)
        //{
        //    return BBX.Data.Topics.GetTopicList(postName, forumId, posterList, keyList, startDate, endDate, pageSize, currentPage);
        //}

        //public static DataTable GetHotTopicsList(Int32 pageSize, Int32 pageIndex, Int32 fid, string showType, Int32 timeBetween)
        //{
        //    return BBX.Data.Topics.GetHotTopicsList(pageSize, pageIndex, fid, showType, timeBetween);
        //}

        //public static void PassAuditNewTopic(string tidList)
        //{
        //    string[] array = tidList.Split(',');
        //    for (Int32 i = 0; i < array.Length; i++)
        //    {
        //        string s = array[i];
        //        TopicInfo topicInfo = Topics.GetTopicInfo(Int32.Parse(s));
        //        CreditsFacade.PostTopic(topicInfo.Posterid, Forums.GetForumInfo(topicInfo.Fid));
        //    }
        //    BBX.Data.Topics.PassAuditNewTopic(TableList.GetPostTableId(), tidList);
        //}

        //public static void UpdateMyTopic()
        //{
        //    BBX.Data.Topics.UpdateMyTopic();
        //}

        //public static Int32 GetTitleDisplayOrder(UserGroup usergroupinfo, Int32 useradminid, IXForum forum, TopicInfo tp, string message, Boolean disablepost)
        //{
        //    if (useradminid == 1 || Moderators.IsModer(useradminid, tp.Posterid, forum.Fid))
        //    {
        //        return tp.Displayorder;
        //    }
        //    if (forum.Modnewtopics == 1 || usergroupinfo.ModNewTopics == 1 || (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods) && !disablepost) || ForumUtils.HasAuditWord(tp.Title) || ForumUtils.HasAuditWord(message))
        //    {
        //        return -2;
        //    }
        //    return tp.Displayorder;
        //}

        public static Int32 GetTitleDisplayOrder(UserGroup usergroupinfo, Int32 useradminid, IXForum forum, Topic tp, string message, Boolean disablepost)
        {
            if (useradminid == 1 || Moderators.IsModer(useradminid, tp.PosterID, forum.Fid))
            {
                return(tp.DisplayOrder);
            }
            if (forum.Modnewtopics == 1 || usergroupinfo.ModNewTopics == 1 || (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods) && !disablepost) || ForumUtils.HasAuditWord(tp.Title) || ForumUtils.HasAuditWord(message))
            {
                return(-2);
            }
            return(tp.DisplayOrder);
        }
示例#6
0
文件: Stats.cs 项目: xiongeee/BBX
        public static User[][] GetExtsRankUserArray()
        {
            List <User[]> list = new List <User[]>();

            string[] validScoreName = Scoresets.GetValidScoreName();
            for (int i = 1; i < 9; i++)
            {
                if (validScoreName[i] == string.Empty)
                {
                    list.Add(new User[0]);
                }
                else
                {
                    list.Add(Stats.GetUserArray("extcredits" + i.ToString()));
                }
            }
            return(list.ToArray());
        }
示例#7
0
 public static void PostTopic(int userId, IXForum forumInfo, bool isNeedAnimation)
 {
     if (userId == -1)
     {
         return;
     }
     float[] values = Forums.GetValues(forumInfo.PostcrEdits);
     if (values != null)
     {
         UpdateUserExtCredits(userId, values, false);
     }
     else
     {
         UpdateUserExtCredits(userId, 1, CreditsOperationType.PostTopic, 1, false);
     }
     if (isNeedAnimation)
     {
         WriteUpdateUserExtCreditsCookies((values != null) ? values : Scoresets.GetUserExtCredits(CreditsOperationType.PostTopic));
     }
 }
示例#8
0
        //public static void PostReply(int userId, IXForum forumInfo, bool isNeedAnimation = false)
        public static void PostReply(int userId, String replyCredits, bool isNeedAnimation = false)
        {
            if (userId == -1)
            {
                return;
            }

            float[] values = Forums.GetValues(replyCredits);
            if (values != null)
            {
                UpdateUserExtCredits(userId, values, false);
            }
            else
            {
                UpdateUserExtCredits(userId, 1, CreditsOperationType.PostReply, 1, false);
            }
            if (isNeedAnimation)
            {
                WriteUpdateUserExtCreditsCookies((values != null) ? values : Scoresets.GetUserExtCredits(CreditsOperationType.PostReply));
            }
        }
示例#9
0
        public static bool Search(int userid, DateTime lastsearchtime, int useradminid, UserGroup usergroupinfo, ref string msg)
        {
            var config = GeneralConfigInfo.Current;

            if (useradminid != 1 && DNTRequest.GetInt("keywordtype", 0) == 1 && !usergroupinfo.DisablePeriodctrl)
            {
                string str = "";
                if (Scoresets.BetweenTime(config.Searchbanperiods, out str))
                {
                    msg = "在此时间段( " + str + " )内用户不可以进行全文搜索";
                    return(false);
                }
            }
            if (useradminid != 1)
            {
                if (!Statistic.CheckSearchCount(config.Maxspm))
                {
                    msg = "抱歉,系统在一分钟内搜索的次数超过了系统安全设置的上限,请稍候再试";
                    return(false);
                }
                //int num = Utils.StrDateDiffSeconds(lastsearchtime, config.Searchctrl);
                var ts = lastsearchtime.AddSeconds(config.Searchctrl) - DateTime.Now;
                if (ts.TotalSeconds > 0)
                {
                    msg = "系统规定搜索间隔为" + config.Searchctrl + "秒, 您还需要等待 " + ts.TotalSeconds + " 秒";
                    return(false);
                }
                if (userid != -1 && CreditsFacade.Search(userid) == -1)
                {
                    string str2 = "";
                    if (EPayments.IsOpenEPayments())
                    {
                        str2 = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>";
                    }
                    msg = "您的积分不足, 不能执行搜索操作" + str2;
                    return(false);
                }
            }
            return(true);
        }
示例#10
0
        public static bool CheckPostTimeSpan(UserGroup userGroupInfo, AdminGroup admininfo, Online olUserInfo, IUser user, ref string msg)
        {
            var cfg = GeneralConfigInfo.Current;

            if (olUserInfo.AdminID != 1 && !userGroupInfo.DisablePeriodctrl)
            {
                var str = "";
                if (Scoresets.BetweenTime(cfg.Postbanperiods, out str))
                {
                    msg = "在此时间段( " + str + " )内用户不可以发帖";
                    return(false);
                }
            }
            if (admininfo == null || !admininfo.DisablePostctrl)
            {
                var ts = olUserInfo.LastPostTime.AddSeconds(cfg.Postinterval) - DateTime.Now;
                if (ts.TotalSeconds > 0)
                {
                    msg = "系统规定发帖间隔为" + cfg.Postinterval + "秒, 您还需要等待 " + ts.TotalSeconds + " 秒";
                    return(false);
                }
                if (olUserInfo.UserID != -1)
                {
                    if (user == null)
                    {
                        msg = "您的用户资料出现错误";
                        return(false);
                    }
                    //num = Utils.StrDateDiffMinutes(text, cfg.Newbiespan);
                    ts = user.JoinDate.AddMinutes(cfg.Newbiespan) - DateTime.Now;
                    if (ts.TotalMinutes > 0)
                    {
                        msg = "系统规定新注册用户必须要在" + cfg.Newbiespan + "分钟后才可以发帖, 您还需要等待 " + ts.TotalMinutes + " 分钟";
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#11
0
文件: Posts.cs 项目: xiongeee/BBX
        public static EntityList<Post> GetPagedLastPost(PostpramsInfo ppi)
        {
            var list = Post.GetPagedLastPost(ppi);
            var random = new Random((int)DateTime.Now.Ticks);
            int inPostAdCount = Advertisement.GetInPostAdCount("", ppi.Fid);
            foreach (var pi in list)
            {
                ppi.Smileyoff = pi.SmileyOff;
                ppi.BBCode = pi.BBCodeOff < 1;
                ppi.Parseurloff = pi.ParseUrlOff;
                ppi.Allowhtml = pi.HtmlOn;
                ppi.Pid = pi.ID;

                var msg = pi.Message;
                ppi.Sdetail = msg;
                if (ppi.Price > 0 && pi.Layer == 0)
                {
                    var ue = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
                    msg = string.Format("<div class=\"paystyle\">此帖为交易帖,要付 {0} <span class=\"bold\">{1}</span>{2} 才可查看</div>", ue.Name, ppi.Price, ue.Unit);
                }
                else
                {
                    if (!ppi.Ubbmode)
                        msg = UBB.UBBToHTML(ppi);
                    else
                        msg = Utils.HtmlEncode(msg);
                }
                pi.Adindex = random.Next(0, inPostAdCount);
                if (ppi.Jammer == 1) msg = ForumUtils.AddJammer(msg);
                pi.Html = msg;

                if (!pi["showemail"].ToBoolean())
                {
                    pi["email"] = "";
                }
            }
            return list;
        }
示例#12
0
        public static void DeletePost(Post pi, bool reserveAttach)
        {
            var config = GeneralConfigInfo.Current;

            if (config.Losslessdel == 0 || pi.PostDateTime.AddHours(config.Losslessdel * 24) > DateTime.Now)
            {
                var     type      = (pi.Layer == 0) ? CreditsOperationType.PostTopic : CreditsOperationType.PostReply;
                var     forumInfo = pi.Forum as IXForum;
                float[] array     = Forums.GetValues((type == CreditsOperationType.PostTopic) ? forumInfo.PostcrEdits : forumInfo.ReplycrEdits);
                if (array == null)
                {
                    array = Scoresets.GetUserExtCredits(type);
                }
                UpdateUserExtCredits(pi.PosterID, array, 1, type, -1, true);
                if (!reserveAttach)
                {
                    int att = Attachment.FindCountByPid(pi.ID);
                    if (att != 0)
                    {
                        DeleteAttachments(pi.PosterID, att);
                    }
                }
            }
        }
示例#13
0
文件: Bonus.cs 项目: xiongeee/BBX
        public static void CloseBonus(TopicInfo topicinfo, int userid, int[] postIdArray, int[] winerIdArray, string[] winnerNameArray, string[] costBonusArray, string[] valuableAnswerArray, int bestAnswer)
        {
            int isbest = 0;

            topicinfo.Special = 3;
            Topics.UpdateTopic(topicinfo);
            for (int i = 0; i < winerIdArray.Length; i++)
            {
                int num = TypeConverter.StrToInt(costBonusArray[i]);
                if (winerIdArray[i] > 0 && num > 0)
                {
                    Users.UpdateUserExtCredits(winerIdArray[i], Scoresets.GetBonusCreditsTrans(), (float)num);
                }
                if (Utils.InArray(postIdArray[i].ToString(), valuableAnswerArray))
                {
                    isbest = 1;
                }
                if (postIdArray[i] == bestAnswer)
                {
                    isbest = 2;
                }
                BBX.Data.Bonus.AddLog(topicinfo.Tid, topicinfo.Posterid, winerIdArray[i], winnerNameArray[i], postIdArray[i], num, Scoresets.GetBonusCreditsTrans(), isbest);
            }
        }
示例#14
0
        public static int GetUserCreditsByUserInfo(IUser shortUserInfo)
        {
            string text = Scoresets.GetScoreCalFormula();

            if (text.IsNullOrEmpty())
            {
                return(0);
            }
            text = text.Replace("digestposts", shortUserInfo.DigestPosts.ToString());
            text = text.Replace("posts", shortUserInfo.Posts.ToString());
            text = text.Replace("oltime", shortUserInfo.OLTime.ToString());
            text = text.Replace("pageviews", shortUserInfo.PageViews.ToString());
            text = text.Replace("extcredits1", shortUserInfo.ExtCredits1.ToString());
            text = text.Replace("extcredits2", shortUserInfo.ExtCredits2.ToString());
            text = text.Replace("extcredits3", shortUserInfo.ExtCredits3.ToString());
            text = text.Replace("extcredits4", shortUserInfo.ExtCredits4.ToString());
            text = text.Replace("extcredits5", shortUserInfo.ExtCredits5.ToString());
            text = text.Replace("extcredits6", shortUserInfo.ExtCredits6.ToString());
            text = text.Replace("extcredits7", shortUserInfo.ExtCredits7.ToString());
            text = text.Replace("extcredits8", shortUserInfo.ExtCredits8.ToString());
            object strValue = Arithmetic.ComputeExpression(text);

            return((Int32)Math.Floor(strValue.ToDouble()));
        }
示例#15
0
文件: Stats.cs 项目: xiongeee/BBX
        public static string GetUserRankHtml(IUser[] users, string type, int maxrows)
        {
            var    sb   = new StringBuilder();
            string text = "";
            int    num  = maxrows;

            //int i = 0;
            //while (i < users.Length)
            for (int i = 0; i < users.Length; i++, num--)
            {
                var user = users[i];
                if (user == null)
                {
                    continue;
                }

                string str = string.Empty;
                if (type != null)
                {
                    switch (type)
                    {
                    case "credits":
                        str = user.Credits + "";
                        break;

                    case "extcredits1":
                        str  = user.ExtCredits1 + "";
                        text = Scoresets.GetValidScoreUnit()[1];
                        break;

                    case "extcredits2":
                        str  = user.ExtCredits2 + "";
                        text = Scoresets.GetValidScoreUnit()[2];
                        break;

                    case "extcredits3":
                        str  = user.ExtCredits3 + "";
                        text = Scoresets.GetValidScoreUnit()[3];
                        break;

                    case "extcredits4":
                        str  = user.ExtCredits4 + "";
                        text = Scoresets.GetValidScoreUnit()[4];
                        break;

                    case "extcredits5":
                        str  = user.ExtCredits5 + "";
                        text = Scoresets.GetValidScoreUnit()[5];
                        break;

                    case "extcredits6":
                        str  = user.ExtCredits6 + "";
                        text = Scoresets.GetValidScoreUnit()[6];
                        break;

                    case "extcredits7":
                        str  = user.ExtCredits7 + "";
                        text = Scoresets.GetValidScoreUnit()[7];
                        break;

                    case "extcredits8":
                        str  = user.ExtCredits8 + "";
                        text = Scoresets.GetValidScoreUnit()[8];
                        break;

                    case "digestposts":
                        str = user.DigestPosts + "";
                        break;

                    case "onlinetime":
                        str  = Math.Round(user["OnlineTime"].ToDouble() / 60.0, 2).ToString();
                        text = "小时";
                        break;

                    default:
                        //goto IL_259;
                        break;
                    }
                }
                //IL_259:
                str = user.Posts.ToString();
                //    goto IL_26A;
                //IL_26A:
                sb.AppendFormat("<li><em>{0}</em><a href=\"{1}\" target=\"_blank\">{2}</a></li>", str + ((text == string.Empty) ? string.Empty : (" " + text)), Urls.UserInfoAspxRewrite(user.ID), user.Name);
                //num--;
                //i++;
                //continue;
            }
            for (int j = 0; j < num; j++)
            {
                sb.Append("<li>&nbsp;</li>");
            }
            return(sb.ToString());
        }
示例#16
0
 public static int GetTopicPostInvisible(IXForum forum, int useradminid, int uid, UserGroup userGroup, Post postinfo)
 {
     if (useradminid == 1 || Moderators.IsModer(useradminid, uid, forum.Fid))
     {
         return(0);
     }
     if (!ForumUtils.HasAuditWord(postinfo.Message) && forum.Modnewtopics == 0 && userGroup.ModNewTopics == 0 && !Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods))
     {
         return(0);
     }
     return(1);
 }
示例#17
0
 private bool ValidateUserPermission()
 {
     if (this.onlineusercount >= this.config.Maxonlines && this.useradminid != 1 && this.pagename != "login.aspx" && this.pagename != "logout.aspx")
     {
         this.ShowMessage("抱歉,目前访问人数太多,你暂时无法访问论坛.", 0);
         return(false);
     }
     if (!this.usergroupinfo.AllowVisit && this.useradminid != 1 && this.pagename != "login.aspx" && this.pagename != "register.aspx" && this.pagename != "logout.aspx" && this.pagename != "activationuser.aspx" && this.pagename != "getpassword.aspx")
     {
         this.ShowMessage("抱歉, 您所在的用户组 \"" + usergroupinfo.GroupTitle + "\" 不允许访问论坛", 2);
         return(false);
     }
     if (!this.config.Ipaccess.IsNullOrWhiteSpace())
     {
         string[] iparray = Utils.SplitString(this.config.Ipaccess, "\n");
         if (!Utils.InIPArray(WebHelper.UserHost, iparray))
         {
             this.ShowMessage("抱歉, 系统设置了IP访问列表限制, 您无法访问本论坛", 0);
             return(false);
         }
     }
     if (!this.config.Ipdenyaccess.IsNullOrWhiteSpace())
     {
         string[] iparray2 = Utils.SplitString(this.config.Ipdenyaccess, "\n");
         if (Utils.InIPArray(WebHelper.UserHost, iparray2))
         {
             this.ShowMessage("由于您严重违反了论坛的相关规定, 已被禁止访问.", 2);
             return(false);
         }
     }
     if (this.useradminid != 1 && this.pagename != "login.aspx" && this.pagename != "logout.aspx" && !this.usergroupinfo.DisablePeriodctrl && Scoresets.BetweenTime(this.config.Visitbanperiods))
     {
         this.ShowMessage("在此时间段内不允许访问本论坛", 2);
         return(false);
     }
     return(true);
 }
示例#18
0
        public static void WriteUserCreditsCookie(IUser userInfo, string groupTitle)
        {
            if (userInfo == null)
            {
                return;
            }
            string[] validScoreName = Scoresets.GetValidScoreName();
            string[] validScoreUnit = Scoresets.GetValidScoreUnit();
            string   text           = "积分:" + userInfo.Credits + ",";

            text = text + "用户组:" + groupTitle + ",";
            for (int i = 0; i < validScoreName.Length; i++)
            {
                string key;
                if (!Utils.StrIsNullOrEmpty(validScoreName[i]) && (key = "Extcredits" + i) != null)
                {
                    switch (key)
                    {
                    case "Extcredits1":
                    {
                        object obj = text;
                        text = obj + validScoreName[i] + ": " + userInfo.ExtCredits1 + validScoreUnit[1] + ",";
                        break;
                    }

                    case "Extcredits2":
                    {
                        object obj2 = text;
                        text = obj2 + validScoreName[i] + ": " + userInfo.ExtCredits2 + validScoreUnit[2] + ",";
                        break;
                    }

                    case "Extcredits3":
                    {
                        object obj3 = text;
                        text = obj3 + validScoreName[i] + ": " + userInfo.ExtCredits3 + validScoreUnit[3] + ",";
                        break;
                    }

                    case "Extcredits4":
                    {
                        object obj4 = text;
                        text = obj4 + validScoreName[i] + ": " + userInfo.ExtCredits4 + validScoreUnit[4] + ",";
                        break;
                    }

                    case "Extcredits5":
                    {
                        object obj5 = text;
                        text = obj5 + validScoreName[i] + ": " + userInfo.ExtCredits5 + validScoreUnit[5] + ",";
                        break;
                    }

                    case "Extcredits6":
                    {
                        object obj6 = text;
                        text = obj6 + validScoreName[i] + ": " + userInfo.ExtCredits6 + validScoreUnit[6] + ",";
                        break;
                    }

                    case "Extcredits7":
                    {
                        object obj7 = text;
                        text = obj7 + validScoreName[i] + ": " + userInfo.ExtCredits7 + validScoreUnit[7] + ",";
                        break;
                    }

                    case "Extcredits8":
                    {
                        object obj8 = text;
                        text = obj8 + validScoreName[i] + ": " + userInfo.ExtCredits8 + validScoreUnit[8] + ",";
                        break;
                    }
                    }
                }
            }
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["dntusertips"];

            if (httpCookie == null)
            {
                httpCookie = new HttpCookie("dntusertips");
            }
            httpCookie.Values["userinfotips"] = Utils.UrlEncode(text.TrimEnd(','));
            httpCookie.Expires = DateTime.Now.AddMinutes(5.0);
            HttpContext.Current.Response.AppendCookie(httpCookie);
        }
示例#19
0
 private static int UpdateUserExtCredits(int uid, int mount, CreditsOperationType creditsOperationType, int pos, bool allowMinus)
 {
     return(UpdateUserExtCredits(uid, Scoresets.GetUserExtCredits(creditsOperationType), mount, creditsOperationType, pos, allowMinus));
 }
示例#20
0
        private static string GetAttachReplacement(PostpramsInfo postPramsInfo, int allowGetAttach, Attachment att)
        {
            string forumpath = BaseConfigInfo.Current.Forumpath;
            string arg       = "attachment.gif";

            if (Utils.InArray(Utils.GetFileExtName(att.FileName), ".rar,.zip"))
            {
                arg = "rar.gif";
            }
            string str = string.Format("<dt><img src=\"{0}images/attachicons/{1}\" alt=\"\"></dt>", forumpath, arg);
            string result;

            if (allowGetAttach != 1)
            {
                result = string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", "<div class=\"hide\"><span class=\"attachnotdown\">您所在的用户组无法下载或查看附件</span></div>"));
            }
            else
            {
                if (att.AllowRead)
                {
                    string fileSize;
                    if (att.FileSize > 1024L)
                    {
                        fileSize = Convert.ToString(Math.Round(Convert.ToDecimal(att.FileSize) / 1024m, 2)) + " K";
                    }
                    else
                    {
                        fileSize = att.FileSize + " B";
                    }
                    string str2 = string.Format("<em class=\"xg1\">(<script type=\"text/javascript\">ShowFormatBytesStr({0});</script>, 下载次数:{1})</em>", att.FileSize, att.Downloads);
                    if (att.ImgPost)
                    {
                        result = ParseImageAttachContent(postPramsInfo, att, fileSize);
                    }
                    else
                    {
                        //att.Attachimgpost = 0;
                        if (postPramsInfo.CurrentUserGroup.Is管理团队 || postPramsInfo.CurrentUserid == att.Uid || att.AttachPrice <= 0 || att.IsBought)
                        {
                            result = string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", string.Format("<a href=\"{0}attachment.aspx?attachmentid={1}\" onclick=\"return ShowDownloadTip({2});\" target=\"_blank\">{3}</a>", new object[]
                            {
                                forumpath,
                                att.ID,
                                att.Uid,
                                att.Name
                            }) + str2));
                        }
                        else
                        {
                            result = string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", att.Name + str2 + string.Format("<p>售价({0}):<strong>{1} </strong>[<a onclick=\"loadattachpaymentlog({2});\" href=\"javascript:void(0);\">记录</a>] [<a onclick=\"loadbuyattach({2});\" href=\"javascript:void(0);\">购买</a>]</p>", Scoresets.GetTopicAttachCreditsTransName(), att.AttachPrice, att.ID)));
                        }
                    }
                }
                else
                {
                    if (postPramsInfo.CurrentUserid > 0)
                    {
                        result = string.Format("<div class=\"hide\"><span class=\"attachnotdown\">你的下载权限 {0} 低于此附件所需权限 {1}, 你无权查看此附件</span></div>", postPramsInfo.Usergroupreadaccess, att.ReadPerm);
                    }
                    else
                    {
                        result = string.Format("<div class=\"hide\">附件: <em><span class=\"attachnotdown\">你需要<a href=\"{0}login.aspx\" onclick=\"hideWindow('register');showWindow('login', this.href);\">登录</a>才可以下载或查看附件。没有帐号? <a href=\"{0}register.aspx\" onclick=\"hideWindow('login');showWindow('register', this.href);\" title=\"注册帐号\">注册</a></span></em></div>", BaseConfigs.GetForumPath);
                    }
                }
            }
            return(result);
        }
示例#21
0
        private static string ParseImageAttachContent(PostpramsInfo postPramsInfo, Attachment att, string fileSize)
        {
            string empty     = string.Empty;
            string forumpath = BaseConfigInfo.Current.Forumpath;
            string text      = string.Format("<span style=\"position: absolute; display: none;\" onmouseover=\"showMenu(this.id, 0, 1)\" id=\"attach_{0}\"><img border=\"0\" src=\"{1}images/attachicons/attachimg.gif\" /></span>", att.ID, forumpath);
            string str       = string.Format("<dt><img src=\"{0}images/attachicons/{1}\" alt=\"\"></dt>", forumpath, "image.gif");
            string str2      = string.Format("<em class=\"xg1\">(<script type=\"text/javascript\">ShowFormatBytesStr({0});</script>, 下载次数:{1})</em>", att.FileSize, att.Downloads);
            bool   flag      = GeneralConfigInfo.Current.Showimgattachmode == 0;
            string format    = flag ? "{0}<img imageid=\"{2}\" src=\"{1}\" onmouseover=\"attachimginfo(this, 'attach_{2}', 1);attachimg(this, 'mouseover')\" onclick=\"zoom(this);\" onmouseout=\"attachimginfo(this, 'attach_{2}', 0, event)\" {7} /><div id=\"attach_{2}_menu\" style=\"display: none;\" class=\"t_attach\"><img border=\"0\" alt=\"\" class=\"absmiddle\" src=\"{3}images/attachicons/image.gif\" /><a target=\"_blank\"  href=\"{1}\"><strong>{4}</strong></a>({5})<br/><div class=\"t_smallfont\">{6}</div></div>" : "{0}<img alt=\"点击加载图片\" imageid=\"{2}\" inpost=\"1\" src=\"/images/common/imgloading.png\" newsrc=\"{1}\" onload=\"{8}attachimg(this, 'load');\" onclick=\"loadImg(this);\" onmouseout=\"attachimginfo(this, 'attach_{2}', 0, event)\" {7} /><div id=\"attach_{2}_menu\" style=\"display: none;\" class=\"t_attach\"><img border=\"0\" alt=\"\" class=\"absmiddle\" src=\"{3}images/attachicons/image.gif\" /><a target=\"_blank\" onclick=\"return ShowDownloadTip({9});\"  href=\"{1}\"><strong>{4}</strong></a>({5})<br/><div class=\"t_smallfont\">{6}</div></div>";
            string text2     = flag ? Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width) : "";

            //att.Attachimgpost = 1;
            if (postPramsInfo.Showattachmentpath == 1)
            {
                if (postPramsInfo.Isforspace == 1)
                {
                    if (att.IsLocal)
                    {
                        return(string.Format("<img src=\"{0}\" {1} {2}/>", att.FileName, Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width), Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true)));
                    }
                    return(string.Format("<img src=\"{0}upload/{1}\" {2} {3}/>", new object[]
                    {
                        forumpath,
                        att.FileName,
                        Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width),
                        Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true)
                    }));
                }
                else
                {
                    if (postPramsInfo.CurrentUserGroup.Is管理团队 || postPramsInfo.CurrentUserid == att.Uid || att.AttachPrice <= 0 || att.IsBought)
                    {
                        if (att.IsLocal)
                        {
                            return(string.Format(format, new object[]
                            {
                                text,
                                att.FileName,
                                att.ID,
                                forumpath,
                                att.Name.Trim(),
                                fileSize,
                                att.PostDateTime,
                                text2,
                                Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false),
                                att.Uid
                            }));
                        }
                        return(string.Format(format, new object[]
                        {
                            text,
                            forumpath + "upload/" + att.FileName,
                            att.ID,
                            forumpath,
                            att.Name.Trim(),
                            fileSize,
                            att.PostDateTime,
                            text2,
                            Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false),
                            att.Uid
                        }));
                    }
                    else
                    {
                        string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", att.Name + str2 + string.Format("<p>售价({0}):<strong>{1} </strong>[<a onclick=\"loadattachpaymentlog({2});\" href=\"javascript:void(0);\">记录</a>] [<a onclick=\"loadbuyattach({2});\" href=\"javascript:void(0);\">购买</a>]</p>", Scoresets.GetTopicAttachCreditsTransName(), att.AttachPrice, att.ID)));
                    }
                }
            }
            if (postPramsInfo.Isforspace == 1)
            {
                return(string.Format("<img src=\"{0}attachment.aspx?attachmentid={1}\" {2} {3}/>", new object[]
                {
                    forumpath,
                    att.ID,
                    Attachments.GetImageShowWidth(postPramsInfo.TemplateWidth, att.Width),
                    Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, true)
                }));
            }
            if (postPramsInfo.CurrentUserGroup.Is管理团队 || postPramsInfo.CurrentUserid == att.Uid || att.AttachPrice <= 0 || att.IsBought)
            {
                return(string.Format(format, new object[]
                {
                    text,
                    forumpath + "attachment.aspx?attachmentid=" + att.ID,
                    att.ID,
                    forumpath,
                    att.Name.Trim(),
                    fileSize,
                    att.PostDateTime,
                    text2,
                    Attachments.GetAutoImageWidthScript(postPramsInfo.TemplateWidth, att.Width, false),
                    att.Uid
                }));
            }
            return(string.Format("<dl class=\"t_attachlist attachimg cl\">{0}</dl>", str + string.Format("<dd>{0}</dd>", att.Name + str2 + string.Format("<p>售价({0}):<strong>{1} </strong>[<a onclick=\"loadattachpaymentlog({2});\" href=\"javascript:void(0);\">记录</a>] [<a onclick=\"loadbuyattach({2});\" href=\"javascript:void(0);\">购买</a>]</p>", Scoresets.GetTopicAttachCreditsTransName(), att.AttachPrice, att.ID))));
        }