private void SubmitInfo_Click(object sender, EventArgs e) { #region 提交同级版块 if (this.CheckCookie()) { if (DNTRequest.GetString("fid") != "") { forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0)); forumInfo.Name = name.Text.Trim(); forumInfo.Displayorder = Convert.ToInt32(displayorder.Text); forumInfo.Status = Convert.ToInt16(status.SelectedValue); if (colcount.SelectedValue == "1") //传统模式[默认] { forumInfo.Colcount = 1; } else { if (Convert.ToInt16(colcountnumber.Text) < 1 || Convert.ToInt16(colcountnumber.Text) > 9) { colcountnumber.Text = ""; base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } forumInfo.Colcount = Convert.ToInt16(colcountnumber.Text); } if (rewritename.Text.Trim() != oldrewritename.Value && rewritename.Text.Trim() != "" && Discuz.Forum.Forums.CheckRewriteNameInvalid(rewritename.Text.Trim())) { rewritename.Text = ""; base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>"); return; } //forumInfo.Templateid为0表示绑定到默认模板 forumInfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue)); forumInfo.Allowhtml = 0; forumInfo.Allowblog = 0; forumInfo.Istrade = 0; forumInfo.Alloweditrules = 0; forumInfo.Allowsmilies = BoolToInt(setting.Items[0].Selected); forumInfo.Allowrss = BoolToInt(setting.Items[1].Selected); forumInfo.Allowbbcode = BoolToInt(setting.Items[2].Selected); forumInfo.Allowimgcode = BoolToInt(setting.Items[3].Selected); forumInfo.Recyclebin = BoolToInt(setting.Items[4].Selected); forumInfo.Modnewposts = BoolToInt(setting.Items[5].Selected); forumInfo.Modnewtopics = BoolToInt(setting.Items[6].Selected); forumInfo.Jammer = BoolToInt(setting.Items[7].Selected); forumInfo.Disablewatermark = BoolToInt(setting.Items[8].Selected); forumInfo.Inheritedmod = BoolToInt(setting.Items[9].Selected); forumInfo.Allowthumbnail = BoolToInt(setting.Items[10].Selected); forumInfo.Allowtag = BoolToInt(setting.Items[11].Selected); int temppostspecial = 0; temppostspecial = setting.Items[12].Selected ? temppostspecial | 1 : temppostspecial & ~1; temppostspecial = setting.Items[13].Selected ? temppostspecial | 16 : temppostspecial & ~16; temppostspecial = setting.Items[14].Selected ? temppostspecial | 4 : temppostspecial & ~4; forumInfo.Allowpostspecial = temppostspecial; forumInfo.Alloweditrules = BoolToInt(setting.Items[15].Selected); forumInfo.Allowspecialonly = Convert.ToInt16(allowspecialonly.SelectedValue); if (autocloseoption.SelectedValue == "0") { forumInfo.Autoclose = 0; } else { forumInfo.Autoclose = Convert.ToInt32(autocloseday.Text); } forumInfo.Description = description.Text; forumInfo.Password = password.Text; //如果有上传的图片被提交上来,则执行文件保存操作,并返回保存后的文件路径,否则将icon.text控件中的值保存 forumInfo.Icon = HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName) ? AdminForums.UploadForumIcon(forumInfo.Fid) : icon.Text; forumInfo.Redirect = redirect.Text; forumInfo.Attachextensions = attachextensions.GetSelectString(","); AdminForums.CompareOldAndNewModerator(forumInfo.Moderators, moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0)); forumInfo.Moderators = moderators.Text.Replace("\r\n", ","); forumInfo.Rules = rules.Text.Trim(); forumInfo.Seokeywords = seokeywords.Text.Trim(); forumInfo.Seodescription = seodescription.Text.Trim(); forumInfo.Rewritename = rewritename.Text.Trim(); forumInfo.Viewperm = Request.Form["viewperm"]; forumInfo.Postperm = Request.Form["postperm"]; forumInfo.Replyperm = Request.Form["replyperm"]; forumInfo.Getattachperm = Request.Form["getattachperm"]; forumInfo.Postattachperm = Request.Form["postattachperm"]; forumInfo.Applytopictype = Convert.ToInt32(applytopictype.SelectedValue); forumInfo.Postbytopictype = Convert.ToInt32(postbytopictype.SelectedValue); forumInfo.Viewbytopictype = Convert.ToInt32(viewbytopictype.SelectedValue); forumInfo.Topictypeprefix = Convert.ToInt32(topictypeprefix.SelectedValue); forumInfo.Topictypes = GetTopicType(); forumInfo.Permuserlist = GetPermuserlist(); Discuz.Aggregation.AggregationFacade.ForumAggregation.ClearDataBind(); string result = AdminForums.UpdateForumInfo(forumInfo).Replace("'", "’"); if (childForumApplyTemplate.Checked)//批量设置子版块的模板信息 { AdminForums.UpdateForumTemplateID(forumInfo); } ForumOperator.RefreshForumCache(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim()); GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Specifytemplate = Forums.GetSpecifyForumTemplateCount() > 0 ? 1 : 0; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); if (result == "") { Response.Redirect("forum_ForumsTree.aspx"); } else { Response.Write("<script>alert('用户:" + result + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); Response.End(); } } } #endregion }
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(); } }
private void SubmitInfo_Click(object sender, EventArgs e) { #region 提交同级版块 if (this.CheckCookie()) { if (DNTRequest.GetString("fid") != "") { __foruminfo = AdminForums.GetForumInfomation(DNTRequest.GetInt("fid", 0)); __foruminfo.Name = name.Text.Trim(); __foruminfo.Displayorder = Convert.ToInt32(displayorder.Text); __foruminfo.Status = Convert.ToInt16(status.SelectedValue); if (colcount.SelectedValue == "1") //传统模式[默认] { __foruminfo.Colcount = 1; } else { if (Convert.ToInt16(colcountnumber.Text) < 1 || Convert.ToInt16(colcountnumber.Text) > 9) { base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } __foruminfo.Colcount = Convert.ToInt16(colcountnumber.Text); } __foruminfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue)); __foruminfo.Allowhtml = 0; __foruminfo.Allowblog = 0; //__foruminfo.Istrade = 0; //__foruminfo.Allowpostspecial = 0; //需要作与运算如下 //__foruminfo.Allowspecialonly = 0; //需要作与运算如下 ////$allow辩论 = allowpostspecial & 16; ////$allow悬赏 = allowpostspecial & 4; ////$allow投票 = allowpostspecial & 1; __foruminfo.Alloweditrules = 0; __foruminfo.Allowsmilies = BoolToInt(setting.Items[0].Selected); __foruminfo.Allowrss = BoolToInt(setting.Items[1].Selected); __foruminfo.Allowbbcode = BoolToInt(setting.Items[2].Selected); __foruminfo.Allowimgcode = BoolToInt(setting.Items[3].Selected); __foruminfo.Recyclebin = BoolToInt(setting.Items[4].Selected); __foruminfo.Modnewposts = BoolToInt(setting.Items[5].Selected); //__foruminfo.Jammer = BoolToInt(setting.Items[6].Selected); __foruminfo.Disablewatermark = BoolToInt(setting.Items[6].Selected); __foruminfo.Inheritedmod = BoolToInt(setting.Items[7].Selected); __foruminfo.Allowthumbnail = BoolToInt(setting.Items[8].Selected); __foruminfo.Allowtag = BoolToInt(setting.Items[9].Selected); //__foruminfo.Istrade = BoolToInt(setting.Items[11].Selected); int temppostspecial = 0; //temppostspecial = setting.Items[11].Selected ? temppostspecial | 1 : temppostspecial & ~1; //temppostspecial = setting.Items[12].Selected ? temppostspecial | 16 : temppostspecial & ~16; //temppostspecial = setting.Items[13].Selected ? temppostspecial | 4 : temppostspecial & ~4; __foruminfo.Allowpostspecial = temppostspecial; __foruminfo.Allowspecialonly = Convert.ToInt16(allowspecialonly.SelectedValue); if (autocloseoption.SelectedValue == "0") { __foruminfo.Autoclose = 0; } else { __foruminfo.Autoclose = Convert.ToInt32(autocloseday.Text); } __foruminfo.Description = description.Text; __foruminfo.Password = password.Text; __foruminfo.Icon = icon.Text; __foruminfo.Redirect = redirect.Text; __foruminfo.Attachextensions = attachextensions.GetSelectString(","); AdminForums.CompareOldAndNewModerator(__foruminfo.Moderators, moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0)); __foruminfo.Moderators = moderators.Text.Replace("\r\n", ","); __foruminfo.Rules = rules.Text; __foruminfo.Topictypes = topictypes.Text; __foruminfo.Viewperm = Request.Form["viewperm"]; __foruminfo.Postperm = Request.Form["postperm"]; __foruminfo.Replyperm = Request.Form["replyperm"]; __foruminfo.Getattachperm = Request.Form["getattachperm"]; __foruminfo.Postattachperm = Request.Form["postattachperm"]; __foruminfo.Applytopictype = Convert.ToInt32(applytopictype.SelectedValue); __foruminfo.Postbytopictype = Convert.ToInt32(postbytopictype.SelectedValue); __foruminfo.Viewbytopictype = Convert.ToInt32(viewbytopictype.SelectedValue); __foruminfo.Topictypeprefix = Convert.ToInt32(topictypeprefix.SelectedValue); __foruminfo.Topictypes = GetTopicType(); __foruminfo.Permuserlist = GetPermuserlist(); Discuz.Aggregation.AggregationFacade.ForumAggregation.ClearDataBind(); string result = AdminForums.SaveForumsInf(__foruminfo).Replace("'", "’"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim()); GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); __configinfo.Specifytemplate = DatabaseProvider.GetInstance().GetSpecifyForumTemplateCount() > 0 ? 1: 0; GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("../../config/general.config")); if (result == "") { Response.Redirect("forum_ForumsTree.aspx"); } else { Response.Write("<script>alert('用户:" + result + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); Response.End(); } } } #endregion }
private void SubmitInfo_Click(object sender, EventArgs e) { if (base.CheckCookie() && Request["fid"] != "") { this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0)); this.forumInfo.Name = this.name.Text.Trim(); this.forumInfo.DisplayOrder = this.displayorder.Text.ToInt(); this.forumInfo.Status = this.status.SelectedValue.ToInt(); if (this.colcount.SelectedValue == "1") { this.forumInfo.ColCount = 1; } else { var count = colcountnumber.Text.ToInt(); if (count < 1 || count > 9) { base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } this.forumInfo.ColCount = count; } 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.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.DisableWatermark = this.setting.Items[6].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[7].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[8].Selected; this.forumInfo.AllowTag = this.setting.Items[9].Selected; int allowpostspecial = 0; this.forumInfo.AllowPostSpecial = allowpostspecial; 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 = 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; this.forumInfo.TopicTypes = this.topictypes.Text; 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("'", "’"); 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"); return; } base.Response.Write("<script>alert('用户:" + text + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); base.Response.End(); } }