protected override void ShowPage() { this.pagetitle = "用户控制面板"; if (!base.IsLogin()) { return; } 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(); if (!base.IsErr() && this.useradminid > 0) { this.admingroupinfo = AdminGroup.FindByID(this.usergroupid); } //var stringBuilder = new StringBuilder(); //if (!this.usergroupinfo.AttachExtensions.IsNullOrEmpty()) //{ // stringBuilder.AppendFormat("[id] in ({0})", this.usergroupinfo.AttachExtensions); //} //this.usergroupattachtype = Attachments.GetAttachmentTypeString(stringBuilder.ToString()); this.usergroupattachtype = AttachType.GetAttachmentTypeString(usergroupinfo, null); this.newnoticecount = Notice.GetNewNoticeCountByUid(this.userid); }
private void radminid_SelectedIndexChanged(object sender, EventArgs e) { var userGroupInfo = UserGroup.FindByID(int.Parse(this.radminid.SelectedValue)); if (userGroupInfo != null) { this.creditshigher.Text = userGroupInfo.Creditslower.ToString(); this.creditslower.Text = userGroupInfo.Creditslower.ToString(); this.stars.Text = userGroupInfo.Stars.ToString(); this.color.Text = userGroupInfo.Color; this.groupavatar.Text = userGroupInfo.Groupavatar; this.readaccess.Text = userGroupInfo.Readaccess.ToString(); this.maxprice.Text = userGroupInfo.MaxPrice.ToString(); this.maxpmnum.Text = userGroupInfo.MaxPmNum.ToString(); this.maxsigsize.Text = userGroupInfo.MaxSigSize.ToString(); this.maxattachsize.Text = userGroupInfo.MaxAttachSize.ToString(); this.maxsizeperday.Text = userGroupInfo.MaxSizeperday.ToString(); DataTable attachmentType = Attachments.GetAttachmentType(); this.attachextensions.AddTableData(attachmentType, userGroupInfo.AttachExtensions); } var adminGroupInfo = AdminGroup.FindByID(int.Parse(this.radminid.SelectedValue)); if (adminGroupInfo != null) { admingroupright.SelectedIndex = -1; admingroupright.Items[0].Selected = adminGroupInfo.AllowEditPost; admingroupright.Items[1].Selected = adminGroupInfo.AllowEditpoll; admingroupright.Items[2].Selected = adminGroupInfo.AllowDelPost; admingroupright.Items[3].Selected = adminGroupInfo.AllowMassprune; admingroupright.Items[4].Selected = adminGroupInfo.AllowViewIP; admingroupright.Items[5].Selected = adminGroupInfo.AllowEditUser; admingroupright.Items[6].Selected = adminGroupInfo.AllowViewLog; admingroupright.Items[7].Selected = adminGroupInfo.DisablePostctrl; } }
public static string GetPostMessage(UserGroup usergroupinfo, AdminGroup adminGroupInfo, string postmessage, bool ishtmlon) { string result; if (adminGroupInfo != null && adminGroupInfo.ID == 1) { if (!usergroupinfo.AllowHtml) { result = Utils.HtmlEncode(postmessage); } else { result = (ishtmlon ? postmessage : Utils.HtmlEncode(postmessage)); } } else { if (!usergroupinfo.AllowHtml) { result = Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage)); } else { result = (ishtmlon ? ForumUtils.BanWordFilter(postmessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(postmessage))); } } 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 void LoadUserGroupInf(int groupid) { this.userGroupInfo = UserGroup.FindByID(groupid); this.groupTitle.Text = Utils.RemoveFontTag(this.userGroupInfo.GroupTitle); this.creditshigher.Text = this.userGroupInfo.Creditshigher.ToString(); this.creditslower.Text = this.userGroupInfo.Creditslower.ToString(); this.stars.Text = this.userGroupInfo.Stars.ToString(); this.color.Text = this.userGroupInfo.Color; this.groupavatar.Text = this.userGroupInfo.Groupavatar; this.readaccess.Text = this.userGroupInfo.Readaccess.ToString(); this.maxprice.Text = this.userGroupInfo.MaxPrice.ToString(); this.maxpmnum.Text = this.userGroupInfo.MaxPmNum.ToString(); this.maxsigsize.Text = this.userGroupInfo.MaxSigSize.ToString(); this.maxattachsize.Text = this.userGroupInfo.MaxAttachSize.ToString(); this.maxsizeperday.Text = this.userGroupInfo.MaxSizeperday.ToString(); this.maxspaceattachsize.Text = this.userGroupInfo.MaxSpaceattachSize.ToString(); this.maxspacephotosize.Text = this.userGroupInfo.MaxSpacephotoSize.ToString(); if (groupid > 0 && groupid <= 3) { this.radminid.Enabled = false; } this.radminid.SelectedValue = this.userGroupInfo.RadminID.ToString(); this.attachextensions.SetSelectByID(this.userGroupInfo.AttachExtensions.Trim()); //this.adminGroupInfo = AdminUserGroups.AdminGetAdminGroupInfo(this.userGroupInfo.ID); adminGroupInfo = AdminGroup.FindByID(userGroupInfo.ID); this.usergrouppowersetting.Bind(this.userGroupInfo); if (this.adminGroupInfo != null) { admingroupright.SelectedIndex = -1; admingroupright.Items[0].Selected = adminGroupInfo.AllowEditPost; admingroupright.Items[1].Selected = adminGroupInfo.AllowEditpoll; admingroupright.Items[2].Selected = adminGroupInfo.AllowDelPost; admingroupright.Items[3].Selected = adminGroupInfo.AllowMassprune; admingroupright.Items[4].Selected = adminGroupInfo.AllowViewIP; admingroupright.Items[5].Selected = adminGroupInfo.AllowEditUser; admingroupright.Items[6].Selected = adminGroupInfo.AllowViewLog; admingroupright.Items[7].Selected = adminGroupInfo.DisablePostctrl; admingroupright.Items[8].Selected = adminGroupInfo.AllowViewrealName; admingroupright.Items[9].Selected = adminGroupInfo.AllowBanUser; admingroupright.Items[10].Selected = adminGroupInfo.AllowBanIP; admingroupright.Items[11].Selected = adminGroupInfo.AllowModPost; admingroupright.Items[12].Selected = adminGroupInfo.AllowPostannounce; var config = GeneralConfigInfo.Current; this.admingroupright.Items[13].Selected = (("," + config.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1); this.admingroupright.Items[this.admingroupright.Items.Count - 1].Selected = (("," + config.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1); if (this.adminGroupInfo.AllowStickthread.ToString() != "") { this.allowstickthread.SelectedValue = this.adminGroupInfo.AllowStickthread.ToString(); } } if (this.radminid.SelectedValue == "1") { this.allowstickthread.Enabled = false; this.allowstickthread.SelectedValue = "3"; } }
public async Task <bool> Put(AdminGroup model) { var result = false; if (ModelState.IsValid) { result = await _adminGroupBusiness.Update(model); } return(result); }
//private void UpdateTopicInfo(string postmessage) //{ // int num = (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode) ? 1 : 0; // if (num == 1 && this.topic.Hide != 1) // { // this.topic.Hide = num; // Topics.UpdateTopicHide(this.topicid); // } // if (Moderators.IsModer(this.useradminid, this.userid, this.topic.Fid) && this.topic.Attention == 1) // { // Topic.UpdateTopicAttentionByTidList(0, topicid); // } // else // { // if (this.topic.PosterID != -1 && this.userid == this.topic.PosterID) // { // Topic.UpdateTopicAttentionByTidList(1, topicid); // } // } // Topics.UpdateTopicReplyCount(this.topicid); //} private void NormalValidate(AdminGroup admininfo, string postmessage, IUser user) { if (ForumUtils.IsCrossSitePost()) { base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (this.posttitle.Length > 60) { base.AddErrLine("标题最大长度为60个字符,当前为 " + this.posttitle.Length + " 个字符"); } if (Utils.StrIsNullOrEmpty(postmessage.Replace("\u3000", ""))) { base.AddErrLine("内容不能为空"); } if (admininfo != null && !admininfo.DisablePostctrl) { if (postmessage.Length < this.config.Minpostsize) { base.AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize + " 字多于 " + this.config.Maxpostsize + " 字"); } else { if (postmessage.Length > this.config.Maxpostsize) { base.AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize + " 字多于 " + this.config.Maxpostsize + " 字"); } } } if (this.topic.Special == 4 && DNTRequest.GetInt("debateopinion", 0) == 0) { base.AddErrLine("请选择您在辩论中的观点"); } if (this.topic.Special == 4) { var debateTopic = Debate.FindByTid(this.topic.ID); if (debateTopic.Terminaled) { base.AddErrLine("此辩论主题已经到期"); } } if (this.config.DisablePostAD && this.useradminid < 1 && ((this.config.DisablePostADPostCount != 0 && user.Posts <= this.config.DisablePostADPostCount) || (this.config.DisablePostADRegMinute != 0 && DateTime.Now.AddMinutes((double)(-(double)this.config.DisablePostADRegMinute)) <= user.JoinDate.ToDateTime()))) { string[] array = this.config.DisablePostADRegular.Replace("\r", "").Split('\n'); for (int i = 0; i < array.Length; i++) { string regular = array[i]; if (Posts.IsAD(regular, this.posttitle, postmessage)) { base.AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系"); } } } }
public void IsModer() { if (useradminid != 0) { ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0; admininfo = AdminGroup.FindByID(usergroupid); if (admininfo != null) { disablepostctrl = admininfo.DisablePostctrl; } } }
public async Task <int> Post(AdminGroup model) { var result = 0; if (ModelState.IsValid) { model.Status = 1; var modelInsert = await _adminGroupBusiness.Add(model); result = modelInsert.Id; } return(result); }
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(); }
public void SetGroupRights(string groupid) { var userGroupInfo = UserGroup.FindByID(groupid.ToInt()); this.creditshigher.Text = userGroupInfo.Creditshigher.ToString(); this.creditslower.Text = userGroupInfo.Creditslower.ToString(); this.stars.Text = userGroupInfo.Stars.ToString(); this.color.Text = userGroupInfo.Color; this.groupavatar.Text = userGroupInfo.Groupavatar; this.readaccess.Text = userGroupInfo.Readaccess.ToString(); this.maxprice.Text = userGroupInfo.MaxPrice.ToString(); this.maxpmnum.Text = userGroupInfo.MaxPmNum.ToString(); this.maxsigsize.Text = userGroupInfo.MaxSigSize.ToString(); this.maxattachsize.Text = userGroupInfo.MaxAttachSize.ToString(); this.maxsizeperday.Text = userGroupInfo.MaxSizeperday.ToString(); this.radminid.SelectedValue = userGroupInfo.RadminID.ToString(); var attachmentType = AttachType.FindAllWithCache().ToDataTable(false); this.attachextensions.AddTableData(attachmentType, userGroupInfo.AttachExtensions); this.usergrouppowersetting.Bind(userGroupInfo); var adminGroupInfo = AdminGroup.FindByID(groupid.ToInt()); if (adminGroupInfo != null) { this.admingroupright.Items[0].Selected = adminGroupInfo.AllowEditPost; this.admingroupright.Items[1].Selected = adminGroupInfo.AllowEditpoll; this.admingroupright.Items[2].Selected = adminGroupInfo.AllowDelPost; this.admingroupright.Items[3].Selected = adminGroupInfo.AllowMassprune; this.admingroupright.Items[4].Selected = adminGroupInfo.AllowViewIP; this.admingroupright.Items[5].Selected = adminGroupInfo.AllowEditUser; this.admingroupright.Items[6].Selected = adminGroupInfo.AllowViewLog; this.admingroupright.Items[7].Selected = adminGroupInfo.DisablePostctrl; this.admingroupright.Items[8].Selected = adminGroupInfo.AllowViewrealName; this.admingroupright.Items[9].Selected = adminGroupInfo.AllowBanUser; this.admingroupright.Items[10].Selected = adminGroupInfo.AllowBanIP; this.admingroupright.Items[11].Selected = adminGroupInfo.AllowModPost; this.admingroupright.Items[12].Selected = adminGroupInfo.AllowPostannounce; var config = GeneralConfigInfo.Current; this.admingroupright.Items[13].Selected = (("," + config.Reportusergroup + ",").IndexOf("," + groupid + ",") != -1); this.admingroupright.Items[14].Selected = (("," + config.Photomangegroups + ",").IndexOf("," + groupid + ",") != -1); } if (this.radminid.SelectedValue == "1") { this.allowstickthread.Enabled = false; this.allowstickthread.SelectedValue = "3"; return; } this.allowstickthread.Enabled = true; }
private void radminid_SelectedIndexChanged(object sender, EventArgs e) { UserGroup userGroupInfo = UserGroup.FindByID(int.Parse(this.radminid.SelectedValue)); if (userGroupInfo != null) { this.creditshigher.Text = userGroupInfo.Creditslower.ToString(); this.creditslower.Text = userGroupInfo.Creditslower.ToString(); this.stars.Text = userGroupInfo.Stars.ToString(); this.color.Text = userGroupInfo.Color; this.groupavatar.Text = userGroupInfo.Groupavatar; this.readaccess.Text = userGroupInfo.Readaccess.ToString(); this.maxprice.Text = userGroupInfo.MaxPrice.ToString(); this.maxpmnum.Text = userGroupInfo.MaxPmNum.ToString(); this.maxsigsize.Text = userGroupInfo.MaxSigSize.ToString(); this.maxattachsize.Text = userGroupInfo.MaxAttachSize.ToString(); this.maxsizeperday.Text = userGroupInfo.MaxSizeperday.ToString(); DataTable attachmentType = AttachType.FindAllWithCache().ToDataTable(false); this.attachextensions.AddTableData(attachmentType, userGroupInfo.AttachExtensions); } AdminGroup adminGroupInfo = AdminGroup.FindByID(int.Parse(this.radminid.SelectedValue)); if (adminGroupInfo != null) { admingroupright.SelectedIndex = -1; admingroupright.Items[0].Selected = adminGroupInfo.AllowEditPost; admingroupright.Items[1].Selected = adminGroupInfo.AllowEditpoll; admingroupright.Items[2].Selected = adminGroupInfo.AllowDelPost; admingroupright.Items[3].Selected = adminGroupInfo.AllowMassprune; admingroupright.Items[4].Selected = adminGroupInfo.AllowViewIP; admingroupright.Items[5].Selected = adminGroupInfo.AllowEditUser; admingroupright.Items[6].Selected = adminGroupInfo.AllowViewLog; admingroupright.Items[7].Selected = adminGroupInfo.DisablePostctrl; admingroupright.Items[8].Selected = adminGroupInfo.AllowViewrealName; } if (this.radminid.SelectedValue == "1") { this.allowstickthread.Enabled = false; this.allowstickthread.SelectedValue = "3"; return; } this.allowstickthread.Enabled = true; }
private bool CheckPermission() { var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); if (adminGroupInfo == null || !adminGroupInfo.DisablePostctrl) { var ts = DateTime.Now - this.lastpostpmtime.AddSeconds(config.Postinterval * 2); if (ts.TotalSeconds < 0) { base.AddErrLine(string.Format("系统规定发帖或发短消息间隔为{0}秒, 您还需要等待 {1} 秒", this.config.Postinterval * 2, ts.TotalSeconds * -1)); return(false); } } if (!CreditsFacade.IsEnoughCreditsPM(this.userid)) { base.AddErrLine("您的积分不足, 不能发送短消息"); return(false); } return(true); }
public static bool CheckPostTimeSpan(UserGroup userGroupInfo, AdminGroup admininfo, Online olUserInfo, IUser user, ref string msg) { var cfg = GeneralConfigInfo.Current; if (olUserInfo.AdminID != 1 && !userGroupInfo.DisablePeriodctrl) { var str = ""; if (Scoresets.BetweenTime(cfg.Postbanperiods, out str)) { msg = "在此时间段( " + str + " )内用户不可以发帖"; return(false); } } if (admininfo == null || !admininfo.DisablePostctrl) { var ts = olUserInfo.LastPostTime.AddSeconds(cfg.Postinterval) - DateTime.Now; if (ts.TotalSeconds > 0) { msg = "系统规定发帖间隔为" + cfg.Postinterval + "秒, 您还需要等待 " + ts.TotalSeconds + " 秒"; return(false); } if (olUserInfo.UserID != -1) { if (user == null) { msg = "您的用户资料出现错误"; return(false); } //num = Utils.StrDateDiffMinutes(text, cfg.Newbiespan); ts = user.JoinDate.AddMinutes(cfg.Newbiespan) - DateTime.Now; if (ts.TotalMinutes > 0) { msg = "系统规定新注册用户必须要在" + cfg.Newbiespan + "分钟后才可以发帖, 您还需要等待 " + ts.TotalMinutes + " 分钟"; return(false); } } } return(true); }
private void ComAdminUsergroup_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (this.sourceadminusergroup.SelectedIndex == 0 || this.targetadminusergroup.SelectedIndex == 0) { base.RegisterStartupScript("", "<script>alert('操作失败,请您选择有效的管理组!');</script>"); return; } if (Convert.ToInt32(this.sourceadminusergroup.SelectedValue) <= 3 || Convert.ToInt32(this.sourceadminusergroup.SelectedValue) <= 3) { base.RegisterStartupScript("", "<script>alert('操作失败,您选择的组为系统初始化的管理组,这些组不允许合并!');</script>"); return; } if (this.sourceadminusergroup.SelectedValue == this.targetadminusergroup.SelectedValue) { base.RegisterStartupScript("", "<script>alert('操作失败,同一个管理组不能够合并!');</script>"); return; } //AdminGroups.DeleteAdminGroupInfo(Convert.ToInt16(this.sourceadminusergroup.SelectedValue)); var adg = AdminGroup.FindByID(Convert.ToInt32(sourceadminusergroup.SelectedValue)); if (adg != null) { adg.Delete(); } //UserGroups.DeleteUserGroupInfo(int.Parse(this.sourceadminusergroup.SelectedValue)); var ug = UserGroup.FindByID(adg.AdmingID); if (ug != null) { ug.Delete(); } UserGroups.ChangeAllUserGroupId(int.Parse(this.sourceusergroup.SelectedValue), int.Parse(this.targetadminusergroup.SelectedValue)); DNTCache.Current.RemoveObject(CacheKeys.FORUM_USER_GROUP_LIST); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并管理组", "把组ID:" + this.sourceusergroup.SelectedIndex + " 合并到组ID:" + this.targetusergroup.SelectedIndex); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); } }
/// <summary> /// 更新单条数据 /// </summary> /// <param name="obj"></param> /// <returns></returns> public int Update(AdminGroup obj) { return(dal.Update(obj)); }
private void NormalValidate(AdminGroup admininfo, string postmessage, IUser user) { if (ForumUtils.IsCrossSitePost()) { base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } if (this.forum.ApplytopicType == 1 && this.forum.PostbytopicType == 1 && !this.topictypeselectoptions.IsNullOrEmpty()) { var typeid = Request["typeid"].ToInt(); if (typeid == 0) { base.AddErrLine("主题类型不能为空"); } if (!Forums.IsCurrentForumTopicType(typeid, this.forum.Topictypes)) { base.AddErrLine("错误的主题类型"); } } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString(this.config.Antispamposttitle).Trim().Replace("\u3000", ""))) { base.AddErrLine("标题不能为空"); } else { if (DNTRequest.GetString(this.config.Antispamposttitle).Length > 60) { base.AddErrLine("标题最大长度为60个字符,当前为 " + DNTRequest.GetString(this.config.Antispamposttitle).Length + " 个字符"); } } if (Utils.StrIsNullOrEmpty(postmessage.Replace("\u3000", ""))) { base.AddErrLine("内容不能为空"); } if (admininfo != null && !admininfo.DisablePostctrl) { if (postmessage.Length < this.config.Minpostsize) { base.AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize + " 字多于 " + this.config.Maxpostsize + " 字"); } else { if (postmessage.Length > this.config.Maxpostsize) { base.AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize + " 字多于 " + this.config.Maxpostsize + " 字"); } } } if (this.config.DisablePostAD && this.useradminid < 1 && ((this.config.DisablePostADPostCount != 0 && user.Posts <= this.config.DisablePostADPostCount) || (this.config.DisablePostADRegMinute != 0 && DateTime.Now.AddMinutes((double)(-(double)this.config.DisablePostADRegMinute)) <= user.JoinDate.ToDateTime()))) { string[] array = this.config.DisablePostADRegular.Replace("\r", "").Split('\n'); for (int i = 0; i < array.Length; i++) { string regular = array[i]; if (Posts.IsAD(regular, DNTRequest.GetString(this.config.Antispamposttitle), postmessage)) { base.AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系"); } } } }
public Topic CreateTopic(AdminGroup admininfo, string postmessage, bool isbonus, int topicprice) { var tp = new Topic(); tp.Fid = this.forumid; var iconid = DNTRequest.GetInt("iconid", 0); if (iconid < 0 || iconid > 15) { iconid = 0; } tp.IconID = iconid; this.message = Posts.GetPostMessage(this.usergroupinfo, admininfo, postmessage, DNTRequest.GetInt("htmlon") == 1); tp.Title = ((this.useradminid == 1) ? Utils.HtmlEncode(this.posttitle) : Utils.HtmlEncode(ForumUtils.BanWordFilter(this.posttitle))); if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.posttitle) || ForumUtils.HasBannedWord(postmessage))) { string arg = (ForumUtils.GetBannedWord(this.posttitle) == string.Empty) ? ForumUtils.GetBannedWord(postmessage) : ForumUtils.GetBannedWord(this.posttitle); base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 请返回修改!", arg)); return(tp); } if (Utils.GetCookie("lasttopictitle") == Utils.MD5(tp.Title) || Utils.GetCookie("lasttopicmessage") == Utils.MD5(this.message)) { base.AddErrLine("请勿重复发帖"); return(tp); } tp.TypeID = DNTRequest.GetInt("typeid", 0); if (this.usergroupinfo.AllowSetreadPerm) { tp.ReadPerm = ((DNTRequest.GetInt("topicreadperm", 0) > 255) ? 255 : DNTRequest.GetInt("topicreadperm", 0)); } tp.Price = topicprice; //tp.Poster = this.username; //tp.Posterid = this.userid; //tp.Postdatetime = this.curdatetime; //tp.Lastpost = this.curdatetime; //tp.Lastposter = this.username; tp.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, tp, this.message, this.disablepost); string text = DNTRequest.GetString("htmltitle").Trim(); if (!text.IsNullOrEmpty() && Utils.HtmlDecode(text).Trim() != tp.Title) { tp.Magic = 11000; } string text2 = DNTRequest.GetString("tags").Trim(); string[] array = null; if (this.enabletag && !text2.IsNullOrEmpty()) { if (ForumUtils.InBanWordArray(text2)) { base.AddErrLine("标签中含有系统禁止词语,请修改"); return(tp); } array = Utils.SplitString(text2, " ", true, 2, 10); if (array.Length <= 0 || array.Length > 5) { base.AddErrLine("超过标签数的最大限制或单个标签长度没有介于2-10之间,最多可填写 5 个标签"); return(tp); } if (tp.Magic == 0) { tp.Magic = 10000; } tp.Magic = (tp.Magic + "1").ToInt(); } if (isbonus) { tp.Special = 2; if (this.mybonustranscredits < (float)topicprice && !usergroupinfo.Is管理员) { base.AddErrLine(string.Format("无法进行悬赏<br /><br />您当前的{0}为 {1} {3}<br/>悬赏需要{0} {2} {3}", new object[] { this.bonusextcreditsinfo.Name, this.mybonustranscredits, topicprice, this.bonusextcreditsinfo.Unit })); return(tp); } BBX.Entity.User.UpdateUserExtCredits(userid, Scoresets.GetBonusCreditsTrans(), (float)(-(float)topicprice) * (Scoresets.GetCreditsTax() + 1f)); } if (this.type == "poll") { tp.Special = 1; } if (this.type == "debate") { tp.Special = 4; } if (!Moderators.IsModer(this.useradminid, this.userid, this.forumid)) { tp.Attention = 1; } if (ForumUtils.IsHidePost(postmessage) && this.usergroupinfo.AllowHideCode) { tp.Hide = 1; } //tp.Tid = Topics.CreateTopic(tp); //tp.Insert(); var postInfo = this.CreatePost(tp); tp.Create(postInfo); if (this.canhtmltitle && !text.IsNullOrEmpty() && text != tp.Title) { Topics.WriteHtmlTitleFile(Utils.RemoveUnsafeHtml(text), tp.ID); } if (this.enabletag && array != null && array.Length > 0) { if (this.useradminid != 1 && ForumUtils.HasBannedWord(text2)) { string bannedWord = ForumUtils.GetBannedWord(text2); base.AddErrLine(string.Format("标签中含有系统禁止词语 <font color=\"red\">{0}</font>,请修改", bannedWord)); return(tp); } Tag.CreateTopicTags(array, tp.ID, this.userid, DateTime.Now.ToFullString()); } if (this.type == "debate") { var db = new Debate(); db.Tid = tp.ID; db.PositiveOpinion = DNTRequest.GetString("positiveopinion"); db.NegativeOpinion = DNTRequest.GetString("negativeopinion"); db.TerminalTime = Request["terminaltime"].ToDateTime(); db.Insert(); //Topics.CreateDebateTopic(new DebateInfo //{ // Tid = tp.ID, // Positiveopinion = DNTRequest.GetString("positiveopinion"), // Negativeopinion = DNTRequest.GetString("negativeopinion"), // Terminaltime = Convert.ToDateTime(DNTRequest.GetString("terminaltime")) //}); } //Topics.AddParentForumTopics(this.forum.Parentidlist.Trim(), 1); //// 所有上级论坛帖子数增加 //var ff = forum; //while (ff != null && ff.ID != 0) //{ // ff.Topics++; // ff.Save(); // ff = ff.Parent; //} return(tp); }
private void UpdateUserGroupInf_Click(object sender, EventArgs e) { if (base.CheckCookie()) { foreach (DictionaryEntry dictionaryEntry in new Hashtable { { "附件最大尺寸", this.maxattachsize.Text }, { "每天最大附件总尺寸", this.maxsizeperday.Text }, { "个人空间附件总尺寸", this.maxspaceattachsize.Text }, { "相册空间总尺寸", this.maxspacephotosize.Text } }) { if (!Utils.IsInt(dictionaryEntry.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误," + dictionaryEntry.Key.ToString() + "只能是0或者正整数');window.location.href='global_editadminusergroup.aspx';</script>"); return; } } this.userGroupInfo = UserGroup.FindByID(DNTRequest.GetInt("groupid", -1)); this.userGroupInfo.System = 0; this.userGroupInfo.Type = 0; this.userGroupInfo.Readaccess = Convert.ToInt32(this.readaccess.Text); int num = Convert.ToInt32(this.radminid.SelectedValue); if (num > 0 && num <= 3) { adminGroupInfo = new AdminGroup(); adminGroupInfo.AdmingID = (short)this.userGroupInfo.ID; adminGroupInfo.AllowEditPost = admingroupright.Items[0].Selected; adminGroupInfo.AllowEditpoll = admingroupright.Items[1].Selected; adminGroupInfo.AllowStickthread = Convert.ToInt16(this.allowstickthread.SelectedValue) > 0; adminGroupInfo.AllowModPost = false; adminGroupInfo.AllowDelPost = admingroupright.Items[2].Selected; adminGroupInfo.AllowMassprune = admingroupright.Items[3].Selected; adminGroupInfo.AllowRefund = false; adminGroupInfo.AllowCensorword = false; adminGroupInfo.AllowViewIP = admingroupright.Items[4].Selected; adminGroupInfo.AllowBanIP = false; adminGroupInfo.AllowEditUser = admingroupright.Items[5].Selected; adminGroupInfo.AllowModUser = false; adminGroupInfo.AllowBanUser = false; adminGroupInfo.AllowPostannounce = false; adminGroupInfo.AllowViewLog = admingroupright.Items[6].Selected; adminGroupInfo.DisablePostctrl = admingroupright.Items[7].Selected; adminGroupInfo.AllowViewrealName = admingroupright.Items[8].Selected; adminGroupInfo.AllowBanUser = admingroupright.Items[9].Selected; adminGroupInfo.AllowBanIP = admingroupright.Items[10].Selected; adminGroupInfo.AllowModPost = admingroupright.Items[11].Selected; adminGroupInfo.AllowPostannounce = admingroupright.Items[12].Selected; //AdminGroups.SetAdminGroupInfo(this.adminGroupInfo, this.userGroupInfo.ID); adminGroupInfo.Save(); this.userGroupInfo.RadminID = num; } else { this.userGroupInfo.RadminID = 0; } //AdminGroups.ChangeUserAdminidByGroupid(this.userGroupInfo.RadminID, this.userGroupInfo.ID); AdminGroup.ChangeGroup(userGroupInfo.RadminID, userGroupInfo.ID); this.userGroupInfo.GroupTitle = this.groupTitle.Text; this.userGroupInfo.Creditshigher = Convert.ToInt32(this.creditshigher.Text); this.userGroupInfo.Creditslower = Convert.ToInt32(this.creditslower.Text); this.userGroupInfo.Stars = Convert.ToInt32(this.stars.Text); this.userGroupInfo.Color = this.color.Text; this.userGroupInfo.Groupavatar = this.groupavatar.Text; this.userGroupInfo.MaxPrice = Convert.ToInt32(this.maxprice.Text); this.userGroupInfo.MaxPmNum = Convert.ToInt32(this.maxpmnum.Text); this.userGroupInfo.MaxSigSize = Convert.ToInt32(this.maxsigsize.Text); this.userGroupInfo.MaxAttachSize = Convert.ToInt32(this.maxattachsize.Text); this.userGroupInfo.MaxSizeperday = Convert.ToInt32(this.maxsizeperday.Text); this.userGroupInfo.MaxSpaceattachSize = Convert.ToInt32(this.maxspaceattachsize.Text); this.userGroupInfo.MaxSpacephotoSize = Convert.ToInt32(this.maxspacephotosize.Text); this.userGroupInfo.AttachExtensions = this.attachextensions.GetSelectString(","); this.usergrouppowersetting.GetSetting(ref this.userGroupInfo); //if (AdminUserGroups.UpdateUserGroupInfo(this.userGroupInfo)) if (userGroupInfo.Save() > 0) { var config = GeneralConfigInfo.Current; int groupid = this.userGroupInfo.ID; if (this.admingroupright.Items[13].Selected) { if (("," + config.Reportusergroup + ",").IndexOf("," + groupid + ",") == -1) { if (config.Reportusergroup == "") { config.Reportusergroup = groupid.ToString(); } else { GeneralConfigInfo expr_636 = config; expr_636.Reportusergroup = expr_636.Reportusergroup + "," + groupid.ToString(); } } } else { string text = ""; string[] array = config.Reportusergroup.Split(','); for (int i = 0; i < array.Length; i++) { string text2 = array[i]; if (text2 != groupid.ToString()) { if (text == "") { text = text2; } else { text = text + "," + text2; } } } config.Reportusergroup = text; } if (AlbumPluginProvider.GetInstance() != null) { if (this.admingroupright.Items[this.admingroupright.Items.Count - 1].Selected) { if (("," + config.Photomangegroups + ",").IndexOf("," + groupid + ",") == -1) { if (config.Photomangegroups == "") { config.Photomangegroups = groupid.ToString(); } else { GeneralConfigInfo expr_75C = config; expr_75C.Photomangegroups = expr_75C.Photomangegroups + "," + groupid.ToString(); } } } else { string text3 = ""; string[] array2 = config.Photomangegroups.Split(','); for (int j = 0; j < array2.Length; j++) { string text4 = array2[j]; if (text4 != groupid.ToString()) { if (text3 == "") { text3 = text4; } else { text3 = text3 + "," + text4; } } } config.Photomangegroups = text3; } } config.Save(); //config.Save();; DNTCache.Current.RemoveObject(CacheKeys.FORUM_USER_GROUP_LIST); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新管理组", "组名:" + this.groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>"); } }
protected override void ShowPage() { if (this.postid == 0) { base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回."); return; } var postInfo = Post.FindByID(this.postid); if (postInfo == null) { base.AddErrLine("指定的主题不存在或已被删除或正在被审核,请返回."); return; } this.ip = postInfo.IP; this.iplocation = IPAddress.Parse(this.ip).GetAddress(); if (this.iplocation == null) { this.iplocation = "(IP数据库文件不存在,无法查询)"; } else { if (string.IsNullOrEmpty(this.iplocation)) { this.iplocation = "没有查询到该用户的地理所在地"; } } var topicInfo = Topic.FindByID(postInfo.Tid); if (topicInfo == null) { base.AddErrLine("不存在的主题ID"); return; } var forumInfo = Forums.GetForumInfo(postInfo.Fid); this.forumname = forumInfo.Name; this.pagetitle = topicInfo.Title; this.forumnav = ForumUtils.UpdatePathListExtname(forumInfo.Pathlist.Trim(), this.config.Extname); var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); if (adminGroupInfo == null || !adminGroupInfo.AllowViewIP) { base.AddErrLine("你没有查看IP的权限"); return; } if (DNTRequest.GetString("action") == "ipban") { if (!adminGroupInfo.AllowBanIP) { base.AddErrLine("你无权禁止用户IP,请返回"); return; } if (Utils.InIPArray(DNTRequest.GetString("ip"), Utils.SplitString(this.config.Ipdenyaccess, "\n"))) { //Users.UpdateUserGroup(postInfo.Posterid, 6); XUser user = XUser.FindByID(postInfo.PosterID); user.GroupID = 6; user.Save(); base.AddErrLine("IP已在列表中存在,无需重复添加"); return; } var cfg = GeneralConfigInfo.Current; cfg.Ipdenyaccess += "\n" + DNTRequest.GetString("ip"); cfg.Save(); //if (GeneralConfigs.SetIpDenyAccess(DNTRequest.GetString("ip"))) { //Users.UpdateUserGroup(postInfo.Posterid, 6); XUser user = XUser.FindByID(postInfo.PosterID); user.GroupID = 6; user.Save(); base.SetUrl(base.ShowTopicAspxRewrite(topicInfo.ID, 0)); base.SetMetaRefresh(); base.SetShowBackLink(false); base.MsgForward("getip_succeed"); base.AddMsgLine("IP已加入到用户禁止列表中"); this.ispost = true; return; } //base.AddErrLine("未知原因,IP无法加到禁止列表中"); } }
/// <summary> /// 删除单条数据 /// </summary> /// <param name="obj"></param> /// <returns></returns> public int Delete(AdminGroup obj) { return(dal.Delete(obj)); }
public Post GetPostAndTopic(AdminGroup admininfo) { var pi = new Post(); if (this.postid == -1 && this.topicid == -1) { base.AddErrLine("无效的主题ID"); return(pi); } if (this.postid != -1) { //pi = Posts.GetPostInfo(this.topicid, this.postid); pi = Post.FindByID(postid); if (pi == null) { base.AddErrLine("无效的帖子ID"); return(pi); } if (this.topicid != pi.Tid) { base.AddErrLine("主题ID无效"); return(pi); } if (!string.IsNullOrEmpty(DNTRequest.GetString("quote"))) { var msg = pi.Message; if (pi.Invisible != 0) { msg = "**** 作者被禁止或删除 内容自动屏蔽 ****"; } else { string str = (pi.PosterID > 0) ? BBX.Entity.User.FindByID(pi.PosterID).GroupID.ToString() : null; if (Utils.InArray(str, "4.5.6")) { msg = "**** 作者被禁止或删除 内容自动屏蔽 ****"; } } if (msg.IndexOf("[hide]") > -1 && msg.IndexOf("[/hide]") > -1) { this.message = string.Format("[quote] 原帖由 [b]{0}[/b] 于 {1} 发表\r\n ***隐藏帖*** [/quote]", pi.Poster, pi.PostDateTime.ToFullString()); } else { this.message = string.Format("[quote]{0}\r\n [color=#999999]{1} 发表于 {2} [/color][url={5}showtopic.aspx?topicid={3}&postid={4}#{4}][img]{5}images/common/back.gif[/img][/url][/size][/quote]", new object[] { UBB.ClearAttachUBB(Utils.GetSubString(Regex.Replace(msg, "\\[quote\\](.|\\n)+\\[/quote\\]", "", RegexOptions.Multiline), 200, "......")), pi.Poster, pi.PostDateTime, this.topicid, this.postid, Utils.GetRootUrl(this.forumpath) }); } pi.Html = msg; } } //this.topic = Topics.GetTopicInfo(this.topicid); this.topic = Topic.FindByID(this.topicid); if (this.topic == null) { base.AddErrLine("不存在的主题ID"); return(pi); } this.topictitle = this.topic.Title.Trim(); this.pagetitle = this.topictitle; this.forumid = this.topic.Fid; if ((admininfo == null || !Moderators.IsModer(admininfo.ID, this.userid, this.forumid)) && this.topic.Closed == 1) { base.AddErrLine("主题已关闭无法回复"); return(pi); } if (this.topic.ReadPerm > this.usergroupinfo.Readaccess && this.topic.PosterID != this.userid && this.useradminid != 1 && this.forum.Moderators != null && !Utils.InArray(this.username, this.forum.Moderators.Split(','))) { base.AddErrLine("本主题阅读权限为: " + this.topic.ReadPerm + ", 您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 阅读权限不够"); } return(pi); }
protected override void ShowPage() { this.pagetitle = "首页"; if (this.userid > 0 && this.useradminid > 0) { var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); if (adminGroupInfo != null) { this.disablepostctrl = adminGroupInfo.DisablePostctrl; } } int num = DNTRequest.GetInt("f", 1); if (num == 0) { ForumUtils.WriteCookie("isframe", "1"); } else { num = ForumUtils.GetCookie("isframe").ToInt(-1); if (num == -1) { num = this.config.Isframeshow; } } if (num == 2) { HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + "frame.aspx"); HttpContext.Current.Response.End(); return; } if (this.config.Rssstatus == 1) { base.AddLinkRss("tools/rss.aspx", "最新主题"); } Online.UpdateAction(this.olid, UserAction.IndexShow, 0, this.config.Onlinetimeout); if (this.userid != -1) { this.userinfo = BBX.Entity.User.FindByID(this.userid); if (this.userinfo == null) { this.userid = -1; ForumUtils.ClearUserCookie(); } else { //this.newpmcount = !userinfo.Newpm ? 0 : this.newpmcount; if (!userinfo.Newpm) { newpmcount = 0; } this.lastvisit = this.userinfo.LastVisit.ToString(); this.showpmhint = (this.userinfo.NewsLetter.ToInt() > 4); } } this.navhomemenu = Caches.GetForumListMenuDivCache(this.usergroupid, this.userid, this.config.Extname); this.forumlist = Forums.GetForumIndexCollection(this.config.Hideprivate, this.usergroupid, this.config.Moddisplay, out this.totaltopic, out this.totalpost, out this.todayposts); this.forumlinkcount = this.forumlinklist.Rows.Count; //if (this.config.Enablespace == 1) //{ // this.GetSpacePerm(); //} 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; this.showforumonline = false; this.onlineiconlist = OnlineList.GetOnlineGroupIconList(); if (this.totalonline < this.config.Maxonlinelist || DNTRequest.GetString("showonline") == "yes") { this.showforumonline = true; var list = Online.GetList(0, Online._.UserID, true); // 根据活跃时间降序 list.Sort(Online._.LastActivity, true); this.onlineuserlist = list; var st = Online.GetStat(); this.totalonline = st.Total; this.totalonlineuser = st.User; this.totalonlineinvisibleuser = st.Invisible; this.totalonlineguest = st.Guest; } if (DNTRequest.GetString("showonline") == "no") { this.showforumonline = false; } this.highestonlineusercount = Statistic.Current.HighestOnlineUserCount + ""; this.highestonlineusertime = Statistic.Current.HighestOnlineUserTime.ToString("yyyy-MM-dd HH:mm"); //this.announcementlist = Announcements.GetSimplifiedAnnouncementList(this.nowdatetime, "2999-01-01 00:00:00"); announcementlist = Announcement.GetAvailableList(); this.announcementcount = this.announcementlist != null ? this.announcementlist.Count : 0; var fs = new List <IXForum>(); foreach (var current in this.forumlist) { current.Description = UBB.ParseSimpleUBB(current.Description); if (current.Layer == 0) { fs.Add(current); } } this.taglist = config.Enabletag ? Tag.GetHotForumTags(config.Hottagcount).ToArray() : new Tag[0]; this.headerad = Advertisement.GetOneHeaderAd("indexad", 0); this.footerad = Advertisement.GetOneFooterAd("indexad", 0); this.inforumad = Advertisement.GetInForumAd("indexad", 0, fs, this.templatepath); this.pagewordad = Advertisement.GetPageWordAd("indexad", 0); this.doublead = Advertisement.GetDoubleAd("indexad", 0); this.floatad = Advertisement.GetFloatAd("indexad", 0); this.mediaad = Advertisement.GetMediaAd(this.templatepath, "indexad", 0); this.pagead = Advertisement.GetPageAd("indexad", 0); if (this.userid > 0 && this.oluserinfo.Newpms < 0) { Users.UpdateUserNewPMCount(this.userid, this.olid); } }
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"); } }
private void AddUserGroupInf_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (this.radminid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('操作失败,请您选择相应的管理组, 再点击提交按钮!');</script>"); return; } if (this.groupTitle.Text.Trim() == string.Empty) { base.RegisterStartupScript("", "<script>alert('用户组名称不能为空!');</script>"); return; } foreach (DictionaryEntry item in new Hashtable { { "附件最大尺寸", this.maxattachsize.Text }, { "每天最大附件总尺寸", this.maxsizeperday.Text }, { "个人空间附件总尺寸", this.maxspaceattachsize.Text }, { "相册空间总尺寸", this.maxspacephotosize.Text } }) { if (item.Value.ToInt(-1) < 0) { base.RegisterStartupScript("", "<script>alert('输入错误," + item.Key + "只能是0或者正整数');window.location.href='addadminusergroup.aspx';</script>"); return; } } var userGroupInfo = new UserGroup(); userGroupInfo.System = 0; userGroupInfo.Type = 0; userGroupInfo.Readaccess = String.IsNullOrEmpty(this.readaccess.Text) ? 0 : this.readaccess.Text.ToInt(); userGroupInfo.AllowDirectPost = true; //userGroupInfo.AllowMultigroups = 0; //userGroupInfo.AllowCstatus = 0; //userGroupInfo.AllowUsebLog = 0; //userGroupInfo.AllowInvisible = 0; //userGroupInfo.AllowTransfer = 0; //userGroupInfo.AllowHtml = 0; //userGroupInfo.AllowNickName = 0; //userGroupInfo.AllowViewstats = 0; userGroupInfo.GroupTitle = this.groupTitle.Text; userGroupInfo.Creditshigher = this.creditshigher.Text.ToInt(); userGroupInfo.Creditslower = this.creditslower.Text.ToInt(); userGroupInfo.Stars = this.stars.Text.ToInt(); userGroupInfo.Color = this.color.Text; userGroupInfo.Groupavatar = this.groupavatar.Text; userGroupInfo.MaxPrice = this.maxprice.Text.ToInt(); userGroupInfo.MaxPmNum = this.maxpmnum.Text.ToInt(); userGroupInfo.MaxSigSize = this.maxsigsize.Text.ToInt(); userGroupInfo.MaxAttachSize = this.maxattachsize.Text.ToInt(); userGroupInfo.MaxSizeperday = this.maxsizeperday.Text.ToInt(); userGroupInfo.MaxSpaceattachSize = this.maxspaceattachsize.Text.ToInt(); userGroupInfo.MaxSpacephotoSize = this.maxspacephotosize.Text.ToInt(); userGroupInfo.AttachExtensions = this.attachextensions.GetSelectString(","); userGroupInfo.Raterange = ""; userGroupInfo.RadminID = this.radminid.SelectedValue.ToInt(); this.usergrouppowersetting.GetSetting(ref userGroupInfo); //if (AdminUserGroups.AddUserGroupInfo(userGroupInfo)) if (userGroupInfo.InsertWithCredits() > 0) { var config = GeneralConfigInfo.Current; int maxUserGroupId = UserGroup.GetMaxUserGroupId(); if (this.admingroupright.Items[13].Selected && ("," + config.Reportusergroup + ",").IndexOf("," + maxUserGroupId + ",") == -1) { if (String.IsNullOrEmpty(config.Reportusergroup)) { config.Reportusergroup = maxUserGroupId.ToString(); } else { config.Reportusergroup += "," + maxUserGroupId.ToString(); } } if (this.admingroupright.Items[14].Selected && ("," + config.Photomangegroups + ",").IndexOf("," + maxUserGroupId + ",") == -1) { if (String.IsNullOrEmpty(config.Photomangegroups)) { config.Photomangegroups = maxUserGroupId.ToString(); } else { config.Photomangegroups += "," + maxUserGroupId.ToString(); } } //config.Save();; config.Save(); var adg = new AdminGroup { ID = UserGroup.GetMaxUserGroupId(), AllowEditPost = admingroupright.Items[0].Selected, AllowEditpoll = admingroupright.Items[1].Selected, AllowStickthread = this.allowstickthread.SelectedValue.ToInt(), //Allowmodpost = 0, AllowDelPost = admingroupright.Items[2].Selected, AllowMassprune = admingroupright.Items[3].Selected, AllowRefund = false, AllowCensorword = false, AllowViewIP = admingroupright.Items[4].Selected, //AllowBanIP = 0, AllowEditUser = admingroupright.Items[5].Selected, AllowModUser = false, //AllowBanUser = 0, //Allowpostannounce = 0, AllowViewLog = admingroupright.Items[6].Selected, DisablePostctrl = admingroupright.Items[7].Selected, AllowViewrealName = admingroupright.Items[8].Selected, AllowBanUser = admingroupright.Items[9].Selected, AllowBanIP = admingroupright.Items[10].Selected, AllowModPost = admingroupright.Items[11].Selected, AllowPostannounce = admingroupright.Items[12].Selected }; adg.Insert(); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加管理组", "组名:" + this.groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); return; } base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>"); } }
private void SetPostInfo(AdminGroup admininfo, IUser user, bool ishtmlon) { if (this.postinfo.Layer == 0 && this.forum.ApplytopicType == 1 && this.forum.PostbytopicType == 1 && this.topictypeselectoptions != string.Empty) { var typeid = Request["typeid"].ToInt(); if (typeid == 0) { base.AddErrLine("主题类型不能为空"); return; } if (!Forums.IsCurrentForumTopicType(typeid, this.forum.Topictypes)) { base.AddErrLine("错误的主题类型"); return; } } if (DNTRequest.GetInt("isdeleteatt", 0) == 1) { var id = WebHelper.RequestInt("aid"); var att = Attachment.FindByID(id); if (att != null) { att.Delete(); this.attachmentlist = Attachment.FindAllByPid(this.postinfo.ID); this.attachmentcount = attachmentlist.Count; } base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css"); this.message = this.postinfo.Message; this.ispost = false; return; } if (string.IsNullOrEmpty(this.postTitle.Trim().Replace("\u3000", "")) && this.postinfo.Layer == 0) { base.AddErrLine("标题不能为空"); } else { if (this.postTitle.Length > 60) { base.AddErrLine("标题最大长度为60个字符,当前为 " + this.postTitle.Length.ToString() + " 个字符"); } } if (String.IsNullOrEmpty(this.postMessage) || this.postMessage.Replace("\u3000", "").Equals("")) { base.AddErrLine("内容不能为空"); } if (admininfo != null && !disablepostctrl) { if (this.postMessage.Length < this.config.Minpostsize) { base.AddErrLine("您发表的内容过少, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize.ToString() + " 字多于 " + this.config.Maxpostsize.ToString() + " 字"); } else { if (this.postMessage.Length > this.config.Maxpostsize) { base.AddErrLine("您发表的内容过多, 系统设置要求帖子内容不得少于 " + this.config.Minpostsize.ToString() + " 字多于 " + this.config.Maxpostsize.ToString() + " 字"); } } } if (this.config.DisablePostAD && this.useradminid < 1 && ((this.config.DisablePostADPostCount != 0 && user.Posts <= this.config.DisablePostADPostCount) || (this.config.DisablePostADRegMinute != 0 && DateTime.Now.AddMinutes((double)(-(double)this.config.DisablePostADRegMinute)) <= user.JoinDate.ToDateTime()))) { string[] array = this.config.DisablePostADRegular.Replace("\r", "").Split('\n'); for (int i = 0; i < array.Length; i++) { string regular = array[i]; if (Posts.IsAD(regular, this.postTitle, this.postMessage)) { base.AddErrLine("发帖失败,内容中有不符合新用户强力广告屏蔽规则的字符,请检查标题和内容,如有疑问请与管理员联系"); return; } } } string[] array2 = Utils.SplitString(DNTRequest.GetString("PollItemname"), "\r\n"); int num = 0; string @string = DNTRequest.GetString("topicprice"); if (this.postinfo.Layer == 0) { if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatepoll")) && this.topic.Special == 1) { this.pollinfo.Multiple = DNTRequest.GetInt("multiple", 0); if (!this.usergroupinfo.AllowPostpoll) { base.AddErrLine("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有发布投票的权限"); return; } if (array2.Length < 2) { base.AddErrLine("投票项不得少于2个"); } else { if (array2.Length > this.config.Maxpolloptions) { base.AddErrLine("系统设置为投票项不得多于" + this.config.Maxpolloptions + "个"); } else { for (int j = 0; j < array2.Length; j++) { if (Utils.StrIsNullOrEmpty(array2[j])) { base.AddErrLine("投票项不能为空"); } } } } } if (Regex.IsMatch(@string, "^[0-9]*[0-9][0-9]*$") || @string == string.Empty) { num = ((@string.ToInt(0) > 32767) ? 32767 : @string.ToInt(0)); if (this.topic.Special != 2) { if (num > this.usergroupinfo.MaxPrice && this.usergroupinfo.MaxPrice > 0) { if (String.IsNullOrEmpty(this.userextcreditsinfo.Unit)) { base.AddErrLine(string.Format("主题售价不能高于 {0} {1}", this.usergroupinfo.MaxPrice, this.userextcreditsinfo.Name)); } else { base.AddErrLine(string.Format("主题售价不能高于 {0} {1}({2})", this.usergroupinfo.MaxPrice, this.userextcreditsinfo.Name, this.userextcreditsinfo.Unit)); } } else { if (num > 0 && this.usergroupinfo.MaxPrice <= 0) { base.AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许出售主题", this.usergroupinfo.GroupTitle)); } else { if (num < 0) { base.AddErrLine("主题售价不能为负数"); } } } } else { if (!usergroupinfo.Is管理员) { if (!this.usergroupinfo.AllowBonus) { base.AddErrLine(string.Format("您当前的身份 \"{0}\" 未被允许进行悬赏", this.usergroupinfo.GroupTitle)); } if (num < this.usergroupinfo.MinBonusprice || num > this.usergroupinfo.MaxBonusprice) { base.AddErrLine(string.Format("悬赏价格超出范围, 您应在 {0} - {1} {2}{3} 范围内进行悬赏", new object[] { this.usergroupinfo.MinBonusprice, this.usergroupinfo.MaxBonusprice, this.userextcreditsinfo.Unit, this.userextcreditsinfo.Name })); } } } } else { if (this.topic.Special != 2) { base.AddErrLine("主题售价只能为整数"); } else { base.AddErrLine("悬赏价格只能为整数"); } } if (!Utils.StrIsNullOrEmpty(DNTRequest.GetString("updatedebate")) && this.topic.Special == 4) { if (!this.usergroupinfo.AllowDebate) { base.AddErrLine("您当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有发布辩论的权限"); return; } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("positiveopinion"))) { base.AddErrLine("正方观点不能为空"); return; } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("negativeopinion"))) { base.AddErrLine("反方观点不能为空"); return; } if (Utils.StrIsNullOrEmpty(DNTRequest.GetString("terminaltime"))) { base.AddErrLine("辩论的结束日期不能为空"); return; } if (!Utils.IsDateString(DNTRequest.GetString("terminaltime"))) { base.AddErrLine("结束日期格式不正确"); return; } } } var msg = postinfo.Message; if (this.useradminid == 1) { this.postinfo.Title = Utils.HtmlEncode(this.postTitle); if (!this.usergroupinfo.AllowHtml) { msg = Utils.HtmlEncode(this.postMessage); } else { msg = (ishtmlon ? this.postMessage : Utils.HtmlEncode(this.postMessage)); } } else { this.postinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postTitle)); if (!this.usergroupinfo.AllowHtml) { msg = Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postMessage)); } else { msg = (ishtmlon ? ForumUtils.BanWordFilter(this.postMessage) : Utils.HtmlEncode(ForumUtils.BanWordFilter(this.postMessage))); } } //postinfo.Html = msg; postinfo.Message = msg; this.postinfo.Title = ((this.postinfo.Title.Length > 60) ? this.postinfo.Title.Substring(0, 60) : this.postinfo.Title); if (this.useradminid != 1 && (ForumUtils.HasBannedWord(this.postTitle) || ForumUtils.HasBannedWord(this.postMessage))) { string arg = (ForumUtils.GetBannedWord(this.postTitle) == string.Empty) ? ForumUtils.GetBannedWord(this.postMessage) : ForumUtils.GetBannedWord(this.postTitle); base.AddErrLine(string.Format("对不起, 您提交的内容包含不良信息 <font color=\"red\">{0}</font>, 请返回修改!", arg)); return; } this.topic.DisplayOrder = Topics.GetTitleDisplayOrder(this.usergroupinfo, this.useradminid, this.forum, this.topic, this.message, this.disablepostctrl); if (base.IsErr()) { return; } if (this.postinfo.PostDateTime.AddSeconds(60) < DateTime.Now && this.config.Editedby == 1 && this.useradminid != 1) { this.postinfo.LastEdit = this.username + " 最后编辑于 " + Utils.GetDateTime(); } this.postinfo.UseSig = DNTRequest.GetString("usesig").ToInt(0); this.postinfo.HtmlOn = ((this.usergroupinfo.AllowHtml && ishtmlon) ? 1 : 0); this.postinfo.SmileyOff = ((this.smileyoff == 0) ? DNTRequest.GetInt("smileyoff") : this.smileyoff); this.postinfo.BBCodeOff = ((this.usergroupinfo.AllowCusbbCode) ? DNTRequest.GetInt("bbcodeoff") : 1); this.postinfo.ParseUrlOff = DNTRequest.GetInt("parseurloff"); this.postinfo.Invisible = (this.needaudit ? 1 : 0); if (this.alloweditpost) { this.SetTopicInfo(array2, num, this.postMessage); } return; }
protected override void ShowPage() { var adminGroupInfo = AdminGroup.FindByID(this.usergroupid); this.disablepostctrl = false; if (adminGroupInfo != null) { this.disablepostctrl = adminGroupInfo.DisablePostctrl; } if (this.userid == -1) { this.forum = new XForum(); this.topic = new Topic(); this.postinfo = new Post(); base.AddErrLine("您尚未登录"); return; } if (this.postid == -1) { base.AddErrLine("无效的帖子ID"); return; } //this.postinfo = Posts.GetPostInfo(this.topicid, this.postid); postinfo = Post.FindByID(postid); if (this.postinfo == null) { base.AddErrLine("不存在的帖子ID"); return; } this.pagetitle = ((String.IsNullOrEmpty(this.postinfo.Title)) ? "编辑帖子" : this.postinfo.Title); this.htmlon = this.postinfo.HtmlOn; this.message = this.postinfo.Message; this.isfirstpost = (this.postinfo.Layer == 0); if (this.topicid != this.postinfo.Tid || this.postinfo.Tid == -1) { base.AddErrLine("无效的主题ID"); return; } //this.topic = Topics.GetTopicInfo(this.postinfo.Tid); topic = Topic.FindByID(postinfo.Tid); if (this.topic == null) { base.AddErrLine("不存在的主题ID"); return; } if (this.topic.Special == 1 && this.postinfo.Layer == 0) { //修改为Xcode方法 this.pollinfo = Poll.FindByTid(topic.ID); this.polloptionlist = PollOption.FindAllByTid(topic.ID); } if (this.topic.Special == 4 && this.postinfo.Layer == 0) { this.debateinfo = Debate.FindByTid(this.topic.ID); } this.forumid = this.topic.Fid; this.forum = Forums.GetForumInfo(this.forumid); this.needaudit = UserAuthority.NeedAudit(forum.Fid, forum.Modnewposts, this.useradminid, this.userid, this.usergroupinfo, this.topic); if (this.forum == null || this.forum.Layer == 0) { base.AddErrLine("版块已不存在"); this.forum = new XForum(); return; } 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 (this.forum.ApplytopicType == 1) { this.topictypeselectoptions = Forums.GetCurrentTopicTypesOption(this.forum.Fid, this.forum.Topictypes); } this.customeditbuttons = Caches.GetCustomEditButtonList(); if (!UserAuthority.CanEditPost(this.postinfo, this.userid, this.useradminid, ref this.msg)) { base.AddErrLine(this.msg); return; } //string allowAttachmentType = Attachments.GetAllowAttachmentType(this.usergroupinfo, this.forum); this.attachextensions = AttachType.GetAttachmentTypeArray(usergroupinfo, forum); this.attachextensionsnosize = AttachType.GetAttachmentTypeString(usergroupinfo, 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.userinfo = BBX.Entity.User.FindByID(this.userid); this.attachmentlist = Attachment.FindAllByPid(this.postinfo.ID); this.attachmentcount = this.attachmentlist.Count; this.allowviewattach = UserAuthority.DownloadAttachment(this.forum, this.userid, this.usergroupinfo); this.smileyoff = ((!DNTRequest.IsPost()) ? this.postinfo.SmileyOff : (forum.AllowSmilies ? 0 : 1)); //this.allowimg = this.forum.Allowimgcode; this.parseurloff = this.postinfo.ParseUrlOff; this.bbcodeoff = this.usergroupinfo.AllowCusbbCode ? this.postinfo.BBCodeOff : 1; this.usesig = this.postinfo.UseSig; this.userextcreditsinfo = Scoresets.GetScoreSet(Scoresets.GetTopicAttachCreditsTrans()); if (this.bonusCreditsTrans > 0 && this.bonusCreditsTrans < 9) { this.bonusextcreditsinfo = Scoresets.GetScoreSet(this.bonusCreditsTrans); this.mybonustranscredits = Users.GetUserExtCredits(this.userid, this.bonusCreditsTrans); } if (!UserAuthority.VisitAuthority(this.forum, this.usergroupinfo, this.userid, ref this.msg)) { base.AddErrLine(this.msg); return; } if (!Moderators.IsModer(this.useradminid, this.userid, this.forumid)) { if (this.postinfo.PosterID != this.userid) { base.AddErrLine("你并非作者, 且你当前的身份 \"" + this.usergroupinfo.GroupTitle + "\" 没有修改该帖的权限"); return; } if (this.config.Edittimelimit > 0 && this.postinfo.PostDateTime.AddMinutes(this.config.Edittimelimit) < DateTime.Now) { base.AddErrLine("抱歉, 系统规定只能在帖子发表" + this.config.Edittimelimit + "分钟内才可以修改"); return; } if (this.config.Edittimelimit == -1) { base.AddErrLine("抱歉,系统不允许修改帖子"); return; } this.alloweditpost = true; } else { if (adminGroupInfo != null && adminGroupInfo.AllowEditPost && Moderators.IsModer(this.useradminid, this.userid, this.forumid)) { this.alloweditpost = true; } } if (!this.alloweditpost && this.postinfo.PosterID != this.userid) { base.AddErrLine("您当前的身份没有编辑帖子的权限"); return; } if (this.postinfo.Layer == 0) { this.canhtmltitle = this.usergroupinfo.AllowHtmlTitle; } if (Topics.GetMagicValue(this.topic.Magic, MagicType.HtmlTitle) == 1) { this.htmltitle = Topics.GetHtmlTitle(this.topic.ID).Replace("\"", "\\\"").Replace("'", "\\'"); } this.enabletag = config.Enabletag && forum.AllowTag; if (this.enabletag && Topics.GetMagicValue(this.topic.Magic, MagicType.TopicTag) == 1) { foreach (var item in Tag.GetTagsListByTopic(this.topic.ID)) { if (item.OrderID > -1) { this.topictags += string.Format(" {0}", item.Name); } } this.topictags = this.topictags.Trim(); } this.userGroupInfoList.Sort((x, y) => x.Readaccess - y.Readaccess + (y.ID - x.ID)); if (this.ispost) { base.SetBackLink("editpost.aspx?topicid=" + this.postinfo.Tid + "&postid=" + this.postinfo.ID); if (ForumUtils.IsCrossSitePost()) { base.AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。"); return; } this.SetPostInfo(adminGroupInfo, this.userinfo, DNTRequest.GetString("htmlon").ToInt(0) == 1); if (base.IsErr()) { return; } //Posts.UpdatePost(this.postinfo); postinfo.Update(); var stringBuilder = this.SetAttachmentInfo(); if (base.IsErr()) { return; } CreditsFacade.UpdateUserCredits(this.userid); string url; if (this.topic.Special == 4) { url = Urls.ShowTopicAspxRewrite(this.topic.ID, this.pageid); } else { if (DNTRequest.GetQueryString("referer") != "") { url = string.Format("showtopic.aspx?page=end&forumpage={2}&topicid={0}#{1}", this.topic.ID, this.postinfo.ID, this.forumpageid); } else { if (this.pageid > 1) { if (this.config.Aspxrewrite == 1) { url = string.Format("showtopic-{0}-{2}{1}#{3}", new object[] { this.topic.ID, this.config.Extname, this.pageid, this.postinfo.ID }); } else { url = string.Format("showtopic.aspx?topicid={0}&forumpage={3}&page={2}#{1}", new object[] { this.topic.ID, this.postinfo.ID, this.pageid, this.forumpageid }); } } else { if (this.config.Aspxrewrite == 1) { url = string.Format("showtopic-{0}{1}", this.topic.ID, this.config.Extname); } else { url = string.Format("showtopic.aspx?topicid={0}&forumpage={1}", this.topic.ID, this.forumpageid); } } } } base.SetUrl(url); if (stringBuilder.Length > 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>"); stringBuilder.Append("</table>"); base.AddMsgLine(stringBuilder.ToString()); } else { if (this.postinfo.Layer == 0) { base.SetMetaRefresh(2, url); } else { base.SetMetaRefresh(); } base.SetShowBackLink(false); if (this.useradminid != 1 && (this.needaudit || this.topic.DisplayOrder == -2 || this.postinfo.Invisible == 1)) { if (this.postinfo.Layer == 0) { base.SetUrl(base.ShowForumAspxRewrite(this.forumid, this.forumpageid)); } else { base.SetUrl(base.ShowTopicAspxRewrite(this.topic.ID, this.forumpageid)); } base.AddMsgLine("编辑成功, 但需要经过审核才可以显示"); } else { base.MsgForward("editpost_succeed"); base.AddMsgLine("编辑帖子成功, 返回该主题"); } } if (this.postinfo.Layer == 0) { ForumUtils.DeleteTopicCacheFile(this.topic.ID); return; } } else { base.AddLinkCss(BaseConfigs.GetForumPath + "templates/" + this.templatepath + "/editor.css", "css"); } }
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() { this.pagetitle = "用户管理"; if (this.userid == -1) { base.AddErrLine("请先登录"); return; } if (ForumUtils.IsCrossSitePost() || this.action.IsNullOrEmpty()) { base.AddErrLine("非法提交"); return; } if (String.IsNullOrEmpty(this.action)) { base.AddErrLine("操作类型参数为空"); return; } this.admininfo = AdminGroup.FindByID(this.usergroupid); if (this.admininfo == null) { base.AddErrLine("你没有管理权限"); return; } if (this.operateduid == -1) { base.AddErrLine("没有选择要操作的用户"); return; } this.operateduser = BBX.Entity.User.FindByID(this.operateduid); if (this.operateduser == null) { base.AddErrLine("选择的用户不存在"); return; } if (this.operateduser.AdminID > 0) { base.AddErrLine("无法对拥有管理权限的用户进行操作, 请管理员登录后台进行操作"); return; } this.operatedusername = this.operateduser.Name; if (!this.ispost) { Utils.WriteCookie("reurl", DNTRequest.GetUrlReferrer()); if (this.action == "banuser") { this.operationtitle = "禁止用户"; switch (this.operateduser.GroupID) { case 4: this.bantype = 1; this.groupexpiry = "(" + Utils.FormatDate(this.operateduser.GroupExpiry) + ")"; break; case 5: this.bantype = 2; this.groupexpiry = "(" + Utils.FormatDate(this.operateduser.GroupExpiry) + ")"; break; case 6: this.bantype = 3; this.groupexpiry = "(" + Utils.FormatDate(this.operateduser.GroupExpiry) + ")"; break; default: this.bantype = 0; break; } if (!admininfo.AllowBanUser) { base.AddErrLine("您没有禁止用户的权限"); return; } } } else { if (this.action == "banuser") { this.operationtitle = "禁止用户"; this.DoBanUserOperation(); } } }
/// <summary> /// 添加单条数据 /// </summary> /// <param name="obj"></param> /// <returns></returns> public int Add(AdminGroup obj) { return(dal.Add(obj)); }