protected override void ShowPage() { pagetitle = "查看用户信息"; if (usergroupinfo.Allowviewpro != 1 && userid != id) { AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle)); if (userid < 1) { needlogin = true; } return; } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("username")) && Utils.StrIsNullOrEmpty(DNTRequest.GetString("userid"))) { AddErrLine("错误的URL链接"); return; } if (id == -1) { id = Users.GetUserId(Utils.UrlDecode(DNTRequest.GetString("username"))); } if (id == -1) { AddErrLine("该用户不存在"); return; } user = Users.GetUserInfo(id); if (user == null) { AddErrLine("该用户不存在"); return; } //用户设定Email保密时,清空用户的Email属性以避免被显示 if (user.Showemail != 1 && id != userid) { user.Email = ""; } //获取积分机制和用户组信息,底层有缓存 score = Scoresets.GetValidScoreName(); group = UserGroups.GetUserGroupInfo(user.Groupid); admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid); score1 = ((decimal)user.Extcredits1).ToString(); score2 = ((decimal)user.Extcredits2).ToString(); score3 = ((decimal)user.Extcredits3).ToString(); score4 = ((decimal)user.Extcredits4).ToString(); score5 = ((decimal)user.Extcredits5).ToString(); score6 = ((decimal)user.Extcredits6).ToString(); score7 = ((decimal)user.Extcredits7).ToString(); score8 = ((decimal)user.Extcredits8).ToString(); }
protected override void ShowPage() { pagetitle = "版块列表"; if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", config.Forumtitle + "最新主题"); } userinfo = new ShortUserInfo(); if (userid != -1) { userinfo = Discuz.Forum.Users.GetShortUserInfo(userid); if (userinfo.Newpm == 0) { base.newpmcount = 0; } } OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout); // 获得统计信息 totalonline = onlineusercount; totalonlineuser = OnlineUsers.GetOnlineUserCount(); score = Scoresets.GetValidScoreName(); }
protected override void ShowPage() { pagetitle = "用户控制面板"; if (userid == -1) { AddErrLine("你尚未登录"); return; } user = Discuz.Forum.Users.GetUserInfo(userid); if (!IsErr()) { score = Scoresets.GetValidScoreName(); avatar = user.Avatar; avatarurl = ""; avatartype = 1; avatarwidth = 0; avatarheight = 0; if (Utils.CutString(avatar, 0, 15).ToLower().Equals(@"avatars\common\")) { avatartype = 0; } else if (Utils.CutString(avatar, 0, 7).ToLower().Equals("http://")) { avatarurl = avatar; avatartype = 2; avatarwidth = user.Avatarwidth; avatarheight = user.Avatarheight; } } }
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); }
private void GetCreditsRank() { this.score = Scoresets.GetValidScoreName(); foreach (string key in this.creditsrankstats.Keys) { this.statvars[key] = this.creditsrankstats[key] + ""; } CheckLastUpdate("creditsrank"); var credits = Stats.GetCreditsRank(statvars, "credits"); var extendedcredits = Stats.GetExtCreditsRank(statvars, "extendedcredits"); int num = credits.Length; for (int i = 1; i < 8; i++) { num = Math.Max(extendedcredits[i].Length, num); } this.creditsrank = Stats.GetUserRankHtml(credits, "credits", num); this.extcreditsrank1 = Stats.GetUserRankHtml(extendedcredits[0], "extcredits1", num); this.extcreditsrank2 = Stats.GetUserRankHtml(extendedcredits[1], "extcredits2", num); this.extcreditsrank3 = Stats.GetUserRankHtml(extendedcredits[2], "extcredits3", num); this.extcreditsrank4 = Stats.GetUserRankHtml(extendedcredits[3], "extcredits4", num); this.extcreditsrank5 = Stats.GetUserRankHtml(extendedcredits[4], "extcredits5", num); this.extcreditsrank6 = Stats.GetUserRankHtml(extendedcredits[5], "extcredits6", num); this.extcreditsrank7 = Stats.GetUserRankHtml(extendedcredits[6], "extcredits7", num); this.extcreditsrank8 = Stats.GetUserRankHtml(extendedcredits[7], "extcredits8", num); this.lastupdate = this.statvars["lastupdate"]; this.nextupdate = Utility.ToDateTime(this.statvars["lastupdate"]).AddMinutes((double)this.statscachelife).ToString("yyyy-MM-dd HH:mm:ss"); }
/// <summary> /// 信用记录 /// </summary> private void GetCreditsRank() { score = Scoresets.GetValidScoreName(); foreach (string key in creditsrankstats.Keys) { statvars[key] = creditsrankstats[key].ToString(); } if (!statvars.ContainsKey("lastupdate") || (DateTime.Now - DateTime.Parse(statvars["lastupdate"])).TotalMinutes > statscachelife) { statvars.Clear(); statvars["lastupdate"] = Utils.GetDateTime(); Stats.UpdateStatVars("creditsrank", "lastupdate", statvars["lastupdate"]); } ShortUserInfo[] credits; ShortUserInfo[][] extendedcredits; if (statvars.ContainsKey("credits")) { credits = (ShortUserInfo[])SerializationHelper.DeSerialize(typeof(ShortUserInfo[]), statvars["credits"]); } else { credits = Stats.GetUserArray("credits"); Stats.UpdateStatVars("creditsrank", "credits", SerializationHelper.Serialize(credits)); } if (statvars.ContainsKey("extendedcredits")) { extendedcredits = (ShortUserInfo[][])SerializationHelper.DeSerialize(typeof(ShortUserInfo[][]), statvars["extendedcredits"]); } else { extendedcredits = Stats.GetExtsRankUserArray(); Stats.UpdateStatVars("creditsrank", "extendedcredits", SerializationHelper.Serialize(extendedcredits)); } int maxrows = credits.Length; for (int i = 1; i < 8; i++) { maxrows = Math.Max(extendedcredits[i].Length, maxrows); } creditsrank = Stats.GetUserRankHtml(credits, "credits", maxrows); extcreditsrank1 = Stats.GetUserRankHtml(extendedcredits[0], "extcredits1", maxrows); extcreditsrank2 = Stats.GetUserRankHtml(extendedcredits[1], "extcredits2", maxrows); extcreditsrank3 = Stats.GetUserRankHtml(extendedcredits[2], "extcredits3", maxrows); extcreditsrank4 = Stats.GetUserRankHtml(extendedcredits[3], "extcredits4", maxrows); extcreditsrank5 = Stats.GetUserRankHtml(extendedcredits[4], "extcredits5", maxrows); extcreditsrank6 = Stats.GetUserRankHtml(extendedcredits[5], "extcredits6", maxrows); extcreditsrank7 = Stats.GetUserRankHtml(extendedcredits[6], "extcredits7", maxrows); extcreditsrank8 = Stats.GetUserRankHtml(extendedcredits[7], "extcredits8", maxrows); lastupdate = statvars["lastupdate"]; nextupdate = DateTime.Parse(statvars["lastupdate"]).AddMinutes(statscachelife).ToString("yyyy-MM-dd HH:mm:ss"); }
private void LoadCustomauthorinfo() { score = Scoresets.GetValidScoreName(); GeneralConfigInfo configinfos = GeneralConfigs.GetConfig(); string customauthorinfo = configinfos.Customauthorinfo; string postleft = Utils.SplitString(customauthorinfo, "|")[0]; //帖子左边要显示的用户信息项目 string userface = Utils.SplitString(customauthorinfo, "|")[1]; //头像上方要显示的项目 postleftarray = postleft.Split(','); userfacearray = userface.Split(','); }
private void LoadCustomauthorinfo() { this.score = Scoresets.GetValidScoreName(); var config = GeneralConfigInfo.Current; string customauthorinfo = config.Customauthorinfo; string text = Utils.SplitString(customauthorinfo, "|")[0]; string text2 = Utils.SplitString(customauthorinfo, "|")[1]; this.postleftarray = text.Split(','); this.userfacearray = text2.Split(','); }
protected override void ShowPage() { this.pagetitle = "查看用户信息"; if (!this.usergroupinfo.AllowViewpro && this.userid != this.id) { base.AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", this.usergroupinfo.GroupTitle)); if (this.userid < 1) { this.needlogin = true; } return; } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("username")) && Utils.StrIsNullOrEmpty(DNTRequest.GetString("userid"))) { base.AddErrLine("错误的URL链接"); return; } if (this.id == -1) { this.id = Users.GetUserId(Utils.UrlDecode(DNTRequest.GetString("username"))); } if (this.id == -1) { base.AddErrLine("该用户不存在"); return; } this.user = Users.GetUserInfo(this.id); if (this.user == null) { base.AddErrLine("该用户不存在"); return; } if (!user.ShowEmail && this.id != this.userid) { //this.user.Email = ""; // 不影响脏数据,避免不小心被保存了 user["Email"] = ""; } this.score = Scoresets.GetValidScoreName(); this.group = UserGroup.FindByID(this.user.GroupID); //this.admininfo = AdminUserGroups.AdminGetAdminGroupInfo(this.usergroupid); admininfo = AdminGroup.FindByID(usergroupid); this.score1 = ((decimal)this.user.ExtCredits1).ToString(); this.score2 = ((decimal)this.user.ExtCredits2).ToString(); this.score3 = ((decimal)this.user.ExtCredits3).ToString(); this.score4 = ((decimal)this.user.ExtCredits4).ToString(); this.score5 = ((decimal)this.user.ExtCredits5).ToString(); this.score6 = ((decimal)this.user.ExtCredits6).ToString(); this.score7 = ((decimal)this.user.ExtCredits7).ToString(); this.score8 = ((decimal)this.user.ExtCredits8).ToString(); }
protected override void ShowPage() { pagetitle = "查看用户信息"; if (usergroupinfo.Allowviewpro != 1) { AddErrLine(string.Format("您当前的身份 \"{0}\" 没有查看用户资料的权限", usergroupinfo.Grouptitle)); if (userid < 1) { needlogin = true; } return; } if (DNTRequest.GetString("username").Trim() == "" && DNTRequest.GetString("userid").Trim() == "") { AddErrLine("错误的URL链接"); return; } int id = DNTRequest.GetInt("userid", -1); if (id == -1) { id = Discuz.Forum.Users.GetUserID(Utils.UrlDecode(DNTRequest.GetString("username"))); } if (id == -1) { AddErrLine("该用户不存在"); return; } user = Discuz.Forum.Users.GetUserInfo(id); if (user == null) { AddErrLine("该用户不存在"); return; } //用户设定Email保密时,清空用户的Email属性以避免被显示 if (user.Showemail != 1) { user.Email = ""; } //获取金币机制和用户组信息,底层有缓存 score = Scoresets.GetValidScoreName(); group = UserGroups.GetUserGroupInfo(user.Groupid); admininfo = AdminUserGroups.AdminGetAdminGroupInfo(usergroupid); }
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(';'); }
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(';'); }
/// <summary> /// 设置相关主题信息 /// </summary> /// <param name="pollitem"></param> /// <param name="topicprice"></param> /// <param name="postmessage"></param> private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage) { if (postinfo.Layer == 0) { ///修改投票信息 StringBuilder itemvaluelist = new StringBuilder(""); if (topic.Special == 1) { string pollItemname = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim()); if (!Utils.StrIsNullOrEmpty(pollItemname)) { int multiple = DNTRequest.GetString("multiple") == "on" ? 1 : 0; int maxchoices = DNTRequest.GetInt("maxchoices", 0); if (multiple == 1 && maxchoices > pollitem.Length) { maxchoices = pollitem.Length; } if (!Polls.UpdatePoll(topic.Tid, multiple, pollitem.Length, DNTRequest.GetFormString("PollOptionID").Trim(), pollItemname, DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(), DNTRequest.GetString("enddatetime"), maxchoices, DNTRequest.GetString("visiblepoll") == "on" ? 1 : 0, DNTRequest.GetString("allowview") == "on" ? 1 : 0)) { AddErrLine("投票错误,请检查显示顺序"); return; } } else { AddErrLine("投票项为空"); return; } } //修改辩论信息 if (topic.Special == 4) { debateinfo.Positiveopinion = DNTRequest.GetString("positiveopinion"); debateinfo.Negativeopinion = DNTRequest.GetString("negativeopinion"); debateinfo.Terminaltime = TypeConverter.StrToDateTime(DNTRequest.GetString("terminaltime")); if (!Debates.UpdateDebateTopic(debateinfo)) { AddErrLine("辩论修改选择了无效的主题"); return; } } int iconid = DNTRequest.GetInt("iconid", 0); topic.Iconid = (iconid > 15 || iconid < 0) ? 0 : iconid; topic.Title = postinfo.Title; //悬赏差价处理 if (topic.Special == 2) { int pricediff = topicprice - topic.Price; if (pricediff > 0) { if (bonusCreditsTrans < 1 || bonusCreditsTrans > 8) { AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return; } //扣分 if (usergroupinfo.Radminid != 1 && Users.GetUserExtCredits(topic.Posterid, bonusCreditsTrans) < pricediff) { AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[bonusCreditsTrans] + " 不足, 无法追加悬赏"); return; } else { topic.Price = topicprice; Users.UpdateUserExtCredits(topic.Posterid, bonusCreditsTrans, -pricediff * (Scoresets.GetCreditsTax() + 1)); //计算税后的实际支付 } } else if (pricediff < 0 && usergroupinfo.Radminid != 1) { AddErrLine("不能降低悬赏价格"); return; } } else if (topic.Special == 0)//普通主题,出售 { topic.Price = topicprice; } if (usergroupinfo.Allowsetreadperm == 1) { topic.Readperm = DNTRequest.GetInt("topicreadperm", 0) > 255 ? 255 : DNTRequest.GetInt("topicreadperm", 0); } if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) { topic.Hide = 1; } topic.Typeid = DNTRequest.GetFormInt("typeid", 0); htmltitle = DNTRequest.GetString("htmltitle").Trim(); if (!Utils.StrIsNullOrEmpty(htmltitle) && Utils.HtmlDecode(htmltitle).Trim() != topic.Title) { //按照 附加位/htmltitle(1位)/magic(3位)/以后扩展(未知位数) 的方式来存储, 11001 topic.Magic = 11000; } else { topic.Magic = 0; } topic.Displayorder = Topics.GetTitleDisplayOrder(usergroupinfo, useradminid, forum, topic, message, disablepostctrl); ForumTags.DeleteTopicTags(topic.Tid); Topics.DeleteRelatedTopics(topic.Tid); string tags = DNTRequest.GetString("tags").Trim(); if (enabletag && !Utils.StrIsNullOrEmpty(tags)) { if (ForumUtils.InBanWordArray(tags)) { AddErrLine("标签中含有系统禁止词语,请修改"); return; } string[] tagArray = Utils.SplitString(tags, " ", true, 2, 10); if (tagArray.Length > 0 && tagArray.Length <= 5) { topic.Magic = Topics.SetMagicValue(topic.Magic, MagicType.TopicTag, 1); ForumTags.CreateTopicTags(tagArray, topic.Tid, userid, Utils.GetDateTime()); } else { AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签"); return; } } Topics.UpdateTopic(topic); //保存htmltitle if (canhtmltitle && !Utils.StrIsNullOrEmpty(htmltitle) && htmltitle != topic.Title) { Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(htmltitle), topic.Tid); } } else { if (ForumUtils.IsHidePost(postmessage) && usergroupinfo.Allowhidecode == 1) { topic.Hide = 1; Topics.UpdateTopic(topic); } } }
/// <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() { 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(); } } }
protected override void ShowPage() { pagetitle = "首页"; if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", "最新主题"); } // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } // 友情链接 forumlinkcount = forumlinklist.Rows.Count; Forums.GetForumIndexCollection(config.Hideprivate, usergroupid, config.Moddisplay, out totaltopic, out totalpost, out todayposts); // 获得统计信息 totalusers = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("totalusers")); lastusername = Statistics.GetStatisticsRowItem("lastusername"); lastuserid = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("lastuserid")); yesterdayposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("yesterdayposts")); highestposts = TypeConverter.StrToInt(Statistics.GetStatisticsRowItem("highestposts")); highestpostsdate = Statistics.GetStatisticsRowItem("highestpostsdate").ToString().Trim(); if (todayposts > highestposts) { highestposts = todayposts; highestpostsdate = DateTime.Now.ToString("yyyy-M-d"); } totalonline = onlineusercount; OnlineUsers.GetOnlineUserCollection(out totalonline, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser); highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount"); highestonlineusertime = Statistics.GetStatisticsRowItem("highestonlineusertime"); if (userid != -1) { score = Scoresets.GetValidScoreName(); ShortUserInfo user = Users.GetShortUserInfo(userid); score1 = ((decimal)user.Extcredits1).ToString(); score2 = ((decimal)user.Extcredits2).ToString(); score3 = ((decimal)user.Extcredits3).ToString(); score4 = ((decimal)user.Extcredits4).ToString(); score5 = ((decimal)user.Extcredits5).ToString(); score6 = ((decimal)user.Extcredits6).ToString(); score7 = ((decimal)user.Extcredits7).ToString(); score8 = ((decimal)user.Extcredits8).ToString(); } //相册 if (config.Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null) { albumcategorylist = AlbumPluginProvider.GetInstance().GetAlbumCategory(); } if (config.Enablespace == 1 && AggregationFacade.SpaceAggregation.GetSpaceTopComments() != null) { topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments(); } taglist = (config.Enabletag == 1 ? ForumTags.GetCachedHotForumTags(config.Hottagcount) : new TagInfo[0]); doublead = Advertisements.GetDoubleAd("indexad", 0); floatad = Advertisements.GetFloatAd("indexad", 0); }
private void SetTopicInfo(string[] pollitem, int topicprice, string postmessage) { if (this.postinfo.Layer == 0) { new StringBuilder(""); if (this.topic.Special == 1) { string text = Utils.HtmlEncode(DNTRequest.GetFormString("PollItemname").Trim()); if (text.IsNullOrEmpty()) { base.AddErrLine("投票项为空"); return; } int num = (DNTRequest.GetString("multiple") == "on") ? 1 : 0; int num2 = DNTRequest.GetInt("maxchoices", 0); if (num == 1 && num2 > pollitem.Length) { num2 = pollitem.Length; } if (!Poll.UpdatePoll( this.topic.ID, num, pollitem.Length, DNTRequest.GetFormString("PollOptionID").Trim(), text, DNTRequest.GetFormString("PollOptionDisplayOrder").Trim(), Utility.ToDateTime(DNTRequest.GetString("enddatetime")), num2, (DNTRequest.GetString("visiblepoll") == "on") ? 1 : 0, (DNTRequest.GetString("allowview") == "on") ? true : false)) { base.AddErrLine("投票错误,请检查显示顺序"); return; } } if (this.topic.Special == 4) { this.debateinfo.PositiveOpinion = DNTRequest.GetString("positiveopinion"); this.debateinfo.NegativeOpinion = DNTRequest.GetString("negativeopinion"); this.debateinfo.TerminalTime = Request["terminaltime"].ToDateTime(); if (this.debateinfo.Update() < 1) { base.AddErrLine("辩论修改选择了无效的主题"); return; } } int @int = DNTRequest.GetInt("iconid", 0); this.topic.IconID = ((@int > 15 || @int < 0) ? 0 : @int); this.topic.Title = this.postinfo.Title; if (this.topic.Special == 2) { int num3 = topicprice - this.topic.Price; if (num3 > 0) { if (this.bonusCreditsTrans < 1 || this.bonusCreditsTrans > 8) { base.AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return; } if (!usergroupinfo.Is管理员 && Users.GetUserExtCredits(this.topic.PosterID, this.bonusCreditsTrans) < (float)num3) { base.AddErrLine("主题作者 " + Scoresets.GetValidScoreName()[this.bonusCreditsTrans] + " 不足, 无法追加悬赏"); return; } this.topic.Price = topicprice; BBX.Entity.User.UpdateUserExtCredits(this.topic.PosterID, this.bonusCreditsTrans, (float)(-(float)num3) * (Scoresets.GetCreditsTax() + 1f)); } else { if (num3 < 0 && !usergroupinfo.Is管理员) { base.AddErrLine("不能降低悬赏价格"); return; } } } else { if (this.topic.Special == 0) { this.topic.Price = topicprice; } } if (this.usergroupinfo.AllowSetreadPerm) { this.topic.ReadPerm = ((DNTRequest.GetInt("topicreadperm", 0) > 255) ? 255 : DNTRequest.GetInt("topicreadperm", 0)); } if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode) { this.topic.Hide = 1; } this.topic.TypeID = DNTRequest.GetFormInt("typeid", 0); this.htmltitle = DNTRequest.GetString("htmltitle").Trim(); if (!this.htmltitle.IsNullOrEmpty() && Utils.HtmlDecode(this.htmltitle).Trim() != this.topic.Title) { this.topic.Magic = 11000; } else { this.topic.Magic = 0; } this.topic.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, this.topic, this.message, this.disablepostctrl); Tag.DeleteTopicTags(this.topic.ID); //Topics.DeleteRelatedTopics(this.topic.ID); TopicTagCache.DeleteRelatedTopics(this.topic.ID); string text2 = DNTRequest.GetString("tags").Trim(); if (this.enabletag && !text2.IsNullOrEmpty()) { if (ForumUtils.InBanWordArray(text2)) { base.AddErrLine("标签中含有系统禁止词语,请修改"); return; } string[] array = Utils.SplitString(text2, " ", true, 2, 10); if (array.Length <= 0 || array.Length > 5) { base.AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签"); return; } this.topic.Magic = Topics.SetMagicValue(this.topic.Magic, MagicType.TopicTag, 1); Tag.CreateTopicTags(array, this.topic.ID, this.userid, Utils.GetDateTime()); } //Topics.UpdateTopic(this.topic); topic.Update(); if (this.canhtmltitle && !this.htmltitle.IsNullOrEmpty() && this.htmltitle != this.topic.Title) { Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(this.htmltitle), this.topic.ID); return; } } else { if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode) { this.topic.Hide = 1; //Topics.UpdateTopic(this.topic); topic.Update(); } } }
protected override void ShowPage() { pagetitle = "用户控制面板"; creditstax = Scoresets.GetCreditsTax(); extcreditspaylist = Scoresets.GetScorePaySet(0); score = Scoresets.GetValidScoreName(); jscreditsratearray = "<script type=\"text/javascript\">\r\nvar creditsrate = new Array();\r\n"; foreach (DataRow dr in extcreditspaylist.Rows) { jscreditsratearray = jscreditsratearray + "creditsrate[" + dr["id"].ToString() + "] = " + dr["rate"].ToString() + ";\r\n"; } jscreditsratearray = jscreditsratearray + "\r\n</script>"; if (userid == -1) { AddErrLine("你尚未登录"); return; } user = Discuz.Forum.Users.GetUserInfo(userid); if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (Utils.MD5(DNTRequest.GetString("password")) != password) { AddErrLine("密码错误"); return; } int paynum = DNTRequest.GetInt("paynum", 0); if (paynum <= 0) { AddErrLine("数量必须是大于0的整数"); return; } int extcredits1 = DNTRequest.GetInt("extcredits1", 0); int extcredits2 = DNTRequest.GetInt("extcredits2", 0); if (extcredits1 < 1 || extcredits2 < 1 || extcredits1 > 8 || extcredits2 > 8) { AddErrLine("请正确选择要兑换的金币类型!"); return; } if (extcredits1 == extcredits2) { AddErrLine("不能兑换相同类型的金币"); return; } //对交易后的金币增减进行修改设置 UserExtcreditsInfo extcredits1info = Scoresets.GetScoreSet(extcredits1); UserExtcreditsInfo extcredits2info = Scoresets.GetScoreSet(extcredits2); if ((extcredits1info.Name.Trim() == "") || (extcredits2info.Name.Trim() == "")) { AddErrLine("错误的输入!"); return; } UserInfo __userinfo = Discuz.Forum.Users.GetUserInfo(userid); if ((Discuz.Forum.Users.GetUserExtCredits(userid, extcredits1) - paynum) < Scoresets.GetExchangeMinCredits()) { AddErrLine("抱歉, 您的 \"" + extcredits1info.Name + "\" 不足." + Scoresets.GetExchangeMinCredits().ToString()); return; } //计算并更新2个扩展金币的新值 extcredits1rate = extcredits1info.Rate; extcredits2rate = extcredits2info.Rate; float extcredit2paynum = (float)Math.Round(paynum * (extcredits1rate / extcredits2rate) * (1 - creditstax), 2); Discuz.Forum.Users.UpdateUserExtCredits(userid, extcredits1, paynum * -1); Discuz.Forum.Users.UpdateUserExtCredits(userid, extcredits2, extcredit2paynum); CreditsLogs.AddCreditsLog(userid, userid, extcredits1, extcredits2, paynum, extcredit2paynum, Utils.GetDateTime(), 1); SetUrl("usercpcreaditstransferlog.aspx"); SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("金币兑换完毕, 正在返回金币兑换与转帐记录"); } }
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())); }
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);此方法与后台积分设置中的条目不匹配,故注释 }
protected override void ShowPage() { this.pagetitle = "首页"; if (this.config.Rssstatus == 1) { base.AddLinkRss("tools/rss.aspx", "最新主题"); } //this.announcementlist = Announcements.GetSimplifiedAnnouncementList(this.nowdatetime, "2999-01-01 00:00:00"); announcementlist = Announcement.GetAvailableList(); if (this.announcementlist != null) { this.announcementcount = this.announcementlist.Count; } this.forumlinkcount = this.forumlinklist.Rows.Count; Forums.GetForumIndexCollection(this.config.Hideprivate, this.usergroupid, this.config.Moddisplay, out this.totaltopic, out this.totalpost, out this.todayposts); this.totalusers = Statistic.Current.TotalUsers; this.lastusername = Statistic.Current.LastUserName; this.lastuserid = Statistic.Current.LastUserID; this.yesterdayposts = Statistic.Current.YesterdayPosts; this.highestposts = Statistic.Current.HighestPosts; this.highestpostsdate = Statistic.Current.HighestPostsDate; if (this.todayposts > this.highestposts) { this.highestposts = this.todayposts; this.highestpostsdate = DateTime.Now.ToString("yyyy-M-d"); } this.totalonline = this.onlineusercount; //Online.GetOnlineUserCollection(out this.totalonline, out this.totalonlineguest, out this.totalonlineuser, out this.totalonlineinvisibleuser); var st = Online.GetStat(); this.totalonline = st.Total; this.totalonlineuser = st.User; this.totalonlineinvisibleuser = st.Invisible; this.totalonlineguest = st.Guest; this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + ""; this.highestonlineusertime = Statistic.Current.HighestOnlineUserTime.ToFullString(); if (this.userid != -1) { this.score = Scoresets.GetValidScoreName(); IUser shortUserInfo = BBX.Entity.User.FindByID(this.userid); this.score1 = ((decimal)shortUserInfo.ExtCredits1).ToString(); this.score2 = ((decimal)shortUserInfo.ExtCredits2).ToString(); this.score3 = ((decimal)shortUserInfo.ExtCredits3).ToString(); this.score4 = ((decimal)shortUserInfo.ExtCredits4).ToString(); this.score5 = ((decimal)shortUserInfo.ExtCredits5).ToString(); this.score6 = ((decimal)shortUserInfo.ExtCredits6).ToString(); this.score7 = ((decimal)shortUserInfo.ExtCredits7).ToString(); this.score8 = ((decimal)shortUserInfo.ExtCredits8).ToString(); } //if (this.config.Enablealbum == 1 && AlbumPluginProvider.GetInstance() != null) //{ // this.albumcategorylist = AlbumPluginProvider.GetInstance().GetAlbumCategory(); //} //if (this.config.Enablespace == 1 && AggregationFacade.SpaceAggregation.GetSpaceTopComments() != null) //{ // this.topspacecomments = AggregationFacade.SpaceAggregation.GetSpaceTopComments(); //} this.taglist = config.Enabletag ? Tag.GetHotForumTags(this.config.Hottagcount).ToArray() : new Tag[0]; this.doublead = Advertisement.GetDoubleAd("indexad", 0); this.floatad = Advertisement.GetFloatAd("indexad", 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(); } }
protected override void ShowPage() { pagetitle = "首页"; score = Scoresets.GetValidScoreName(); if (config.Rssstatus == 1) { AddLinkRss("tools/rss.aspx", string.Format("{0} 最新主题", config.Forumtitle)); } OnlineUsers.UpdateAction(olid, UserAction.IndexShow.ActionID, 0, config.Onlinetimeout); if (newpmcount > 0) { pmlist = PrivateMessages.GetPrivateMessageCollectionForIndex(userid, 5, 1, 1); } userinfo = new ShortUserInfo(); if (userid != -1) { userinfo = Discuz.Forum.Users.GetShortUserInfo(userid); if (userinfo.Newpm == 0) { base.newpmcount = 0; } lastvisit = userinfo.Lastvisit.ToString(); showpmhint = Convert.ToInt32(userinfo.Newsletter) > 4; } Statistics.GetPostCountFromForum(0, out totaltopic, out totalpost, out todayposts); digesttopiclist = Focuses.GetDigestTopicList(16); hottopiclist = Focuses.GetHotTopicList(16, 30); forumlinklist = Caches.GetForumLinkList(); forumlinkcount = forumlinklist.Rows.Count; // 获得统计信息 totalusers = Utils.StrToInt(Statistics.GetStatisticsRowItem("totalusers"), 0); lastusername = Statistics.GetStatisticsRowItem("lastusername"); lastuserid = Utils.StrToInt(Statistics.GetStatisticsRowItem("lastuserid"), 0); totalonline = onlineusercount; showforumonline = false; if (totalonline < config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { showforumonline = true; onlineuserlist = OnlineUsers.GetOnlineUserList(onlineusercount, out totalonlineguest, out totalonlineuser, out totalonlineinvisibleuser); onlineiconlist = Caches.GetOnlineGroupIconList(); } if (DNTRequest.GetString("showonline") == "no") { showforumonline = false; } highestonlineusercount = Statistics.GetStatisticsRowItem("highestonlineusercount"); highestonlineusertime = Statistics.GetStatisticsRowItem("highestonlineusertime"); // 得到公告 announcementlist = Announcements.GetSimplifiedAnnouncementList(nowdatetime, "2999-01-01 00:00:00"); announcementcount = 0; if (announcementlist != null) { announcementcount = announcementlist.Rows.Count; } ///得到广告列表 headerad = Advertisements.GetOneHeaderAd("indexad", 0); footerad = Advertisements.GetOneFooterAd("indexad", 0); pagewordad = Advertisements.GetPageWordAd("indexad", 0); doublead = Advertisements.GetDoubleAd("indexad", 0); floatad = Advertisements.GetFloatAd("indexad", 0); }
protected override void ShowPage() { pagetitle = "用户控制面板"; creditstax = Scoresets.GetCreditsTax(); if (userid == -1) { AddErrLine("你尚未登录"); return; } user = Discuz.Forum.Users.GetUserInfo(userid); if (DNTRequest.IsPost()) { if (ForumUtils.IsCrossSitePost()) { AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (Utils.MD5(DNTRequest.GetString("password")) != password) { AddErrLine("密码错误"); return; } int paynum = DNTRequest.GetInt("paynum", 0); if (paynum <= 0) { AddErrLine("数量必须是大于等于0的整数"); return; } int fromto = Discuz.Forum.Users.GetUserID(DNTRequest.GetString("fromto").Trim()); if (fromto == -1) { AddErrLine("指定的转帐接受人不存在"); return; } int extcredits = DNTRequest.GetInt("extcredits", 0); if (extcredits < 1 || extcredits > 8) { AddErrLine("请正确选择要转帐的金币类型!"); return; } //对转帐后的金币增减进行修改设置 UserExtcreditsInfo extcreditsinfo = Scoresets.GetScoreSet(extcredits); if (extcreditsinfo.Name.Trim() == "") { AddErrLine("错误的输入!"); return; } //UserInfo __userinfo = Discuz.Forum.Users.GetUserInfo(userid); if ((Discuz.Forum.Users.GetUserExtCredits(userid, extcredits) - paynum) < Scoresets.GetTransferMinCredits()) { AddErrLine(string.Format("抱歉, 您的 \"{0}\" 不足.系统当前规定转帐余额不得小于{1}", extcreditsinfo.Name, Scoresets.GetTransferMinCredits().ToString())); return; } //计算并更新2个扩展金币的新值 float topaynum = (float)Math.Round(paynum * (1 - creditstax), 2); Discuz.Forum.Users.UpdateUserExtCredits(userid, extcredits, paynum * -1); Discuz.Forum.Users.UpdateUserExtCredits(fromto, extcredits, topaynum); CreditsLogs.AddCreditsLog(userid, fromto, extcredits, extcredits, paynum, topaynum, Utils.GetDateTime(), 2); SetUrl("usercpcreaditstransferlog.aspx"); SetMetaRefresh(); SetShowBackLink(false); AddMsgLine("金币转帐完毕, 正在返回金币兑换与转帐记录"); } score = Scoresets.GetValidScoreName(); extcreditspaylist = Scoresets.GetScorePaySet(1); }
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(); }
public override string OnMouduleLoad(string content) { UserPrefsSaved userprefs = new UserPrefsSaved(this.Module.UserPref); string value = userprefs.GetValueByName("showaddons"); string vertical = userprefs.GetValueByName("isvertical"); string[] score = Scoresets.GetValidScoreName(); UserInfo ui = Users.GetUserInfo(this.Module.Uid); UserGroupInfo group = UserGroups.GetUserGroupInfo(ui.Groupid); content = StaticFileProvider.GetContent(contentTemplate); if (vertical == "1") { content = Regex.Replace(content, @"<div id=""UserInfo""([\s\S]+?)</div>\r\n</div>", ""); } else { content = Regex.Replace(content, @"<div id=""UserInfo2""([\s\S]+?)</div>\r\n</div>", ""); } content = content.Replace("${username}", ui.Username); string avatar = string.Empty; //if (ui.Avatar != string.Empty) //{ // if (Regex.IsMatch(ui.Avatar, @"^(http://)?([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?")) // avatar = string.Format("<img src='{0}'", ui.Avatar); // else if (ui.Avatar.StartsWith("avatars")) // avatar = string.Format("<img src='{0}'", BaseConfigs.GetForumPath + ui.Avatar.Replace('\\','/')); // else // avatar = string.Format("<img src='{0}'", ui.Avatar.Replace('\\', '/')); // if (ui.Avatarwidth > 0) // avatar += string.Format(" width='{0}' height='{1}' ", ui.Avatarwidth, ui.Avatarheight); // avatar += "/>"; //} content = content.Replace("${useravatar}", avatar); content = content.Replace("${userid}", ui.Uid.ToString()); content = content.Replace("${nickname}", ui.Nickname); content = content.Replace("${usergroup}", group.Grouptitle); content = content.Replace("${usercredits}", ui.Credits.ToString()); content = content.Replace("${forumpath}", BaseConfigs.GetForumPath); string addoninfo = string.Empty; if (value == "1") { if (score[1] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[1], ui.Extcredits1); } if (score[2] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[2], ui.Extcredits2); } if (score[3] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[3], ui.Extcredits3); } if (score[4] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[4], ui.Extcredits4); } if (score[5] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[5], ui.Extcredits5); } if (score[6] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[6], ui.Extcredits6); } if (score[7] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[7], ui.Extcredits7); } if (score[8] != "") { addoninfo += string.Format("<li><span>{0}: </span>{1}</li>", score[8], ui.Extcredits8); } } content = content.Replace("${addoninfo}", addoninfo); return(base.OnMouduleLoad(content)); }