//public static bool NeedAudit(Int32 fid, Int32 modnewposts, int useradminid, int userid, UserGroup userGroup) //{ // return useradminid != 1 && !Moderators.IsModer(useradminid, userid, fid) && (Scoresets.BetweenTime(GeneralConfigInfo.Current.Postmodperiods) || modnewposts == 1 || userGroup != null && userGroup.ModNewTopics == 1); // 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; // return false; //} //public static bool PostReply(String permuserlist, String replyperm, int userid, UserGroup usergroupinfo, TopicInfo topic) //{ // bool result = usergroupinfo.Is管理团队; // if (topic.Closed == 0) // { // if (userid > -1 && Forums.AllowReplyByUserID(permuserlist, userid)) return true; // if (replyperm.IsNullOrEmpty()) // { // if (usergroupinfo.AllowReply) return true; // } // else // { // if (Forums.AllowReply(replyperm, usergroupinfo.ID)) return true; // } // } // return result; //} public static bool PostReply(IXForum fi, int userid, UserGroup usergroupinfo, Topic topic) { bool result = usergroupinfo.Is管理团队; if (topic.Closed == 0) { if (userid > -1 && Forums.AllowReplyByUserID(fi.Permuserlist, userid)) { return(true); } if (fi.ReplyPerm.IsNullOrEmpty()) { if (usergroupinfo.AllowReply) { return(true); } } else { if (fi.Field.AllowReply(usergroupinfo.ID)) { return(true); } } } return(result); }
//public static int GetForumCount() //{ // return BBX.Data.Stats.GetForumCount(); //} //public static int GetTopicCount() { return Statistic.Current.TotalTopic; } //public static int GetPostCount() { return Statistic.Current.TotalPost; } //public static int GetMemberCount() { return Statistic.Current.TotalUsers; } //public static int GetTodayPostCount() //{ // return BBX.Data.Stats.GetTodayPostCount(TableList.GetPostTableId()); //} //public static int GetTodayNewMemberCount() //{ // return BBX.Data.Stats.GetTodayNewMemberCount(); //} //public static int GetAdminCount() //{ // return BBX.Data.Stats.GetAdminCount(); //} //public static int GetNonPostMemCount() //{ // return BBX.Data.Stats.GetNonPostMemCount(); //} public static IXForum GetHotForum() { IXForum result = null; int num = 0; foreach (var item in Forums.GetForumList()) { if (item.Layer > 0 && item.Visible && item.Posts > num) { num = item.Posts; result = item; } } if (num > 0) { return(result); } foreach (var item in Forums.GetForumList()) { if (item.Layer > 0 && item.Visible) { return(item); } } return(null); }
public static bool DownloadAttachment(IXForum forum, int userid, UserGroup usergroupinfo) { bool result = false; if (Forums.AllowGetAttachByUserID(forum.Permuserlist, userid)) { return(true); } if (forum.Getattachperm.IsNullOrEmpty()) { if (usergroupinfo.AllowGetattach) { return(true); } } else { if (forum.Field.AllowGetAttach(usergroupinfo.ID)) { return(true); } } return(result); }
private void SubmitBatchSet_Click(object sender, EventArgs e) { string fidlist = Request["Forumtree1"]; if (String.IsNullOrEmpty(fidlist) || fidlist == "," || fidlist == "0") { base.RegisterStartupScript("", "<script>alert('您未选中任何版块, 系统无法提交! ');</script>"); return; } this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", -1)); //this.forumInfo.AllowHtml = 0; //this.forumInfo.AllowBlog = 0; //this.forumInfo.IsTrade = 0; //this.forumInfo.AllowEditRules = 0; this.forumInfo.AllowSmilies = this.setting.Items[0].Selected; this.forumInfo.AllowRss = this.setting.Items[1].Selected; this.forumInfo.AllowBbCode = this.setting.Items[2].Selected; this.forumInfo.AllowImgCode = this.setting.Items[3].Selected; this.forumInfo.Recyclebin = this.BoolToInt(this.setting.Items[4].Selected); this.forumInfo.Modnewposts = this.BoolToInt(this.setting.Items[5].Selected); this.forumInfo.Jammer = this.BoolToInt(this.setting.Items[6].Selected); this.forumInfo.DisableWatermark = this.setting.Items[7].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[8].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[9].Selected; this.forumInfo.AllowTag = this.setting.Items[10].Selected; int num = 0; num = (this.setting.Items[11].Selected ? (num | 1) : (num & -2)); num = (this.setting.Items[12].Selected ? (num | 16) : (num & -17)); num = (this.setting.Items[13].Selected ? (num | 4) : (num & -5)); this.forumInfo.AllowPostSpecial = num; this.forumInfo.AllowEditRules = this.setting.Items[14].Selected; this.forumInfo.Password = this.password.Text; this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(","); this.forumInfo.ViewPerm = this.viewperm.GetSelectString(","); this.forumInfo.PostPerm = this.postperm.GetSelectString(","); this.forumInfo.ReplyPerm = this.replyperm.GetSelectString(","); this.forumInfo.GetattachPerm = this.getattachperm.GetSelectString(","); this.forumInfo.PostattachPerm = this.postattachperm.GetSelectString(","); BatchSetParams bsp = default(BatchSetParams); bsp.SetPassWord = this.setpassword.Checked; bsp.SetAttachExtensions = this.setattachextensions.Checked; bsp.SetPostCredits = this.setpostcredits.Checked; bsp.SetReplyCredits = this.setreplycredits.Checked; bsp.SetSetting = this.setsetting.Checked; bsp.SetViewperm = this.setviewperm.Checked; bsp.SetPostperm = this.setpostperm.Checked; bsp.SetReplyperm = this.setreplyperm.Checked; bsp.SetGetattachperm = this.setgetattachperm.Checked; bsp.SetPostattachperm = this.setpostattachperm.Checked; if (XForum.BatchSet(this.forumInfo, bsp, fidlist)) { ForumOperator.RefreshForumCache(); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "复制版块设置", "编辑论坛版块列表为:" + fidlist.Trim()); base.RegisterStartupScript("PAGE", "window.location.href='forum_ForumsTree.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('提交不成功!');window.location.href='forum_ForumsTree.aspx';</script>"); }
private int IsShowForumLogin(IXForum forum) { int result = 1; if (forum.Password.IsNullOrEmpty()) { result = 0; } else { if (Utils.MD5(forum.Password) == ForumUtils.GetCookie("forum" + this.forumid + "password")) { result = 0; } else { if (forum.Password == DNTRequest.GetString("forumpassword")) { ForumUtils.WriteCookie("forum" + forum.Fid + "password", Utils.MD5(forum.Password)); result = 0; } } } return(result); }
//private string condition = ""; protected override void ShowPage() { //type = DNTRequest.GetString("type", true); if (userid > 0 && useradminid > 0) { admingroupinfo = AdminGroup.FindByID(usergroupid); } if (config.Rssstatus == 1) { base.AddLinkRss("tools/rss.aspx", "最新主题"); } if (forumid == -1) { var vs = Request["fidlist"]; if (vs.IsNullOrWhiteSpace()) { vs = (Request["forums"] + "").ToLower(); } if (vs.IsNullOrWhiteSpace() || vs.EqualIgnoreCase("all")) { vs = GetForums(); } vs = GetAllowviewForums(vs); forums = vs; } navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); if (forumid > 0) { forum = Forums.GetForumInfo(forumid); if (forum == null) { base.AddErrLine("不存在的版块ID"); return; } pagetitle = Utils.RemoveHtml(forum.Name); forumnav = ForumUtils.UpdatePathListExtname(forum.Pathlist.Trim(), config.Extname); showforumlogin = ShowForumLogin(); if (!UserAuthority.VisitAuthority(forum, usergroupinfo, userid, ref msg)) { base.AddErrLine(msg); return; } subforumlist = Forums.GetSubForumCollection(forumid, forum.ColCount, config.Hideprivate, usergroupid, config.Moddisplay); } var condition = GetCondition(); if (base.IsErr()) { return; } pagetitle = ((type == "digest") ? "查看精华" : "查看新帖"); SetPageIdAndNumber(condition); topiclist = Topics.GetTopicListByCondition(tpp, pageid, 0, 10, config.Hottopic, forum == null ? 0 : forum.AutoClose, forum == null ? 0 : forum.Topictypeprefix, condition, GetOrder(), direct); Online.UpdateAction(olid, UserAction.ShowForum, forumid, config.Onlinetimeout); ForumUtils.UpdateVisitedForumsOptions(forumid); }
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); }
public static bool PostAuthority(IXForum forum, UserGroup userGroupInfo, int userId, ref string msg) { if (!Forums.AllowPostByUserID(forum.Permuserlist, userId)) { if (string.IsNullOrEmpty(forum.PostPerm)) { if (!userGroupInfo.AllowPost) { msg = "您当前的身份 \"" + userGroupInfo.GroupTitle + "\" 没有发表主题的权限"; return(false); } } else { if (!forum.Field.AllowPost(userGroupInfo.ID)) { msg = "您没有在该版块发表主题的权限"; return(false); } } } if (!forum.AllowSpecialOnly) { return(true); } if (forum.AllowPostSpecial <= 0) { msg = "您没有在该版块发表特殊主题的权限"; return(false); } if ((forum.Allowpostspecial & 1) != 1 || userGroupInfo.AllowPostpoll) { return(true); } msg = "您当前的身份 \"" + userGroupInfo.GroupTitle + "\" 没有发布投票的权限"; if ((forum.Allowpostspecial & 4) != 4 || userGroupInfo.AllowBonus) { return(true); } msg = "您当前的身份 \"" + userGroupInfo.GroupTitle + "\" 没有发布悬赏的权限"; if ((forum.Allowpostspecial & 16) == 16 && !userGroupInfo.AllowDebate) { msg = "您当前的身份 \"" + userGroupInfo.GroupTitle + "\" 没有发起辩论的权限"; return(false); } return(true); }
public static String GetAttachmentTypeArray(UserGroup group, IXForum forum) { var list = GetAllow(group == null ? null : group.AttachExtensions, forum == null ? null : forum.Attachextensions); if (list.Count == 0) { return(""); } var sb = new StringBuilder(); foreach (var item in list) { sb.AppendFormat("{0},{1}", item.Extension, item.MaxSize); sb.Append("|"); } return(sb.ToString()); }
public static int CreateForums(IXForum forumInfo, out string moderatorsInfo, int adminUid, string adminUserName, int adminUserGruopId, string adminUserGroupTitle, string adminIp) { //int result = BBX.Data.Forums.CreateForumInfo(forumInfo); var result = forumInfo.Insert(); //SetForumsPathList(); moderatorsInfo = SetForumsModerators(result.ToString(), forumInfo.Moderators, forumInfo.Inheritedmod).Replace("'", "’"); var cache = XCache.Current; XCache.Remove(CacheKeys.FORUM_UI_FORUM_LIST_BOX_OPTIONS); XCache.Remove(CacheKeys.FORUM_FORUM_LIST); XCache.Remove("/Aggregation/HotForumList"); XCache.Remove("/Aggregation/ForumHotTopicList"); XCache.Remove("/Aggregation/ForumNewTopicList"); XCache.Remove("/Forum/DropdownOptions"); XCache.Remove(CacheKeys.FORUM_FORUM_LIST_MENU_DIV); AdminVisitLog.InsertLog(adminUid, adminUserName, adminUserGruopId, adminUserGroupTitle, adminIp, "添加论坛版块", "添加论坛版块,名称为:" + forumInfo.Name); return(result); }
public static bool CheckUsertAttachAuthority(IXForum forum, UserGroup userGroupInfo, int userId, ref string msg) { if (!Forums.AllowGetAttachByUserID(forum.Permuserlist, userId)) { if (forum.GetattachPerm.IsNullOrEmpty() && !userGroupInfo.AllowGetattach) { msg = string.Format("您当前的身份 \"{0}\" 没有下载或查看附件的权限", userGroupInfo.GroupTitle); } else { if (!forum.Field.AllowGetAttach(userGroupInfo.ID)) { msg = "您没有在该版块下载附件的权限"; return(false); } } } return(true); }
private bool JumpUrl(IXForum forumInfo) { if (!forumInfo.Redirect.IsNullOrEmpty()) { HttpContext.Current.Response.Redirect(forumInfo.Redirect); return(true); } //if (this.config.Enablemall == 1 && forumInfo.IsTrade) //{ // MallPluginBase instance = MallPluginProvider.GetInstance(); // int goodsCategoryIdByFid = instance.GetGoodsCategoryIdByFid(forumInfo.ID); // if (goodsCategoryIdByFid > 0) // { // HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + Urls.ShowGoodsListAspxRewrite(goodsCategoryIdByFid, 1)); // return true; // } //} return(false); }
public static string UpdateForumInfo(IXForum forumInfo) { //BBX.Data.Forums.UpdateForumInfo(forumInfo); forumInfo.Save(); var cache = XCache.Current; XCache.Remove(CacheKeys.FORUM_FORUM_LIST); //SetForumsPathList(); string result = SetForumsModerators(forumInfo.ID.ToString(), forumInfo.Moderators, forumInfo.Inheritedmod); XCache.Remove(CacheKeys.FORUM_UI_FORUM_LIST_BOX_OPTIONS); XCache.Remove(CacheKeys.FORUM_FORUM_LIST); XCache.Remove("/Forum/TopicTypesOption" + forumInfo.ID); XCache.Remove("/Forum/TopicTypesLink" + forumInfo.ID); XCache.Remove("/Aggregation/HotForumList"); XCache.Remove("/Aggregation/ForumHotTopicList"); XCache.Remove("/Aggregation/ForumNewTopicList"); return(result); }
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)); } }
private void PostTopicSucceed(IXForum forum, Topic topicinfo) { CreditsFacade.PostTopic(this.userid, forum, true); int tid = topicinfo.ID; if (this.config.Aspxrewrite == 1) { base.SetUrl(base.ShowTopicAspxRewrite(tid, 0)); } else { base.SetUrl(base.ShowTopicAspxRewrite(tid, 0) + "&forumpage=" + this.forumpageid); } ForumUtils.WriteCookie("postmessage", ""); ForumUtils.WriteCookie("clearUserdata", "forum"); this.SetLastPostedForumCookie(); base.SetMetaRefresh(); base.MsgForward("posttopic_succeed"); base.AddMsgLine("发表主题成功, 返回该主题<br />(<a href=\"" + base.ShowForumAspxRewrite(this.forumid, this.forumpageid) + "\">点击这里返回 " + forum.Name + "</a>)<br />"); Sync.NewTopic(tid.ToString(), topicinfo.Title, topicinfo.Poster, topicinfo.PosterID.ToString(), topicinfo.Fid.ToString(), ""); }
public static String GetAttachmentTypeString(UserGroup group, IXForum forum) { var list = GetAllow(group == null ? null : group.AttachExtensions, forum == null ? null : forum.Attachextensions); if (list.Count == 0) { return(""); } var sb = new StringBuilder(); foreach (var item in list) { if (sb.Length > 0) { sb.Append(","); } sb.Append(item.Extension); } return(sb.ToString()); }
public static bool PostSpecialAuthority(IXForum forum, string type, ref string msg) { if (forum.Allowpostspecial > 0) { if (type == "poll" && (forum.Allowpostspecial & 1) != 1) { msg = string.Format("当前版块 \"{0}\" 不允许发表投票", forum.Name); return(false); } if (type == "bonus" && (forum.Allowpostspecial & 4) != 4) { msg = string.Format("当前版块 \"{0}\" 不允许发表悬赏", forum.Name); return(false); } if (type == "debate" && (forum.Allowpostspecial & 16) != 16) { msg = string.Format("当前版块 \"{0}\" 不允许发表辩论", forum.Name); return(false); } } return(true); }
public static bool PostAttachAuthority(IXForum forum, UserGroup userGroupInfo, int userId, ref string msg) { if (!Forums.AllowPostAttachByUserID(forum.Permuserlist, userId)) { bool flag = forum.Field.AllowPostAttach(userGroupInfo.ID); if (flag && forum.PostattachPerm != "") { return(true); } if (!flag) { msg = "您没有在该版块上传附件的权限"; return(false); } if (!userGroupInfo.AllowPostattach) { msg = string.Format("您当前的身份 \"{0}\" 没有上传附件的权限", userGroupInfo.GroupTitle); return(false); } } return(true); }
public static bool VisitAuthority(IXForum forum, UserGroup userGroupInfo, int userId, ref string msg) { if (!Forums.AllowViewByUserId(forum.Permuserlist, userId)) { if (string.IsNullOrEmpty(forum.Viewperm)) { if (!userGroupInfo.AllowVisit) { msg = "您当前的身份 \"" + userGroupInfo.GroupTitle + "\" 没有浏览该版块的权限"; return(false); } } else { if (!forum.AllowView(userGroupInfo.ID)) { msg = "您没有浏览该版块的权限"; return(false); } } } return(true); }
protected override void ShowPage() { if (this.userid == -1) { base.AddErrLine("你尚未登录"); return; } if (this.topicid != -1) { var topicInfo = Topic.FindByID(this.topicid); if (topicInfo == null) { base.AddErrLine("不存在的主题ID"); return; } this.topictitle = topicInfo.Title; this.forumid = topicInfo.Fid; this.forum = Forums.GetForumInfo(this.forumid); this.forumname = this.forum.Name; this.pagetitle = Utils.RemoveHtml(this.forum.Name); this.forumnav = this.forum.Pathlist; this.CheckFavorite(FavoriteType.ForumTopic, this.topicid, "主题"); } }
public void InsertForum(Int32 parentid, Int32 systemdisplayorder) { //需要初始化 forumInfo forumInfo = new XForum(); this.forumInfo.ParentID = parentid; //this.forumInfo.Layer = layer.ToInt(); //this.forumInfo.Parentidlist = parentidlist; //this.forumInfo.SubforumCount = subforumcount.ToInt(); this.forumInfo.Name = this.name.Text.Trim(); this.forumInfo.Status = this.status.SelectedValue.ToInt(); this.forumInfo.DisplayOrder = systemdisplayorder; this.forumInfo.TemplateID = this.templateid.SelectedValue.ToInt(); this.forumInfo.AllowSmilies = this.setting.Items[0].Selected; this.forumInfo.AllowRss = this.setting.Items[1].Selected; //this.forumInfo.AllowHtml = 0; this.forumInfo.AllowBbCode = this.setting.Items[2].Selected; this.forumInfo.AllowImgCode = this.setting.Items[3].Selected; //this.forumInfo.AllowBlog = 0; //this.forumInfo.IsTrade = 0; //this.forumInfo.AllowEditRules = 0; this.forumInfo.Recyclebin = this.BoolToInt(this.setting.Items[4].Selected); this.forumInfo.Modnewposts = this.BoolToInt(this.setting.Items[5].Selected); this.forumInfo.Modnewtopics = this.BoolToInt(this.setting.Items[6].Selected); this.forumInfo.Jammer = this.BoolToInt(this.setting.Items[7].Selected); this.forumInfo.DisableWatermark = this.setting.Items[8].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[9].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[10].Selected; this.forumInfo.AllowTag = this.setting.Items[11].Selected; //this.forumInfo.IsTrade = 0; int num = 0; num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2)); num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17)); num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5)); this.forumInfo.AllowPostSpecial = num; this.forumInfo.AllowEditRules = this.setting.Items[15].Selected; this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0; this.forumInfo.AutoClose = ((this.autocloseoption.SelectedValue == "0") ? 0 : this.autocloseday.Text.ToInt()); this.forumInfo.Description = this.description.Text; this.forumInfo.Password = this.password.Text; this.forumInfo.Icon = this.icon.Text; //this.forumInfo.PostcrEdits = ""; //this.forumInfo.ReplycrEdits = ""; this.forumInfo.Redirect = this.redirect.Text; this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(","); this.forumInfo.Moderators = this.moderators.Text; this.forumInfo.Rules = this.rules.Text; this.forumInfo.Seokeywords = this.seokeywords.Text.Trim(); this.forumInfo.Seodescription = this.seodescription.Text.Trim(); this.forumInfo.RewriteName = this.rewritename.Text.Trim(); this.forumInfo.TopicTypes = this.topictypes.Text; this.forumInfo.ColCount = colcount.SelectedValue == "1" ? 1 : colcountnumber.Text.ToInt(); this.forumInfo.ViewPerm = base.Request.Form["viewperm"]; this.forumInfo.PostPerm = base.Request.Form["postperm"]; this.forumInfo.ReplyPerm = base.Request.Form["replyperm"]; this.forumInfo.GetattachPerm = base.Request.Form["getattachperm"]; this.forumInfo.PostattachPerm = base.Request.Form["postattachperm"]; string text; int fid = AdminForums.CreateForums(this.forumInfo, out text, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip); if (HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) { this.forumInfo = Forums.GetForumInfo(fid); this.forumInfo.Icon = AdminForums.UploadForumIcon(this.forumInfo.ID); AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’"); ForumOperator.RefreshForumCache(); GeneralConfigInfo config = GeneralConfigInfo.Current; config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0); config.Save(); //config.Save();; } if (string.IsNullOrEmpty(text)) { base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';"); return; } base.RegisterStartupScript("PAGE", "alert('用户:" + text + "不存在,因为无法设为版主');self.location.href='forum_ForumsTree.aspx';"); }
private void SubmitInfo_Click(object sender, EventArgs e) { var fid = Request["fid"].ToInt(); if (base.CheckCookie() && fid > 0) { //this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0)); var f = XForum.FindByID(fid); this.forumInfo = f as IXForum; this.forumInfo.Name = this.name.Text.Trim(); this.forumInfo.DisplayOrder = displayorder.Text.ToInt(); this.forumInfo.Status = status.SelectedValue.ToInt(); if (this.colcount.SelectedValue == "1") { this.forumInfo.ColCount = 1; } else { var count = colcountnumber.Text.ToInt(); if (count < 1 || count > 9) { this.colcountnumber.Text = ""; base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } this.forumInfo.ColCount = count; } if (this.rewritename.Text.Trim() != this.oldrewritename.Value && !this.rewritename.Text.IsNullOrEmpty() && XForum.CheckRewriteNameInvalid(this.rewritename.Text.Trim())) { this.rewritename.Text = ""; base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>"); return; } this.forumInfo.TemplateID = ((this.templateid.SelectedValue.ToInt() == this.config.Templateid) ? 0 : this.templateid.SelectedValue.ToInt()); //this.forumInfo.AllowHtml = 0; //this.forumInfo.AllowBlog = 0; //this.forumInfo.IsTrade = 0; //this.forumInfo.AllowEditRules = 0; this.forumInfo.AllowSmilies = this.setting.Items[0].Selected; this.forumInfo.AllowRss = this.setting.Items[1].Selected; this.forumInfo.AllowBbCode = this.setting.Items[2].Selected; this.forumInfo.AllowImgCode = this.setting.Items[3].Selected; this.forumInfo.Recyclebin = this.BoolToInt(this.setting.Items[4].Selected); this.forumInfo.Modnewposts = this.BoolToInt(this.setting.Items[5].Selected); this.forumInfo.Modnewtopics = this.BoolToInt(this.setting.Items[6].Selected); this.forumInfo.Jammer = this.BoolToInt(this.setting.Items[7].Selected); this.forumInfo.DisableWatermark = this.setting.Items[8].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[9].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[10].Selected; this.forumInfo.AllowTag = this.setting.Items[11].Selected; int num = 0; num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2)); num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17)); num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5)); this.forumInfo.AllowPostSpecial = num; this.forumInfo.AllowEditRules = this.setting.Items[15].Selected; this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0; if (this.autocloseoption.SelectedValue == "0") { this.forumInfo.AutoClose = 0; } else { this.forumInfo.AutoClose = this.autocloseday.Text.ToInt(); } this.forumInfo.Description = this.description.Text; this.forumInfo.Password = this.password.Text; this.forumInfo.Icon = ((HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) ? AdminForums.UploadForumIcon(this.forumInfo.ID) : this.icon.Text); this.forumInfo.Redirect = this.redirect.Text; this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(","); AdminForums.CompareOldAndNewModerator(this.forumInfo.Moderators, this.moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0)); this.forumInfo.Moderators = this.moderators.Text.Replace("\r\n", ","); this.forumInfo.Rules = this.rules.Text.Trim(); this.forumInfo.Seokeywords = this.seokeywords.Text.Trim(); this.forumInfo.Seodescription = this.seodescription.Text.Trim(); this.forumInfo.RewriteName = this.rewritename.Text.Trim(); this.forumInfo.ViewPerm = base.Request.Form["viewperm"]; this.forumInfo.PostPerm = base.Request.Form["postperm"]; this.forumInfo.ReplyPerm = base.Request.Form["replyperm"]; this.forumInfo.GetattachPerm = base.Request.Form["getattachperm"]; this.forumInfo.PostattachPerm = base.Request.Form["postattachperm"]; this.forumInfo.ApplytopicType = Convert.ToSByte(this.applytopictype.SelectedValue); this.forumInfo.PostbytopicType = Convert.ToSByte(this.postbytopictype.SelectedValue); this.forumInfo.ViewbytopicType = Convert.ToSByte(this.viewbytopictype.SelectedValue); this.forumInfo.Topictypeprefix = Convert.ToSByte(this.topictypeprefix.SelectedValue); this.forumInfo.TopicTypes = this.GetTopicType(); this.forumInfo.Permuserlist = this.GetPermuserlist(); //AggregationFacade.ForumAggregation.ClearDataBind(); string text = AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’"); if (this.childForumApplyTemplate.Checked) { // 子孙采用相同的模板 //AdminForums.UpdateForumTemplateID(this.forumInfo); foreach (var item in f.AllChilds) { item.TemplateID = f.TemplateID; item.Update(); } } ForumOperator.RefreshForumCache(); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + this.name.Text.Trim()); var config = GeneralConfigInfo.Current; config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0); config.Save(); //config.Save();; if (String.IsNullOrEmpty(text)) { //base.Response.Redirect("forum_ForumsTree.aspx"); base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';"); return; } base.Response.Write("<script>alert('用户:" + text + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); base.Response.End(); } }
protected override void ShowPage() { if (this.oluserinfo.GroupID == 4) { base.AddErrLine("你所在的用户组,为禁止发言"); return; } if (this.userid > 0) { this.userinfo = BBX.Entity.User.FindByID(this.userid); } if (HttpContext.Current.Request.RawUrl.Contains("javascript:")) { base.AddErrLine("非法的链接"); return; } this.forum = XForum.FindByID(forumid); if (this.forum == null || this.forum.Layer == 0) { this.forum = new XForum(); this.allowposttopic = false; base.AddErrLine("错误的论坛ID"); return; } this.pagetitle = Utils.RemoveHtml(this.forum.Name); this.enabletag = config.Enabletag && this.forum.AllowTag; if (this.forum.ApplytopicType == 1) { this.topictypeselectoptions = Forums.GetCurrentTopicTypesOption(this.forum.Fid, this.forum.TopicTypes); } if (!String.IsNullOrEmpty(this.forum.Password) && Utils.MD5(this.forum.Password) != ForumUtils.GetCookie("forum" + this.forumid + "password")) { base.AddErrLine("本版块被管理员设置了密码"); base.SetBackLink(base.ShowForumAspxRewrite(this.forumid, 0)); return; } this.needaudit = UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo); this.smileyoff = forum.AllowSmilies ? 0 : 1; this.bbcodeoff = ((this.forum.Allowbbcode == 1 && this.usergroupinfo.AllowCusbbCode) ? 0 : 1); //this.allowimg = this.forum.Allowimgcode; this.customeditbuttons = Caches.GetCustomEditButtonList(); if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg)) { base.AddErrLine(this.msg); this.needlogin = true; return; } if (!UserAuthority.PostAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg)) { base.AddErrLine(this.msg); this.needlogin = true; return; } //string allowAttachmentType = Attachments.GetAllowAttachmentType(this.usergroupinfo, this.forum); this.attachextensions = AttachType.GetAttachmentTypeArray(usergroupinfo, this.forum); this.attachextensionsnosize = AttachType.GetAttachmentTypeString(usergroupinfo, this.forum); int num = (this.userid > 0) ? Attachment.GetUploadFileSizeByuserid(this.userid) : 0; this.attachsize = this.usergroupinfo.MaxSizeperday - num; this.canpostattach = UserAuthority.PostAttachAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg); this.canhtmltitle = this.usergroupinfo.AllowHtmlTitle; this.creditstrans = Scoresets.GetTopicAttachCreditsTrans(); this.userextcreditsinfo = Scoresets.GetScoreSet(this.creditstrans); this.bonusextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetBonusCreditsTrans()); if (this.forum.AllowSpecialOnly && !Utils.InArray(this.type, "poll,bonus,debate")) { base.AddErrLine(string.Format("当前版块 \"{0}\" 不允许发表普通主题", this.forum.Name)); return; } if (!UserAuthority.PostSpecialAuthority(this.forum, this.type, ref this.msg)) { base.AddErrLine(this.msg); return; } if (!UserAuthority.PostSpecialAuthority(this.usergroupinfo, this.type, ref this.msg)) { base.AddErrLine(this.msg); this.needlogin = true; return; } if (this.type == "bonus") { int bonusCreditsTrans = Scoresets.GetBonusCreditsTrans(); if (bonusCreditsTrans <= 0) { base.AddErrLine("系统未设置\"交易积分设置\", 无法判断当前要使用的(扩展)积分字段, 暂时无法发布悬赏"); return; } this.mybonustranscredits = Users.GetUserExtCredits(this.userid, bonusCreditsTrans); } this.userGroupInfoList.Sort((x, y) => x.Readaccess - y.Readaccess + (y.ID - x.ID)); var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); this.disablepost = adminGroupInfo != null ? adminGroupInfo.DisablePostctrl : this.usergroupinfo.DisablePeriodctrl; if (this.ispost) { if (!UserAuthority.CheckPostTimeSpan(this.usergroupinfo, adminGroupInfo, this.oluserinfo, this.userinfo, ref this.msg)) { base.AddErrLine(this.msg); return; } base.SetBackLink(string.Format("posttopic.aspx?forumid={0}&restore=1&type={1}", this.forumid, this.type)); ForumUtils.WriteCookie("postmessage", this.postmessage); this.NormalValidate(adminGroupInfo, this.postmessage, this.userinfo); if (base.IsErr()) { return; } if (ForumUtils.IsPostFile()) { if (Utils.StrIsNullOrEmpty(AttachType.GetAttachmentTypeArray(usergroupinfo, forum))) { base.AddErrLine("系统不允许上传附件"); } if (!UserAuthority.PostAttachAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg)) { base.AddErrLine(this.msg); } } int topicprice = 0; bool isbonus = this.type == "bonus"; this.ValidateBonus(ref topicprice, ref isbonus); this.ValidatePollAndDebate(); if (base.IsErr()) { return; } if (ForumUtils.IsHidePost(this.postmessage)) { int arg_5B2_0 = this.usergroupinfo.AllowHideCode ? 1 : 0; } var topicInfo = this.CreateTopic(adminGroupInfo, this.postmessage, isbonus, topicprice); if (base.IsErr()) { return; } //var postInfo = this.CreatePost(topicInfo); var postInfo = Post.FindByID(topicInfo.LastPostID); //if (base.IsErr()) //{ // return; //} var stringBuilder = new StringBuilder(); //AttachmentInfo[] array = null; string formString = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(formString)) { var array = Attachments.GetNoUsedAttachmentArray(this.userid, formString); Attachments.UpdateAttachment(array, topicInfo.ID, postInfo.ID, postInfo, ref stringBuilder, this.userid, this.config, this.usergroupinfo); } Online.UpdateAction(this.olid, UserAction.PostTopic, this.forumid, this.forum.Name, -1, ""); if (this.isbindconnect && this.feedstatus) { // 推送到QQ空间和微博 //PushFeed pushFeed = new PushFeed(); //pushFeed.TopicPushFeed(topicInfo, postInfo, array, this.feedstatus); } if (stringBuilder.Length > 0) { base.SetUrl(base.ShowTopicAspxRewrite(topicInfo.ID, 0)); base.SetMetaRefresh(5); base.SetShowBackLink(true); if (this.infloat == 1) { base.AddErrLine(stringBuilder.ToString()); return; } stringBuilder.Insert(0, "<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表主题成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr>"); base.AddMsgLine(stringBuilder.Append("</table>").ToString()); } else { base.SetShowBackLink(false); if (this.useradminid != 1 && (UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo) || topicInfo.DisplayOrder == -2)) { ForumUtils.WriteCookie("postmessage", ""); this.SetLastPostedForumCookie(); base.SetUrl(base.ShowForumAspxRewrite(this.forumid, this.forumpageid)); base.SetMetaRefresh(); base.AddMsgLine("发表主题成功, 但需要经过审核才可以显示. 返回该版块"); } else { this.PostTopicSucceed(this.forum, topicInfo); } } if (this.needlogin && this.userid > 0) { this.needlogin = false; return; } } else { base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css"); } }
public void LoadCurrentForumInfo(int fid) { if (fid <= 0) { return; } this.forumInfo = Forums.GetForumInfo(fid); if (this.forumInfo == null) { return; } if (this.forumInfo.Layer > 0) { this.tabPage2.Visible = true; this.tabPage6.Visible = true; } else { this.TabControl1.Items.Remove(this.tabPage2); this.tabPage2.Visible = false; this.TabControl1.Items.Remove(this.tabPage5); this.tabPage5.Visible = false; this.TabControl1.Items.Remove(this.tabPage6); this.tabPage6.Visible = false; } this.forumname.Text = this.forumInfo.Name.Trim(); this.name.Text = this.forumInfo.Name.Trim(); this.displayorder.Text = this.forumInfo.DisplayOrder.ToString(); this.status.SelectedValue = this.forumInfo.Status.ToString(); if (this.forumInfo.ColCount == 1) { this.showcolnum.Attributes.Add("style", "display:none"); this.colcount.SelectedIndex = 0; } else { this.showcolnum.Attributes.Add("style", "display:block"); this.colcount.SelectedIndex = 1; } this.colcount.Attributes.Add("onclick", "javascript:document.getElementById('" + this.showcolnum.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage1_colcount_0').checked ? 'none' : 'block');"); this.colcountnumber.Text = this.forumInfo.ColCount.ToString(); this.templateid.SelectedValue = ((this.forumInfo.TemplateID == 0 && this.config.Templateid == 1) ? "1" : this.forumInfo.TemplateID.ToString()); this.forumsstatic.Text = string.Format("主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}", new object[] { this.forumInfo.Topics.ToString(), this.forumInfo.Posts.ToString(), this.forumInfo.TodayPosts.ToString(), this.forumInfo.LastPost.ToString() }); this.ViewState["forumsstatic"] = this.forumsstatic.Text; if (this.forumInfo.AllowSmilies) { this.setting.Items[0].Selected = true; } if (this.forumInfo.AllowRss) { this.setting.Items[1].Selected = true; } if (this.forumInfo.AllowBbCode) { this.setting.Items[2].Selected = true; } if (this.forumInfo.AllowImgCode) { this.setting.Items[3].Selected = true; } if (this.forumInfo.Recyclebin == 1) { this.setting.Items[4].Selected = true; } if (this.forumInfo.Modnewposts == 1) { this.setting.Items[5].Selected = true; } if (this.forumInfo.Modnewtopics == 1) { this.setting.Items[6].Selected = true; } if (this.forumInfo.Jammer == 1) { this.setting.Items[7].Selected = true; } if (this.forumInfo.DisableWatermark) { this.setting.Items[8].Selected = true; } if (this.forumInfo.Inheritedmod == 1) { this.setting.Items[9].Selected = true; } if (this.forumInfo.AllowThumbnail) { this.setting.Items[10].Selected = true; } if (this.forumInfo.AllowTag) { this.setting.Items[11].Selected = true; } if ((this.forumInfo.AllowPostSpecial & 1) != 0) { this.setting.Items[12].Selected = true; } if ((this.forumInfo.AllowPostSpecial & 16) != 0) { this.setting.Items[13].Selected = true; } if ((this.forumInfo.AllowPostSpecial & 4) != 0) { this.setting.Items[14].Selected = true; } if (this.forumInfo.AllowEditRules) { this.setting.Items[15].Selected = true; } this.allowspecialonly.SelectedValue = this.forumInfo.AllowSpecialOnly.ToString(); if (this.forumInfo.AutoClose == 0) { this.showclose.Attributes.Add("style", "display:none"); this.autocloseoption.SelectedIndex = 0; } else { this.autocloseoption.SelectedIndex = 1; } this.autocloseoption.Attributes.Add("onclick", "javascript:document.getElementById('" + this.showclose.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage2_autocloseoption_0').checked ? 'none' : 'block');"); this.autocloseday.Text = this.forumInfo.AutoClose.ToString(); this.description.Text = this.forumInfo.Description; this.password.Text = this.forumInfo.Password; this.icon.Text = this.forumInfo.Icon; this.redirect.Text = this.forumInfo.Redirect; this.moderators.Text = this.forumInfo.Moderators; this.inheritmoderators.Text = Users.GetModerators(fid); this.rules.Text = this.forumInfo.Rules; this.seokeywords.Text = this.forumInfo.Seokeywords + ""; this.seodescription.Text = this.forumInfo.Seodescription + ""; this.rewritename.Text = this.forumInfo.RewriteName + ""; this.oldrewritename.Value = this.rewritename.Text; this.topictypes.Text = this.forumInfo.TopicTypes; //DataTable dataTable = UserGroups.GetUserGroupForDataTable(); int num = 1; foreach (var ug in UserGroup.GetAll()) { HtmlTableRow htmlTableRow = new HtmlTableRow(); HtmlTableCell htmlTableCell = new HtmlTableCell("td"); htmlTableCell.Controls.Add(new LiteralControl("<input type='checkbox' id='r" + num + "' onclick='selectRow(" + num + ",this.checked)'>")); htmlTableRow.Cells.Add(htmlTableCell); htmlTableCell = new HtmlTableCell("td"); htmlTableCell.Controls.Add(new LiteralControl("<label for='r" + num + "'>" + ug.GroupTitle + "</lable>")); htmlTableRow.Cells.Add(htmlTableCell); htmlTableRow.Cells.Add(this.GetTD("viewperm", this.forumInfo.ViewPerm, ug.ID, num)); if (this.forumInfo.Layer > 0) { htmlTableRow.Cells.Add(this.GetTD("postperm", this.forumInfo.PostPerm, ug.ID, num)); htmlTableRow.Cells.Add(this.GetTD("replyperm", this.forumInfo.ReplyPerm, ug.ID, num)); htmlTableRow.Cells.Add(this.GetTD("getattachperm", this.forumInfo.GetattachPerm, ug.ID, num)); htmlTableRow.Cells.Add(this.GetTD("postattachperm", this.forumInfo.PostattachPerm, ug.ID, num)); } this.powerset.Rows.Add(htmlTableRow); num++; } if (this.forumInfo.Layer == 0) { HtmlTableRow htmlTableRow2 = this.powerset.Rows[0]; htmlTableRow2.Cells[3].Visible = false; htmlTableRow2.Cells[4].Visible = false; htmlTableRow2.Cells[5].Visible = false; htmlTableRow2.Cells[6].Visible = false; } //var dataTable = Attachments.GetAttachmentType(); this.attachextensions.SetSelectByID(this.forumInfo.Attachextensions); if (fid > 0) { this.forumInfo = Forums.GetForumInfo(fid); this.applytopictype.SelectedValue = this.forumInfo.ApplytopicType.ToString(); this.postbytopictype.SelectedValue = this.forumInfo.PostbytopicType.ToString(); this.viewbytopictype.SelectedValue = this.forumInfo.ViewbytopicType.ToString(); this.topictypeprefix.SelectedValue = this.forumInfo.Topictypeprefix.ToString(); return; } }
private void RunForumStatic_Click(object sender, EventArgs e) { if (base.CheckCookie()) { this.forumsstatic.Text = this.ViewState["forumsstatic"].ToString(); int fid = DNTRequest.GetInt("fid", -1); if (fid <= 0) { return; } var f = XForum.FindByID(fid); // 克隆一份,后面要比对 this.forumInfo = f.CloneEntity(); //int num = 0; //int num2 = 0; //int num3 = 0; //string text = ""; //DateTime lastpost = DateTime.MinValue; //int num4 = 0; //string text3 = ""; //int num5 = 0; //AdminForumStats.ReSetFourmTopicAPost(fid, out num, out num2, out num3, out text, out lastpost, out num4, out text3, out num5); // 重置最后发帖信息 f.ResetLastPost(); this.runforumsstatic = string.Format("<br /><br />运行结果<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}", new object[] { f.Topics, f.Posts, f.TodayPosts, f.LastPost.ToFullString() }); if (this.forumInfo.Topics == f.Topics && this.forumInfo.Posts == f.Posts && this.forumInfo.TodayPosts == f.TodayPosts && this.forumInfo.LastPost == f.LastPost) { this.runforumsstatic += "<br /><br /><br />结果一致"; } else { this.runforumsstatic += "<br /><br /><br />比较<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />"; if (this.forumInfo.Topics != f.Topics) { this.runforumsstatic += "主题总数有差异<br />"; } if (this.forumInfo.Posts != f.Posts) { this.runforumsstatic += "帖子总数有差异<br />"; } if (this.forumInfo.TodayPosts != f.TodayPosts) { this.runforumsstatic += "今日回帖数总数有差异<br />"; } if (this.forumInfo.LastPost != f.LastPost) { this.runforumsstatic += "最后提交日期有差异<br />"; } } } this.TabControl1.SelectedIndex = 5; this.DataGridBind(""); this.BindTopicType(); }
protected override void ShowPage() { if (userid > 0) { userinfo = BBX.Entity.User.FindByID(this.userid); } var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); if (adminGroupInfo != null) { disablepost = adminGroupInfo.DisablePostctrl; } if (!UserAuthority.CheckPostTimeSpan(this.usergroupinfo, adminGroupInfo, this.oluserinfo, this.userinfo, ref this.msg)) { if (this.continuereply != "") { base.AddErrLine("<b>回帖成功</b><br />由于" + this.msg + "后刷新继续"); return; } base.AddErrLine(this.msg); return; } else { var postInfo = this.GetPostAndTopic(adminGroupInfo); if (base.IsErr()) { return; } this.forum = Forums.GetForumInfo(this.forumid); this.smileyoff = this.forum.AllowSmilies ? 0 : 1; this.bbcodeoff = ((this.forum.AllowBbCode && this.usergroupinfo.AllowCusbbCode) ? 0 : 1); //this.allowimg = this.forum.AllowImgCode ? 1 : 0; this.needaudit = UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo, this.topic); if (this.needaudit && this.topic.DisplayOrder == -2) { base.AddErrLine("主题尚未通过审核, 不能执行回复操作"); return; } //string allowAttachmentType = Attachments.GetAllowAttachmentType(this.usergroupinfo, this.forum); this.attachextensions = AttachType.GetAttachmentTypeArray(usergroupinfo, this.forum); this.attachextensionsnosize = AttachType.GetAttachmentTypeString(usergroupinfo, this.forum); int num = (this.userid > 0) ? Attachment.GetUploadFileSizeByuserid(this.userid) : 0; this.attachsize = this.usergroupinfo.MaxSizeperday - num; this.canpostattach = UserAuthority.PostAttachAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg); if (!this.forum.Password.IsNullOrEmpty() && Utils.MD5(this.forum.Password) != ForumUtils.GetCookie("forum" + this.forumid + "password")) { base.AddErrLine("本版块被管理员设置了密码"); base.SetBackLink(base.ShowForumAspxRewrite(this.forumid, 0)); return; } if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg)) { base.AddErrLine(this.msg); this.needlogin = true; return; } if (!UserAuthority.PostReply(forum, this.userid, this.usergroupinfo, this.topic)) { base.AddErrLine((this.topic.Closed == 1) ? "主题已关闭无法回复" : "您没有发表回复的权限"); this.needlogin = (this.topic.Closed != 1); return; } if (!UserAuthority.CheckPostTimeSpan(this.usergroupinfo, adminGroupInfo, this.oluserinfo, this.userinfo, ref this.msg)) { base.AddErrLine(this.msg); return; } if (adminGroupInfo != null) { this.disablepost = adminGroupInfo.DisablePostctrl; } if (this.forum.TemplateID > 0) { this.templatepath = Template.FindByID(this.forum.TemplateID).Directory; } base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css"); this.customeditbuttons = Caches.GetCustomEditButtonList(); if (this.ispost) { string text = (DNTRequest.GetInt("topicid", -1) > 0) ? string.Format("postreply.aspx?topicid={0}&restore=1&forumpage=" + this.forumpageid, this.topicid) : string.Format("postreply.aspx?postid={0}&restore=1&forumpage=" + this.forumpageid, this.postid); if (!String.IsNullOrEmpty(DNTRequest.GetString("quote"))) { text = string.Format("{0}"e={1}", text, DNTRequest.GetString("quote")); } base.SetBackLink(text); this.NormalValidate(adminGroupInfo, this.postmessage, this.userinfo); if (base.IsErr()) { return; } this.canpostattach = UserAuthority.PostAttachAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg); if (!string.IsNullOrEmpty(DNTRequest.GetFormString("toreplay_user").Trim())) { this.postmessage = DNTRequest.GetFormString("toreplay_user").Trim() + "\n\n" + this.postmessage; } postInfo = this.CreatePostInfo(this.postmessage); int replyuserid = (this.postid > 0) ? Post.FindByID(this.postid).PosterID : postInfo.PosterID; this.postid = postInfo.ID; if (base.IsErr()) { return; } if (postInfo.ID > 0 && DNTRequest.GetString("postreplynotice") == "on") { Notice.SendPostReplyNotice(postInfo, this.topic, replyuserid); } Sync.Reply(this.postid.ToString(), this.topic.ID.ToString(), this.topic.Title, postInfo.Poster, postInfo.PosterID.ToString(), this.topic.Fid.ToString(), ""); StringBuilder stringBuilder = new StringBuilder(); //AttachmentInfo[] array = null; string formString = DNTRequest.GetFormString("attachid"); if (!string.IsNullOrEmpty(formString)) { var array = Attachments.GetNoUsedAttachmentArray(this.userid, formString); Attachments.UpdateAttachment(array, this.topic.ID, postInfo.ID, postInfo, ref stringBuilder, this.userid, this.config, this.usergroupinfo); } Online.UpdateAction(this.olid, UserAction.PostReply, this.forumid, this.forum.Name, this.topicid, this.topictitle); if (this.topic.Special == 4) { base.SetUrl(Urls.ShowDebateAspxRewrite(this.topicid)); } else { if (this.infloat == 0) { base.SetUrl(string.Format("showtopic.aspx?forumpage={0}&topicid={1}&page=end&jump=pid#{2}", this.forumpageid, this.topicid, this.postid)); } } if (DNTRequest.GetFormString("continuereply") == "on") { base.SetUrl("postreply.aspx?topicid=" + this.topicid + "&forumpage=" + this.forumpageid + "&continuereply=yes"); } if (stringBuilder.Length > 0) { this.UpdateUserCredits(); base.SetMetaRefresh(5); base.SetShowBackLink(true); if (this.infloat == 1) { base.AddErrLine(stringBuilder.ToString()); return; } base.AddMsgLine("<table cellspacing=\"0\" cellpadding=\"4\" border=\"0\"><tr><td colspan=2 align=\"left\"><span class=\"bold\"><nobr>发表回复成功,但图片/附件上传出现问题:</nobr></span><br /></td></tr></table>"); } else { base.SetMetaRefresh(); base.SetShowBackLink(false); if (postInfo.Invisible == 1) { base.AddMsgLine(string.Format("发表回复成功, 但需要经过审核才可以显示. {0}<br /><br />(<a href=\"" + base.ShowForumAspxRewrite(this.forumid, 0) + "\">点击这里返回 {1}</a>)", (DNTRequest.GetFormString("continuereply") == "on") ? "继续回复" : "返回该主题", this.forum.Name)); } else { this.UpdateUserCredits(); base.MsgForward("postreply_succeed"); base.AddMsgLine(string.Format("发表回复成功, {0}<br />(<a href=\"" + base.ShowForumAspxRewrite(this.forumid, 0) + "\">点击这里返回 {1}</a>)<br />", (DNTRequest.GetFormString("continuereply") == "on") ? "继续回复" : "返回该主题", this.forum.Name)); } } if (this.topic.Replies < this.config.Ppp + 10) { ForumUtils.DeleteTopicCacheFile(this.topicid); } if (DNTRequest.GetString("emailnotify") == "on" && this.topic.PosterID != -1 && this.topic.PosterID != this.userid) { this.SendNotifyEmail(BBX.Entity.User.FindByID(this.topic.PosterID).Email.Trim(), postInfo, Utils.GetRootUrl(BaseConfigs.GetForumPath) + string.Format("showtopic.aspx?topicid={0}&page=end&jump=pid#{1}", this.topicid, this.postid)); } } return; } }
protected override void ShowPage() { if (this.postid == -1) { base.AddErrLine("无效的帖子ID"); return; } this.post = Post.FindByID(this.postid); if (this.post == null) { base.AddErrLine("不存在的帖子ID"); return; } this.topic = Topic.FindByID(this.topicid); if (this.topic == null) { base.AddErrLine("不存在的主题ID"); return; } if (this.topicid != this.post.Tid) { base.AddErrLine("主题ID无效"); return; } this.topictitle = this.topic.Title; this.forumid = this.topic.Fid; this.forum = Forums.GetForumInfo(this.forumid); this.forumname = this.forum.Name; this.pagetitle = string.Format("删除{0}", this.post.Title); this.forumnav = base.ShowForumAspxRewrite(this.forum.Pathlist.Trim(), this.forumid, this.forumpageid); if (!this.CheckPermission(this.post, DNTRequest.GetInt("opinion", -1))) { return; } if (!this.allowDelPost) { base.AddErrLine("当前不允许删帖"); return; } if (this.post.Layer == 0) { TopicAdmins.DeleteTopics(this.topicid.ToString(), forum.Recyclebin, false); XForum.SetRealCurrentTopics(this.forum.Fid); Tag.DeleteTopicTags(this.topicid); } else { if (this.topic.Special == 4) { if (DNTRequest.GetInt("opinion", -1) != 1 && DNTRequest.GetInt("opinion", -1) != 2) { base.AddErrLine("参数错误"); return; } Posts.DeletePost(post, false, true); Debate.DeleteDebatePost(this.topicid, DNTRequest.GetInt("opinion", -1), this.postid); } else { Posts.DeletePost(post, false, true); } ForumUtils.DeleteTopicCacheFile(this.topicid); Topics.UpdateTopicReplyCount(this.topic.ID); //Forums.UpdateLastPost(this.forum); (forum as XForum).ResetLastPost(); } base.SetUrl((this.post.Layer == 0) ? base.ShowForumAspxRewrite(this.post.Fid, 0) : Urls.ShowTopicAspxRewrite(this.post.Tid, 1)); base.SetMetaRefresh(); base.SetShowBackLink(false); base.AddMsgLine("删除帖子成功, 返回主题"); }
private void Default() { this.lastmember = Statistic.Current.LastUserName; foreach (var item in mainstats) { statvars[item.Key] = item.Value; } CheckLastUpdate("main"); this.forums = XForum.GetForumCount(); var st = Statistic.Current; this.topics = st.TotalTopic; this.posts = st.TotalPost; this.members = st.TotalUsers; if (this.statvars.ContainsKey("runtime")) { this.runtime = this.statvars["runtime"].ToInt(0); } else { this.runtime = (DateTime.Now - Convert.ToDateTime(this.monthpostsstats["starttime"])).Days; StatVar.Update("main", "runtime", this.runtime); } if (this.statvars.ContainsKey("postsaddtoday")) { this.postsaddtoday = this.statvars["postsaddtoday"]; } else { this.postsaddtoday = Post.GetTodayPostCount(0).ToString(); StatVar.Update("main", "postsaddtoday", this.postsaddtoday); } if (this.statvars.ContainsKey("membersaddtoday")) { this.membersaddtoday = this.statvars["membersaddtoday"]; } else { this.membersaddtoday = BBX.Entity.User.GetTodayNewMemberCount().ToString(); StatVar.Update("main", "membersaddtoday", this.membersaddtoday); } if (this.statvars.ContainsKey("admins")) { this.admins = this.statvars["admins"]; } else { this.admins = BBX.Entity.User.GetAdminCount().ToString(); StatVar.Update("main", "admins", this.admins); } if (this.statvars.ContainsKey("memnonpost")) { this.memnonpost = this.statvars["memnonpost"].ToInt(0); } else { this.memnonpost = BBX.Entity.User.GetNonPostMemCount(); StatVar.Update("main", "memnonpost", this.memnonpost); } if (this.statvars.ContainsKey("hotforum")) { this.hotforum = XForum.FindByID(this.statvars["hotforum"].ToInt()); } else { this.hotforum = Stats.GetHotForum(); StatVar.Update("main", "hotforum", this.hotforum.ID + ""); } if (this.statvars.ContainsKey("bestmem") && this.statvars.ContainsKey("bestmemposts")) { this.bestmem = this.statvars["bestmem"]; this.bestmemposts = this.statvars["bestmemposts"].ToInt(0); } else { Post.GetBestMember(out this.bestmem, out this.bestmemposts); StatVar.Update("main", "bestmem", this.bestmem); StatVar.Update("main", "bestmemposts", this.bestmemposts); } this.mempost = this.members - this.memnonpost; this.mempostavg = Math.Round((double)this.posts / (double)this.members, 2); this.topicreplyavg = Math.Round((double)(this.posts - this.topics) / (double)this.topics, 2); this.mempostpercent = Math.Round((double)(this.mempost * 100) / (double)this.members, 2); this.postsaddavg = Math.Round((double)this.posts / (double)this.runtime, 2); this.membersaddavg = (double)(this.members / this.runtime); int num = totalstats["members"].ToInt() + totalstats["guests"].ToInt(); this.totalstats["visitors"] = num; this.pageviewavg = Math.Round((double)totalstats["hits"].ToInt() / (double)((num == 0) ? 1 : num), 2); this.activeindex = ((Math.Round(this.membersaddavg / (double)((this.members == 0) ? 1 : this.members), 2) + Math.Round(this.postsaddavg / (double)((this.posts == 0) ? 1 : this.posts), 2)) * 1500.0 + this.topicreplyavg * 10.0 + this.mempostavg + Math.Round(this.mempostpercent / 10.0, 2) + this.pageviewavg).ToString(); if (this.statstatus) { this.monthofstatsbar = Stats.GetStatsDataHtml("month", this.monthstats, this.maxmonth); } else { this.monthpostsofstatsbar = Stats.GetStatsDataHtml("monthposts", this.monthpostsstats, this.maxmonthposts); this.daypostsofstatsbar = Stats.GetStatsDataHtml("dayposts", this.daypostsstats, this.maxdayposts); } this.lastupdate = this.statvars["lastupdate"]; this.nextupdate = Utility.ToDateTime(this.statvars["lastupdate"]).AddMinutes((double)this.statscachelife).ToString("yyyy-MM-dd HH:mm:ss"); }
public static void PostTopic(int userId, IXForum forumInfo) { PostTopic(userId, forumInfo, false); }
//public IDataReader GetAllForumStatistics() //{ // //string commandText = string.Format("SELECT SUM([topics]) AS [topiccount],SUM([posts]) AS [postcount], // //SUM([todayposts])-( // // SELECT SUM([todayposts]) FROM [{0}forums] // // WHERE [lastpost] < CONVERT(CHAR(12),GETDATE(),101) AND [layer]=1 // //) AS [todaypostcount] // //FROM [{0}forums] WHERE [layer]=1", TablePrefix); // //return DbHelper.ExecuteReader(CommandType.Text, commandText); //} //public IXForum GetForumStatistics(int fid = 0) //{ // //string commandText = string.Format("SELECT SUM([topics]) AS [topiccount],SUM([posts]) AS [postcount], // //SUM([todayposts])-( // // SELECT SUM([todayposts]) FROM [{0}forums] // // WHERE [lastpost] < CONVERT(CHAR(12),GETDATE(),101) AND [layer]=1 AND [fid] = @fid // //) AS [todaypostcount] // //FROM [{0}forums] WHERE [fid] = {1} AND [layer]=1", TablePrefix, fid); // //return DbHelper.ExecuteReader(CommandType.Text, commandText); // var exp = _.Layer == 1; // if (fid > 0) exp &= _.ID == fid; // var list = FindAll(exp, null, _.Topics.Sum() & _.Posts.Sum() & _.TodayPosts.Sum(), 0, 0); // var e = list[0]; // exp &= _.LastPost < DateTime.Now.Date; // list = FindAll(exp, null, _.Topics.Sum() & _.Posts.Sum() & _.TodayPosts.Sum(), 0, 0); // e.TodayPosts -= list[0].TodayPosts; // return e; //} ///// <summary>获取排序的论坛列表</summary> ///// <returns></returns> //public static EntityList<XForum> GetShortForums() //{ // var list = FindAllWithCache(); // list = new EntityList<XForum>(list); // list.Sort(__.ID, true); // return list; //} /// <summary>批量设置论坛</summary> /// <param name="forumInfo"></param> /// <param name="bsp"></param> /// <param name="fidList"></param> /// <returns></returns> public static Boolean BatchSet(IXForum forumInfo, BatchSetParams bsp, string fidList) { throw new NotImplementedException("未实现批量设置论坛"); //var sb = new StringBuilder(); //var sb2 = new StringBuilder(); //sb.AppendFormat("UPDATE [{0}forums] SET ", TablePrefix); //if (bsp.SetSetting) //{ // sb.AppendFormat("[Allowsmilies]='{0}' ,", forumInfo.AllowSmilies); // sb.AppendFormat("[Allowrss]='{0}' ,", forumInfo.AllowRss); // sb.AppendFormat("[Allowhtml]='{0}' ,", forumInfo.AllowHtml); // sb.AppendFormat("[Allowbbcode]='{0}' ,", forumInfo.AllowBbCode); // sb.AppendFormat("[Allowimgcode]='{0}' ,", forumInfo.AllowImgCode); // sb.AppendFormat("[Allowblog]='{0}' ,", forumInfo.AllowBlog); // sb.AppendFormat("[istrade]='{0}' ,", forumInfo.IsTrade); // sb.AppendFormat("[allowpostspecial]='{0}' ,", forumInfo.AllowPostSpecial); // sb.AppendFormat("[allowspecialonly]='{0}' ,", forumInfo.AllowSpecialOnly); // sb.AppendFormat("[Alloweditrules]='{0}' ,", forumInfo.AllowEditRules); // sb.AppendFormat("[allowthumbnail]='{0}' ,", forumInfo.AllowThumbnail); // sb.AppendFormat("[Recyclebin]='{0}' ,", forumInfo.Recyclebin); // sb.AppendFormat("[Modnewposts]='{0}' ,", forumInfo.Modnewposts); // sb.AppendFormat("[Modnewtopics]='{0}' ,", forumInfo.Modnewtopics); // sb.AppendFormat("[Jammer]='{0}' ,", forumInfo.Jammer); // sb.AppendFormat("[Disablewatermark]='{0}' ,", forumInfo.DisableWatermark); // sb.AppendFormat("[Inheritedmod]='{0}' ,", forumInfo.Inheritedmod); // sb.AppendFormat("[allowtag]='{0}' ,", forumInfo.AllowTag); //} //if (sb.ToString().EndsWith(",")) //{ // sb.Remove(sb.Length - 1, 1); //} //sb.AppendFormat("WHERE [fid] IN ({0})", fidList); var list = FindAll(_.ID.In(fidList.SplitAsInt()), null, null, 0, 0); //sb2.AppendFormat("UPDATE [{0}forumfields] SET ", TablePrefix); //if (bsp.SetPassWord) //{ // sb2.AppendFormat("[password]='{0}' ,", forumInfo.Password); //} //if (bsp.SetAttachExtensions) //{ // sb2.AppendFormat("[attachextensions]='{0}' ,", forumInfo.Attachextensions); //} //if (bsp.SetPostCredits) //{ // sb2.AppendFormat("[postcredits]='{0}' ,", forumInfo.PostcrEdits); //} //if (bsp.SetReplyCredits) //{ // sb2.AppendFormat("[replycredits]='{0}' ,", forumInfo.ReplycrEdits); //} //if (bsp.SetViewperm) //{ // sb2.AppendFormat("[Viewperm]='{0}' ,", forumInfo.ViewPerm); //} //if (bsp.SetPostperm) //{ // sb2.AppendFormat("[PostPerm]='{0}' ,", forumInfo.PostPerm); //} //if (bsp.SetReplyperm) //{ // sb2.AppendFormat("[Replyperm]='{0}' ,", forumInfo.ReplyPerm); //} //if (bsp.SetGetattachperm) //{ // sb2.AppendFormat("[Getattachperm]='{0}' ,", forumInfo.GetattachPerm); //} //if (bsp.SetPostattachperm) //{ // sb2.AppendFormat("[Postattachperm]='{0}' ,", forumInfo.PostattachPerm); //} //if (sb2.ToString().EndsWith(",")) //{ // sb2.Remove(sb2.Length - 1, 1); //} //sb2.AppendFormat("WHERE [fid] IN ({0})", fidList); //if (sb.ToString().IndexOf("SET WHERE") < 0) //{ // DbHelper.ExecuteNonQuery(CommandType.Text, sb.ToString()); //} //if (sb2.ToString().IndexOf("SET WHERE") < 0) //{ // DbHelper.ExecuteNonQuery(CommandType.Text, sb2.ToString()); //} return(true); }