Beispiel #1
0
 public bool CheckUserExtCredit(User userInfo)
 {
     if (userInfo == null)
     {
         base.AddErrLine("您无权购买本主题");
         this.needlogin = true;
         return(false);
     }
     if (Users.GetUserExtCredit(userInfo, Scoresets.GetTopicAttachCreditsTrans()) < (float)this.topic.Price)
     {
         string text = "";
         if (EPayments.IsOpenEPayments())
         {
             text = "<br/><span><a href=\"usercpcreditspay.aspx\">点击充值积分</a></span>";
         }
         base.AddErrLine(string.Format("对不起,您的账户余额 <span class=\"bold\">{0} {1}{2}</span> 交易额为 {3}{2} ,无法进行交易.{4}", new object[]
         {
             Scoresets.GetValidScoreName()[Scoresets.GetTopicAttachCreditsTrans()],
             Users.GetUserExtCredit(userInfo, Scoresets.GetTopicAttachCreditsTrans()),
             Scoresets.GetValidScoreUnit()[Scoresets.GetTopicAttachCreditsTrans()],
             this.topic.Price,
             text
         }));
         return(false);
     }
     return(true);
 }
        public void LoadConfigInfo()
        {
            #region 加载配置信息

            GeneralConfigInfo    configInfo           = GeneralConfigs.GetConfig();
            InvitationConfigInfo invitationConfigInfo = InvitationConfigs.GetConfig();

            regstatus.SelectedValue = configInfo.Regstatus.ToString();

            censoruser.Text           = configInfo.Censoruser;
            doublee.SelectedValue     = configInfo.Doublee.ToString();
            emaillogin.SelectedValue  = configInfo.Emaillogin.ToString();
            regverify.SelectedValue   = configInfo.Regverify.ToString();
            accessemail.Text          = configInfo.Accessemail;
            censoremail.Text          = configInfo.Censoremail;
            hideprivate.SelectedValue = configInfo.Hideprivate.ToString();
            ipdenyaccess.Text         = configInfo.Ipdenyaccess;
            ipaccess.Text             = configInfo.Ipaccess;
            regctrl.Text                      = configInfo.Regctrl.ToString();
            ipregctrl.Text                    = configInfo.Ipregctrl;
            adminipaccess.Text                = configInfo.Adminipaccess;
            welcomemsg.SelectedValue          = configInfo.Welcomemsg.ToString();
            welcomemsgtxt.Text                = configInfo.Welcomemsgtxt;
            rules.SelectedValue               = configInfo.Rules.ToString();
            rulestxt.Text                     = configInfo.Rulestxt;
            newbiespan.Text                   = configInfo.Newbiespan.ToString();
            realnamesystem.SelectedValue      = configInfo.Realnamesystem.ToString();
            invitecodeexpiretime.Text         = invitationConfigInfo.InviteCodeExpireTime.ToString();
            invitecodemaxcount.Text           = invitationConfigInfo.InviteCodeMaxCount.ToString();
            addextcreditsline.Text            = invitationConfigInfo.InviteCodePayCount.ToString();
            invitationuserdescription.Text    = invitationConfigInfo.InvitationLoginUserDescription;//配置项赋值给textarea的innnerhtml能保证显示出来的是所见即所得的效果
            invitationvisitordescription.Text = invitationConfigInfo.InvitationVisitorDescription;
            invitationemailmodel.Text         = invitationConfigInfo.InvitationEmailTemplate;
            invitecodeusermaxbuy.Text         = invitationConfigInfo.InviteCodeMaxCountToBuy.ToString();
            invitecodeusercreateperday.Text   = invitationConfigInfo.InviteCodeUserCreatePerDay.ToString();
            passwordmode.SelectedValue        = configInfo.Passwordmode.ToString();
            CookieDomain.Text                 = configInfo.CookieDomain.ToString();
            string[] extCredits = Utils.SplitString(invitationConfigInfo.InviteCodePrice, ",");
            extCreditsUnits = Scoresets.GetValidScoreUnit();
            DataTable extCreditsTable = Scoresets.GetScorePaySet(0);

            //初始化邀请码价格显示界面,全部为隐藏
            for (int count = 0; count < 8; count++)
            {
                extCreditsName[count] = "";
                TextBox textbox = this.FindControl("invitecodeprice" + count.ToString()) as TextBox;
                textbox.Text    = extCredits[count];
                textbox.Visible = false;
            }

            //根据邀请码相关信息,将有效的信息显示在界面中
            foreach (DataRow dr in extCreditsTable.Rows)
            {
                extCreditsName[Utils.StrToInt(dr["id"].ToString(), 0) - 1] = dr["name"].ToString() + ":";
                TextBox textbox = this.FindControl("invitecodeprice" + (Utils.StrToInt(dr[0].ToString(), 0) - 1).ToString()) as TextBox;
                textbox.Visible = true;
            }

            #endregion
        }
Beispiel #3
0
        public void LoadConfigInfo()
        {
            GeneralConfigInfo    config  = GeneralConfigInfo.Current;
            InvitationConfigInfo config2 = InvitationConfigInfo.Current;

            this.regstatus.SelectedValue   = config.Regstatus.ToString();
            this.censoruser.Text           = config.Censoruser;
            this.doublee.SelectedValue     = config.Doublee.ToString();
            this.emaillogin.SelectedValue  = config.Emaillogin.ToString();
            this.regverify.SelectedValue   = config.Regverify.ToString();
            this.accessemail.Text          = config.Accessemail;
            this.censoremail.Text          = config.Censoremail;
            this.hideprivate.SelectedValue = config.Hideprivate.ToString();
            this.ipdenyaccess.Text         = config.Ipdenyaccess;
            this.ipaccess.Text             = config.Ipaccess;
            this.regctrl.Text                      = config.Regctrl.ToString();
            this.ipregctrl.Text                    = config.Ipregctrl;
            this.adminipaccess.Text                = config.Adminipaccess;
            this.welcomemsg.SelectedValue          = config.Welcomemsg.ToString();
            this.welcomemsgtxt.Text                = config.Welcomemsgtxt;
            this.rules.SelectedValue               = config.Rules.ToString();
            this.rulestxt.Text                     = config.Rulestxt;
            this.newbiespan.Text                   = config.Newbiespan.ToString();
            this.realnamesystem.SelectedValue      = config.Realnamesystem.ToString();
            this.invitecodeexpiretime.Text         = config2.InviteCodeExpireTime.ToString();
            this.invitecodemaxcount.Text           = config2.InviteCodeMaxCount.ToString();
            this.addextcreditsline.Text            = config2.InviteCodePayCount.ToString();
            this.invitationuserdescription.Text    = config2.InvitationLoginUserDescription;
            this.invitationvisitordescription.Text = config2.InvitationVisitorDescription;
            this.invitationemailmodel.Text         = config2.InvitationEmailTemplate;
            this.invitecodeusermaxbuy.Text         = config2.InviteCodeMaxCountToBuy.ToString();
            this.invitecodeusercreateperday.Text   = config2.InviteCodeUserCreatePerDay.ToString();
            this.passwordmode.SelectedValue        = config.Passwordmode.ToString();
            this.CookieDomain.Text                 = config.CookieDomain;
            this.verifyregisterexpired.Text        = config.Verifyregisterexpired.ToString();
            this.verifyemailtemp.text              = config.Verifyregisteremailtemp;
            string[] array = Utils.SplitString(config2.InviteCodePrice, ",");
            this.extCreditsUnits = Scoresets.GetValidScoreUnit();
            var scorePaySet = Scoresets.GetScorePaySet(0);

            for (int i = 0; i < 8; i++)
            {
                this.extCreditsName[i] = "";
                var textBox = this.FindControl("invitecodeprice" + i) as BBX.Control.TextBox;
                textBox.Text    = array[i];
                textBox.Visible = false;
            }
            foreach (DataRow dataRow in scorePaySet.Rows)
            {
                this.extCreditsName[dataRow["id"].ToString().ToInt(0) - 1] = dataRow["name"] + ":";
                var textBox2 = this.FindControl("invitecodeprice" + (dataRow[0].ToString().ToInt(0) - 1).ToString()) as BBX.Control.TextBox;
                textBox2.Visible = true;
            }
        }
Beispiel #4
0
 public void BindDownloadAttachmentTip()
 {
     if (!Scoresets.IsSetDownLoadAttachScore())
     {
         return;
     }
     float[]  userExtCredits = Scoresets.GetUserExtCredits(CreditsOperationType.DownloadAttachment);
     string[] validScoreName = Scoresets.GetValidScoreName();
     string[] validScoreUnit = Scoresets.GetValidScoreUnit();
     for (int i = 0; i < userExtCredits.Length; i++)
     {
         if (userExtCredits[i] < 0f)
         {
             this.downloadattachmenttip += string.Format("{0}:{1} {2};", validScoreName[i + 1], Math.Abs(userExtCredits[i]), validScoreUnit[i + 1]);
         }
     }
     this.downloadattachmenttip = this.downloadattachmenttip.TrimEnd(';');
 }
Beispiel #5
0
        public void BindDownloadAttachmentTip()
        {
            if (!Scoresets.IsSetDownLoadAttachScore())
            {
                return;
            }

            float[]  extCredits     = Scoresets.GetUserExtCredits(CreditsOperationType.DownloadAttachment);
            string[] extCreditNames = Scoresets.GetValidScoreName();
            string[] extCreditUnits = Scoresets.GetValidScoreUnit();

            for (int i = 0; i < extCredits.Length; i++)
            {
                if (extCredits[i] < 0)//只提示扣分的扩展积分信息
                {
                    downloadattachmenttip += string.Format("{0}:{1} {2};", extCreditNames[i + 1], System.Math.Abs(extCredits[i]), extCreditUnits[i + 1]);
                }
            }
            downloadattachmenttip = downloadattachmenttip.TrimEnd(';');
        }
Beispiel #6
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));
            ///得到广告列表
            GetForumAds(forum.Fid);

            // 检查是否具有版主的身份
            if (useradminid != 0)
            {
                ismoder   = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0;
                admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息
                if (admininfo != null)
                {
                    disablepostctrl = admininfo.Disablepostctrl;
                }
            }

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0;
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            usesig      = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1;

            int price = 0;

            if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示
            {
                HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return;
            }

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            // 获取帖子总数
            onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor;

            // 获取分页相关信息
            BindPageCountAndId();

            PostpramsInfo postpramsInfo = GetPostPramsInfo(price);

            //获取当前正反方列表
            positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1);
            negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1);

            GetPostAds(postpramsInfo, positivepostlist.Count);

            //辩论帖
            if (topic.Special == 4)
            {
                GetDebateInfo(postpramsInfo);
            }

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            if (enabletag)
            {
                relatedtopics = Topics.GetRelatedTopicList(topicid, 5);
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message));

            ///更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);
            BindDownloadAttachmentTip();
        }
Beispiel #7
0
        /// <summary>
        /// 获得帖子评分列表
        /// </summary>
        public void GetRateLogList()
        {
            System.Text.StringBuilder xmlnode = new System.Text.StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");

            //如果不是提交...
            if (!DNTRequest.IsPost() || ForumUtils.IsCrossSitePost())
            {
                xmlnode.Append("<error>您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。</error>");
                ResponseXML(xmlnode);
                return;
            }

            try
            {
                List <RateLogInfo> rateList = Posts.GetPostRateLogList(DNTRequest.GetFormInt("pid", 0));
                if (rateList == null || rateList.Count == 0)
                {
                    xmlnode.Append("<error>该帖没有评分记录</error>");
                    ResponseXML(xmlnode);
                    return;
                }
                xmlnode.Append("<data>\r\n");

                List <RateLogInfo> finalRateList = new List <RateLogInfo>();

                //该循环用于将评分列表中多次评分用户的分值聚合成一条数据
                foreach (RateLogInfo info in rateList)
                {
                    Predicate <RateLogInfo> match         = new Predicate <RateLogInfo>(delegate(RateLogInfo rateLog) { return(rateLog.Uid == info.Uid && rateLog.ExtCredits == info.ExtCredits); });
                    RateLogInfo             finalRateInfo = finalRateList.Find(match);
                    if (finalRateInfo == null)
                    {
                        finalRateList.Add(info);
                    }
                    else
                    {
                        finalRateInfo.Score += info.Score;
                        finalRateInfo.Reason = string.IsNullOrEmpty(finalRateInfo.Reason) ? info.Reason : finalRateInfo.Reason;
                    }
                }

                string[] scorename = Scoresets.GetValidScoreName();
                string[] scoreunit = Scoresets.GetValidScoreUnit();

                int uidCount     = 0;
                int previoursUid = 0;
                foreach (RateLogInfo rate in finalRateList)
                {
                    if (previoursUid != rate.Uid)
                    {
                        uidCount++;
                    }
                    xmlnode.Append("<ratelog>");
                    xmlnode.AppendFormat("\r\n\t<rateid>{0}</rateid>", rate.Id);
                    xmlnode.AppendFormat("\r\n\t<uid>{0}</uid>", rate.Uid);
                    xmlnode.AppendFormat("\r\n\t<username>{0}</username>", rate.UserName.Trim());
                    xmlnode.AppendFormat("\r\n\t<extcredits>{0}</extcredits>", rate.ExtCredits);
                    xmlnode.AppendFormat("\r\n\t<extcreditsname>{0}</extcreditsname>", scorename[rate.ExtCredits]);
                    xmlnode.AppendFormat("\r\n\t<extcreditsunit>{0}</extcreditsunit>", scoreunit[rate.ExtCredits]);
                    xmlnode.AppendFormat("\r\n\t<postdatetime>{0}</postdatetime>", ForumUtils.ConvertDateTime(rate.PostDateTime));
                    xmlnode.AppendFormat("\r\n\t<score>{0}</score>", rate.Score > 0 ? ("+" + rate.Score.ToString()) : rate.Score.ToString());
                    xmlnode.AppendFormat("\r\n\t<reason>{0}</reason>", rate.Reason.Trim());
                    xmlnode.Append("\r\n</ratelog>\r\n");
                    previoursUid = rate.Uid;
                }
                xmlnode.Append("</data>");

                ResponseXML(xmlnode);
                if (DNTRequest.GetFormInt("ratetimes", 0) != uidCount)
                {
                    Posts.UpdatePostRateTimes(DNTRequest.GetFormInt("tid", 0), DNTRequest.GetFormInt("pid", 0).ToString());
                }
            }
            catch //添加try语法, 以防止在并发情况下, 服务器端远程链接被关闭后出现应用程序 '警告'(事件查看器)
            {
                System.Web.HttpContext.Current.Response.Clear();
                System.Web.HttpContext.Current.Response.Expires = 0;
                System.Web.HttpContext.Current.Response.Cache.SetNoStore();
                System.Web.HttpContext.Current.Response.End();
            }
        }
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null || IsErr())
            {
                return;
            }

            //未结束的悬赏
            if (topic.Special != 3)
            {
                HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + ShowTopicAspxRewrite(topic.Tid, 1));
                return;
            }

            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));

            //得到广告列表
            GetForumAds(forum.Fid);

            //检查是否具有版主的身份
            IsModer();

            //验证不通过则返回
            if (!ValidateInfo())
            {
                return;
            }

            //编辑器状态
            EditorState();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            bonuslogs   = Bonus.GetLogs(topic);

            if (topic.Moderated > 0)
            {
                moderactions = TopicAdmins.GetTopicListModeratorLog(topicid);
            }

            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = topictypes != "" ? "[" + topictypes + "]" : "";

            if (newpmcount > 0)
            {
                pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);
            }

            score     = Scoresets.GetValidScoreName();
            scoreunit = Scoresets.GetValidScoreUnit();

            GetPostAds(GetPostPramsInfo(), postlist.Count);

            if (postlist.Count <= 0)
            {
                AddErrLine("读取信息失败");
                return;
            }

            //更新页面Meta信息
            UpdateMetaInfo(Utils.RemoveHtml(postlist[0].Message));

            //更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);

            BindDownloadAttachmentTip();

            ForumUtils.WriteCookie("referer", string.Format("showbonus.aspx?topicid={0}", topicid.ToString()));
        }
Beispiel #9
0
        protected override void ShowPage()
        {
            //获取主题信息
            topic = GetTopicInfo();
            if (topic == null)
            {
                return;
            }
            topicid = topic.Tid;
            forumid = topic.Fid;
            forum   = Forums.GetForumInfo(forumid);
            if (forum == null)
            {
                AddErrLine("不存在的版块ID"); return;
            }

            //验证不通过则返回
            if (!ValidateInfo() || IsErr())
            {
                return;
            }

            //检查是否具有管理权限
            IsModer();
            int price = GetTopicPrice(topic);

            if (topic.Special == 0 && price > 0)
            {
                HttpContext.Current.Response.Redirect(forumpath + "buytopic.aspx?topicid=" + topic.Tid);
                return;
            }

            if (postid > 0 && Posts.GetPostInfo(topicid, postid) == null)
            {
                AddErrLine("该帖可能已被删除 " + string.Format("<a href=\"{0}\">[返回主题]</a>", ShowTopicAspxRewrite(topicid, 1)));
                return;
            }
            //将版块加入到已访问版块列表中
            ForumUtils.SetVisitedForumsCookie(forumid.ToString());

            if (userid > 0)
            {
                userInfo = Users.GetShortUserInfo(userid);
            }

            if (topic.Identify > 0)
            {
                topicidentify = Caches.GetTopicIdentify(topic.Identify);
            }

            pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name));

            ///得到广告列表
            GetForumAds(forum.Fid);

            //获取主题类型
            Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes);
            topictypes = Utils.StrIsNullOrEmpty(topictypes) ? "" : "[" + topictypes + "]";

            userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            score       = Scoresets.GetValidScoreName();
            scoreunit   = Scoresets.GetValidScoreUnit();
            navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname);
            //编辑器状态
            EditorState();

            string[] customauthorinfo = config.Customauthorinfo.Split('|');
            postleftshow = customauthorinfo[0].Split(','); //帖子左边要显示的用户信息项目
            userfaceshow = customauthorinfo[1].Split(','); //头像上方要显示的项目
            //if (newpmcount > 0)
            //    pmlist = PrivateMessages.GetPrivateMessageListForIndex(userid, 5, 1, 1);

            onlyauthor = (onlyauthor == "1" || onlyauthor == "2") ? onlyauthor : "0";
            // 获取分页相关信息
            BindPageCountAndId();

            GetPostAds(GetPostPramsInfo(price), postlist.Count);

            #region 获取特殊主题相关信息
            bonuslogs = Bonus.GetLogs(topic);

            if (topic.Special == 1)//获取投票信息
            {
                GetPollInfo();
            }

            if (topic.Special == 4) //获取辩论信息
            {
                GetDebateInfo();
            }
            #endregion

            enabletag = (config.Enabletag & forum.Allowtag) == 1;
            //if (enabletag)
            //    relatedtopics = Topics.GetRelatedTopicList(topicid, 5);

            //更新页面Meta信息
            if (postlist != null && postlist.Count > 0)
            {
                UpdateMetaInfo(Utils.RemoveHtml(postlist[0].Message));
            }

            //判断是否需要生成游客缓存页面
            IsGuestCachePage();

            //更新主题查看次数和在线用户信息
            TopicStats.Track(topicid, 1);
            Topics.MarkOldTopic(topic);
            topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0);
            OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title);

            //如果是从
            if (DNTRequest.GetInt("fromfav", 0) > 0)
            {
                Favorites.UpdateUserFavoriteViewTime(userid, topicid);
            }
            //UserCredits.UpdateUserCredits(userInfo);此方法与后台积分设置中的条目不匹配,故注释
        }
Beispiel #10
0
        public void GetRateLogList()
        {
            var sb = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");

            if (!DNTRequest.IsPost() || ForumUtils.IsCrossSitePost())
            {
                sb.Append("<error>您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。</error>");
                this.ResponseXML(sb);
                return;
            }
            try
            {
                //List<RateLogInfo> postRateLogList = Posts.GetPostRateLogList(DNTRequest.GetFormInt("pid", 0));
                var postRateLogList = RateLog.Search(0, WebHelper.RequestInt("pid"));
                if (postRateLogList == null || postRateLogList.Count == 0)
                {
                    sb.Append("<error>该帖没有评分记录</error>");
                    this.ResponseXML(sb);
                }
                else
                {
                    sb.Append("<data>\r\n");
                    var list = new List <RateLog>();
                    foreach (var info in postRateLogList)
                    {
                        //Predicate<RateLogInfo> match = (RateLogInfo rateLog) => rateLog.Uid == info.Uid && rateLog.ExtCredits == info.ExtCredits;
                        //RateLogInfo rateLogInfo = list.Find(match);
                        var rateLogInfo = list.Find(e => e.Uid == info.Uid && e.ExtCredits == info.ExtCredits);
                        if (rateLogInfo == null)
                        {
                            list.Add(info);
                        }
                        else
                        {
                            rateLogInfo.Score += info.Score;
                            rateLogInfo.Reason = (string.IsNullOrEmpty(rateLogInfo.Reason) ? info.Reason : rateLogInfo.Reason);
                            if (rateLogInfo.Reason.IsNullOrWhiteSpace())
                            {
                                rateLogInfo.Reason = info.Reason;
                            }
                        }
                    }
                    string[] validScoreName = Scoresets.GetValidScoreName();
                    string[] validScoreUnit = Scoresets.GetValidScoreUnit();
                    int      num            = 0;
                    int      num2           = 0;
                    foreach (var item in list)
                    {
                        if (num2 != item.Uid)
                        {
                            num++;
                        }

                        sb.Append("<ratelog>");
                        sb.AppendFormat("\r\n\t<rateid>{0}</rateid>", item.ID);
                        sb.AppendFormat("\r\n\t<uid>{0}</uid>", item.Uid);
                        sb.AppendFormat("\r\n\t<username>{0}</username>", item.UserName.Trim());
                        sb.AppendFormat("\r\n\t<extcredits>{0}</extcredits>", item.ExtCredits);
                        sb.AppendFormat("\r\n\t<extcreditsname>{0}</extcreditsname>", validScoreName[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<extcreditsunit>{0}</extcreditsunit>", validScoreUnit[item.ExtCredits]);
                        sb.AppendFormat("\r\n\t<postdatetime>{0}</postdatetime>", ForumUtils.ConvertDateTime(item.PostDateTime));
                        sb.AppendFormat("\r\n\t<score>{0}</score>", (item.Score > 0) ? ("+" + item.Score.ToString()) : item.Score.ToString());
                        sb.AppendFormat("\r\n\t<reason>{0}</reason>", item.Reason.Trim());
                        sb.Append("\r\n</ratelog>\r\n");
                        num2 = item.Uid;
                    }
                    sb.Append("</data>");
                    this.ResponseXML(sb);
                    if (DNTRequest.GetFormInt("ratetimes", 0) != num)
                    {
                        Posts.UpdatePostRateTimes(DNTRequest.GetFormInt("tid", 0), DNTRequest.GetFormInt("pid", 0).ToString());
                    }
                }
            }
            catch
            {
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.Expires = 0;
                HttpContext.Current.Response.Cache.SetNoStore();
                HttpContext.Current.Response.End();
            }
        }
Beispiel #11
0
        protected override void ShowPage()
        {
            this.topic = base.GetTopicInfo();
            if (this.topic == null)
            {
                return;
            }
            this.topicid = this.topic.ID;
            this.forumid = this.topic.Fid;
            this.forum   = Forums.GetForumInfo(this.forumid);
            if (this.forum == null)
            {
                base.AddErrLine("不存在的版块ID");
                return;
            }
            if (!base.ValidateInfo() || base.IsErr())
            {
                return;
            }
            base.IsModer();
            int topicPrice = this.GetTopicPrice(this.topic);

            if (this.topic.Special == 0 && topicPrice > 0)
            {
                HttpContext.Current.Response.Redirect(this.forumpath + "buytopic.aspx?topicid=" + this.topic.ID);
                return;
            }
            if (this.postid > 0 && Post.FindByID(this.postid) == null)
            {
                base.AddErrLine("该帖可能已被删除 " + string.Format("<a href=\"{0}\">[返回主题]</a>", base.ShowTopicAspxRewrite(this.topicid, 1)));
                return;
            }
            ForumUtils.SetVisitedForumsCookie(this.forumid.ToString());
            if (this.userid > 0)
            {
                this.userInfo = BBX.Entity.User.FindByID(this.userid);
            }
            if (this.topic.Identify > 0)
            {
                this.topicidentify = TopicIdentify.FindByID(this.topic.Identify);
            }
            this.pagetitle = string.Format("{0} - {1}", this.topic.Title, Utils.RemoveHtml(this.forum.Name));
            base.GetForumAds(this.forum.Fid);
            TopicType.GetTopicTypeArray().TryGetValue(this.topic.TypeID, out this.topictypes);
            this.topictypes         = (this.topictypes.IsNullOrEmpty() ? "" : ("[" + this.topictypes + "]"));
            this.userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans());
            this.score       = Scoresets.GetValidScoreName();
            this.scoreunit   = Scoresets.GetValidScoreUnit();
            this.navhomemenu = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname);
            base.EditorState();
            string[] array = this.config.Customauthorinfo.Split('|');
            this.postleftshow = array[0].Split(',');
            this.userfaceshow = array[1].Split(',');
            this.onlyauthor   = ((this.onlyauthor == "1" || this.onlyauthor == "2") ? this.onlyauthor : "0");
            this.BindPageCountAndId();
            base.GetPostAds(this.GetPostPramsInfo(topicPrice), this.postlist.Count);
            //this.bonuslogs = Bonus.GetLogs(this.topic);
            if (this.topic.Special == 3)
            {
                this.bonuslogs = BonusLog.GetLogs(this.topic.ID);
            }
            if (this.topic.Special == 1)
            {
                this.GetPollInfo();
            }
            if (this.topic.Special == 4)
            {
                this.GetDebateInfo();
            }
            this.enabletag = config.Enabletag && forum.AllowTag;
            if (this.postlist != null && this.postlist.Count > 0)
            {
                base.UpdateMetaInfo(Utils.RemoveHtml(this.postlist[0].Message));
            }
            this.IsGuestCachePage();
            //Topic.UpdateViewCount(this.topicid, 1);
            topic.Views++;
            topic.SaveAsync(10000);
            Topics.MarkOldTopic(this.topic);
            this.topicviews = this.topic.Views;
            Online.UpdateAction(this.olid, UserAction.ShowTopic, this.forumid, this.forum.Name, this.topicid, this.topic.Title);
            if (DNTRequest.GetInt("fromfav", 0) > 0)
            {
                //Favorites.UpdateUserFavoriteViewTime(this.userid, this.topicid);
                var fav = Favorite.FindByUidAndTid(userid, topicid);
                if (fav != null)
                {
                    fav.ViewTime = DateTime.Now;
                    fav.Update();
                }
            }
        }