private void SaveForum_Click(object sender, EventArgs e) { int num = -1; bool flag = false; foreach (object current in this.DataGrid1.GetKeyIDArray()) { int fid = int.Parse(current.ToString()); string text = this.DataGrid1.GetControlValue(num, "name").Trim(); //string text2 = this.DataGrid1.GetControlValue(num, "subforumcount").Trim(); string text3 = this.DataGrid1.GetControlValue(num, "displayorder").Trim(); if (String.IsNullOrEmpty(text) || !Utils.IsNumeric(text3)) { flag = true; } else { var forumInfo = Forums.GetForumInfo(fid); forumInfo.Name = text; //forumInfo.SubforumCount = int.Parse(text2); forumInfo.DisplayOrder = int.Parse(text3); AdminForums.UpdateForumInfo(forumInfo); num++; } } XCache.Remove(CacheKeys.FORUM_UI_FORUM_LIST_BOX_OPTIONS); XCache.Remove(CacheKeys.FORUM_FORUM_LIST); if (flag) { base.RegisterStartupScript("PAGE", "alert('某些记录取值不正确,未能被更新!');window.location.href='forum_forumsgrid.aspx';"); return; } base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsgrid.aspx';"); }
private void SaveForum_Click(object sender, EventArgs e) { #region 保存版块修改信息 int row = -1; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { int fid = int.Parse(o.ToString()); string name = DataGrid1.GetControlValue(row, "name").Trim(); string subforumcount = DataGrid1.GetControlValue(row, "subforumcount").Trim(); string displayorder = DataGrid1.GetControlValue(row, "displayorder").Trim(); if (name == "" || !Utils.IsNumeric(subforumcount) || !Utils.IsNumeric(displayorder)) { error = true; continue; } ForumInfo forumInfo = Forums.GetForumInfo(fid); forumInfo.Name = name; forumInfo.Subforumcount = int.Parse(subforumcount); forumInfo.Displayorder = int.Parse(displayorder); AdminForums.UpdateForumInfo(forumInfo); row++; } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/ForumListBoxOptions"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); if (error) { base.RegisterStartupScript("PAGE", "alert('某些记录取值不正确,未能被更新!');window.location.href='forum_forumsgrid.aspx';"); } else { base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsgrid.aspx';"); } #endregion }
private void SetForumsTrade(int fid) { ForumInfo foruminfo = AdminForums.GetForumInfo(fid); int isexist = DbProvider.GetInstance().GetCategoriesFidCount(fid) != 0 ? 1 : 0; if (foruminfo.Istrade != isexist) { foruminfo.Istrade = isexist; AdminForums.UpdateForumInfo(foruminfo); } }
public void BindPower_Click(object sender, EventArgs e) { #region 特殊用户绑定 if (UserList.Text != "") { string result = forumInfo.Permuserlist; string[] userpowerlist = new string[1] { "" }; if (result != null) { userpowerlist = forumInfo.Permuserlist.Split('|'); } foreach (string adduser in UserList.Text.Split(',')) { string uid = Discuz.Forum.Users.GetUserId(adduser).ToString(); if (uid == "-1") { continue; } bool find = false; foreach (string u in userpowerlist) { if (u.IndexOf(adduser + ",") == 0) { result = result.Replace(u, adduser + "," + uid + "," + 0); find = true; break; } } if (!find) { result = adduser + "," + uid + "," + 0 + "|" + result; } } if (result != "") { if (result.Substring(result.Length - 1, 1) == "|") { result = result.Substring(0, result.Length - 1); } } forumInfo.Permuserlist = result; AdminForums.UpdateForumInfo(forumInfo); UserList.Text = ""; } DataGridBind(""); BindTopicType(); this.TabControl1.SelectedIndex = 3; #endregion }
public void BindPower_Click(object sender, EventArgs e) { if (this.UserList.Text != "") { string text = this.forumInfo.Permuserlist; string[] array = new string[] { "" }; if (text != null) { array = this.forumInfo.Permuserlist.Split('|'); } string[] array2 = this.UserList.Text.Split(','); for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; string text3 = Users.GetUserId(text2).ToString(); if (!(text3 == "-1")) { bool flag = false; string[] array3 = array; for (int j = 0; j < array3.Length; j++) { string text4 = array3[j]; if (text4.IndexOf(text2 + ",") == 0) { text = text.Replace(text4, text2 + "," + text3 + "," + 0); flag = true; break; } } if (!flag) { text = text2 + "," + text3 + "," + 0 + "|" + text; } } } if (text != "" && text.Substring(text.Length - 1, 1) == "|") { text = text.Substring(0, text.Length - 1); } this.forumInfo.Permuserlist = text; AdminForums.UpdateForumInfo(this.forumInfo); this.UserList.Text = ""; } this.DataGridBind(""); this.BindTopicType(); this.TabControl1.SelectedIndex = 3; }
public void DelButton_Click(object sender, EventArgs e) { int num = 0; ArrayList arrayList = new ArrayList(this.forumInfo.Permuserlist.Split('|')); foreach (object current in this.SpecialUserList.GetKeyIDArray()) { if (this.SpecialUserList.GetCheckBoxValue(num, "userid")) { string str = current.ToString(); string[] array = this.forumInfo.Permuserlist.Split('|'); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (text.IndexOf("," + str + ",") > 0) { arrayList.Remove(text); break; } } } num++; } string text2 = ""; foreach (string str2 in arrayList) { text2 = text2 + str2 + "|"; } if (text2 != "") { text2 = text2.Substring(0, text2.Length - 1); } this.forumInfo.Permuserlist = text2; AdminForums.UpdateForumInfo(this.forumInfo); if (this.SpecialUserList.Items.Count == 1 && this.SpecialUserList.CurrentPageIndex > 0) { this.SpecialUserList.CurrentPageIndex--; } this.DataGridBind(""); this.BindTopicType(); this.TabControl1.SelectedIndex = 3; }
public void DelButton_Click(object sender, EventArgs e) { #region 除特殊用户 int row = 0; ArrayList al = new ArrayList(forumInfo.Permuserlist.Split('|')); foreach (object o in SpecialUserList.GetKeyIDArray()) { if (SpecialUserList.GetCheckBoxValue(row, "userid")) { string uid = o.ToString(); foreach (string user in forumInfo.Permuserlist.Split('|')) { if (user.IndexOf("," + uid + ",") > 0) { al.Remove(user); break; } } } row++; } string result = ""; foreach (string user in al) { result += user + "|"; } if (result != "") { result = result.Substring(0, result.Length - 1); } forumInfo.Permuserlist = result; AdminForums.UpdateForumInfo(forumInfo); if (SpecialUserList.Items.Count == 1 && SpecialUserList.CurrentPageIndex > 0) { SpecialUserList.CurrentPageIndex--; } DataGridBind(""); BindTopicType(); this.TabControl1.SelectedIndex = 3; #endregion }
public void InsertForum(string parentid, string layer, string parentidlist, string subforumcount, string systemdisplayorder) { #region 添加新论坛 forumInfo.Parentid = Convert.ToInt32(parentid); forumInfo.Layer = Convert.ToInt32(layer); forumInfo.Parentidlist = parentidlist; forumInfo.Subforumcount = Convert.ToInt32(subforumcount); forumInfo.Name = name.Text.Trim(); forumInfo.Status = Convert.ToInt16(status.SelectedValue); forumInfo.Displayorder = Convert.ToInt32(systemdisplayorder); forumInfo.Templateid = Convert.ToInt32(templateid.SelectedValue); forumInfo.Allowsmilies = BoolToInt(setting.Items[0].Selected); forumInfo.Allowrss = BoolToInt(setting.Items[1].Selected); forumInfo.Allowhtml = 0; forumInfo.Allowbbcode = BoolToInt(setting.Items[2].Selected); forumInfo.Allowimgcode = BoolToInt(setting.Items[3].Selected); forumInfo.Allowblog = 0; forumInfo.Istrade = 0; forumInfo.Alloweditrules = 0; 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); forumInfo.Istrade = 0; 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); forumInfo.Autoclose = autocloseoption.SelectedValue == "0" ? 0 : Convert.ToInt32(autocloseday.Text); forumInfo.Description = description.Text; forumInfo.Password = password.Text; forumInfo.Icon = icon.Text; forumInfo.Postcredits = ""; forumInfo.Replycredits = ""; forumInfo.Redirect = redirect.Text; forumInfo.Attachextensions = attachextensions.GetSelectString(","); forumInfo.Moderators = moderators.Text; forumInfo.Rules = rules.Text; forumInfo.Seokeywords = seokeywords.Text.Trim(); forumInfo.Seodescription = seodescription.Text.Trim(); forumInfo.Rewritename = rewritename.Text.Trim(); forumInfo.Topictypes = topictypes.Text; forumInfo.Colcount = colcount.SelectedValue == "1" ? 1 : Convert.ToInt16(colcountnumber.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"]; string result; int fid = AdminForums.CreateForums(forumInfo, out result, userid, username, usergroupid, grouptitle, ip); //如果有上传版块图片的操作 if (HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) { forumInfo = Forums.GetForumInfo(fid); forumInfo.Icon = AdminForums.UploadForumIcon(forumInfo.Fid); AdminForums.UpdateForumInfo(forumInfo).Replace("'", "’"); ForumOperator.RefreshForumCache(); GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Specifytemplate = Forums.GetSpecifyForumTemplateCount() > 0 ? 1 : 0; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); } if (string.IsNullOrEmpty(result)) { base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';"); } else { base.RegisterStartupScript("PAGE", "alert('用户:" + result + "不存在,因为无法设为版主');self.location.href='forum_ForumsTree.aspx';"); } #endregion }
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 }
public void InsertForum(Int32 parentid, Int32 systemdisplayorder) { //需要初始化 forumInfo forumInfo = new XForum(); this.forumInfo.ParentID = parentid; //this.forumInfo.Layer = layer.ToInt(); //this.forumInfo.Parentidlist = parentidlist; //this.forumInfo.SubforumCount = subforumcount.ToInt(); this.forumInfo.Name = this.name.Text.Trim(); this.forumInfo.Status = this.status.SelectedValue.ToInt(); this.forumInfo.DisplayOrder = systemdisplayorder; this.forumInfo.TemplateID = this.templateid.SelectedValue.ToInt(); this.forumInfo.AllowSmilies = this.setting.Items[0].Selected; this.forumInfo.AllowRss = this.setting.Items[1].Selected; //this.forumInfo.AllowHtml = 0; this.forumInfo.AllowBbCode = this.setting.Items[2].Selected; this.forumInfo.AllowImgCode = this.setting.Items[3].Selected; //this.forumInfo.AllowBlog = 0; //this.forumInfo.IsTrade = 0; //this.forumInfo.AllowEditRules = 0; this.forumInfo.Recyclebin = this.BoolToInt(this.setting.Items[4].Selected); this.forumInfo.Modnewposts = this.BoolToInt(this.setting.Items[5].Selected); this.forumInfo.Modnewtopics = this.BoolToInt(this.setting.Items[6].Selected); this.forumInfo.Jammer = this.BoolToInt(this.setting.Items[7].Selected); this.forumInfo.DisableWatermark = this.setting.Items[8].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[9].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[10].Selected; this.forumInfo.AllowTag = this.setting.Items[11].Selected; //this.forumInfo.IsTrade = 0; int num = 0; num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2)); num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17)); num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5)); this.forumInfo.AllowPostSpecial = num; this.forumInfo.AllowEditRules = this.setting.Items[15].Selected; this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0; this.forumInfo.AutoClose = ((this.autocloseoption.SelectedValue == "0") ? 0 : this.autocloseday.Text.ToInt()); this.forumInfo.Description = this.description.Text; this.forumInfo.Password = this.password.Text; this.forumInfo.Icon = this.icon.Text; //this.forumInfo.PostcrEdits = ""; //this.forumInfo.ReplycrEdits = ""; this.forumInfo.Redirect = this.redirect.Text; this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(","); this.forumInfo.Moderators = this.moderators.Text; this.forumInfo.Rules = this.rules.Text; this.forumInfo.Seokeywords = this.seokeywords.Text.Trim(); this.forumInfo.Seodescription = this.seodescription.Text.Trim(); this.forumInfo.RewriteName = this.rewritename.Text.Trim(); this.forumInfo.TopicTypes = this.topictypes.Text; this.forumInfo.ColCount = colcount.SelectedValue == "1" ? 1 : colcountnumber.Text.ToInt(); this.forumInfo.ViewPerm = base.Request.Form["viewperm"]; this.forumInfo.PostPerm = base.Request.Form["postperm"]; this.forumInfo.ReplyPerm = base.Request.Form["replyperm"]; this.forumInfo.GetattachPerm = base.Request.Form["getattachperm"]; this.forumInfo.PostattachPerm = base.Request.Form["postattachperm"]; string text; int fid = AdminForums.CreateForums(this.forumInfo, out text, this.userid, this.username, this.usergroupid, this.grouptitle, this.ip); if (HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) { this.forumInfo = Forums.GetForumInfo(fid); this.forumInfo.Icon = AdminForums.UploadForumIcon(this.forumInfo.ID); AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’"); ForumOperator.RefreshForumCache(); GeneralConfigInfo config = GeneralConfigInfo.Current; config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0); config.Save(); //config.Save();; } if (string.IsNullOrEmpty(text)) { base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';"); return; } base.RegisterStartupScript("PAGE", "alert('用户:" + text + "不存在,因为无法设为版主');self.location.href='forum_ForumsTree.aspx';"); }
private void SubmitInfo_Click(object sender, EventArgs e) { var fid = Request["fid"].ToInt(); if (base.CheckCookie() && fid > 0) { //this.forumInfo = Forums.GetForumInfo(DNTRequest.GetInt("fid", 0)); var f = XForum.FindByID(fid); this.forumInfo = f as IXForum; this.forumInfo.Name = this.name.Text.Trim(); this.forumInfo.DisplayOrder = displayorder.Text.ToInt(); this.forumInfo.Status = status.SelectedValue.ToInt(); if (this.colcount.SelectedValue == "1") { this.forumInfo.ColCount = 1; } else { var count = colcountnumber.Text.ToInt(); if (count < 1 || count > 9) { this.colcountnumber.Text = ""; base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>"); return; } this.forumInfo.ColCount = count; } if (this.rewritename.Text.Trim() != this.oldrewritename.Value && !this.rewritename.Text.IsNullOrEmpty() && XForum.CheckRewriteNameInvalid(this.rewritename.Text.Trim())) { this.rewritename.Text = ""; base.RegisterStartupScript("", "<script>alert('URL重写非法!');</script>"); return; } this.forumInfo.TemplateID = ((this.templateid.SelectedValue.ToInt() == this.config.Templateid) ? 0 : this.templateid.SelectedValue.ToInt()); //this.forumInfo.AllowHtml = 0; //this.forumInfo.AllowBlog = 0; //this.forumInfo.IsTrade = 0; //this.forumInfo.AllowEditRules = 0; this.forumInfo.AllowSmilies = this.setting.Items[0].Selected; this.forumInfo.AllowRss = this.setting.Items[1].Selected; this.forumInfo.AllowBbCode = this.setting.Items[2].Selected; this.forumInfo.AllowImgCode = this.setting.Items[3].Selected; this.forumInfo.Recyclebin = this.BoolToInt(this.setting.Items[4].Selected); this.forumInfo.Modnewposts = this.BoolToInt(this.setting.Items[5].Selected); this.forumInfo.Modnewtopics = this.BoolToInt(this.setting.Items[6].Selected); this.forumInfo.Jammer = this.BoolToInt(this.setting.Items[7].Selected); this.forumInfo.DisableWatermark = this.setting.Items[8].Selected; this.forumInfo.Inheritedmod = this.BoolToInt(this.setting.Items[9].Selected); this.forumInfo.AllowThumbnail = this.setting.Items[10].Selected; this.forumInfo.AllowTag = this.setting.Items[11].Selected; int num = 0; num = (this.setting.Items[12].Selected ? (num | 1) : (num & -2)); num = (this.setting.Items[13].Selected ? (num | 16) : (num & -17)); num = (this.setting.Items[14].Selected ? (num | 4) : (num & -5)); this.forumInfo.AllowPostSpecial = num; this.forumInfo.AllowEditRules = this.setting.Items[15].Selected; this.forumInfo.AllowSpecialOnly = (int)Convert.ToInt16(this.allowspecialonly.SelectedValue) != 0; if (this.autocloseoption.SelectedValue == "0") { this.forumInfo.AutoClose = 0; } else { this.forumInfo.AutoClose = this.autocloseday.Text.ToInt(); } this.forumInfo.Description = this.description.Text; this.forumInfo.Password = this.password.Text; this.forumInfo.Icon = ((HttpContext.Current.Request.Files.Count > 0 && !string.IsNullOrEmpty(HttpContext.Current.Request.Files[0].FileName)) ? AdminForums.UploadForumIcon(this.forumInfo.ID) : this.icon.Text); this.forumInfo.Redirect = this.redirect.Text; this.forumInfo.Attachextensions = this.attachextensions.GetSelectString(","); AdminForums.CompareOldAndNewModerator(this.forumInfo.Moderators, this.moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0)); this.forumInfo.Moderators = this.moderators.Text.Replace("\r\n", ","); this.forumInfo.Rules = this.rules.Text.Trim(); this.forumInfo.Seokeywords = this.seokeywords.Text.Trim(); this.forumInfo.Seodescription = this.seodescription.Text.Trim(); this.forumInfo.RewriteName = this.rewritename.Text.Trim(); this.forumInfo.ViewPerm = base.Request.Form["viewperm"]; this.forumInfo.PostPerm = base.Request.Form["postperm"]; this.forumInfo.ReplyPerm = base.Request.Form["replyperm"]; this.forumInfo.GetattachPerm = base.Request.Form["getattachperm"]; this.forumInfo.PostattachPerm = base.Request.Form["postattachperm"]; this.forumInfo.ApplytopicType = Convert.ToSByte(this.applytopictype.SelectedValue); this.forumInfo.PostbytopicType = Convert.ToSByte(this.postbytopictype.SelectedValue); this.forumInfo.ViewbytopicType = Convert.ToSByte(this.viewbytopictype.SelectedValue); this.forumInfo.Topictypeprefix = Convert.ToSByte(this.topictypeprefix.SelectedValue); this.forumInfo.TopicTypes = this.GetTopicType(); this.forumInfo.Permuserlist = this.GetPermuserlist(); //AggregationFacade.ForumAggregation.ClearDataBind(); string text = AdminForums.UpdateForumInfo(this.forumInfo).Replace("'", "’"); if (this.childForumApplyTemplate.Checked) { // 子孙采用相同的模板 //AdminForums.UpdateForumTemplateID(this.forumInfo); foreach (var item in f.AllChilds) { item.TemplateID = f.TemplateID; item.Update(); } } ForumOperator.RefreshForumCache(); AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + this.name.Text.Trim()); var config = GeneralConfigInfo.Current; config.Specifytemplate = ((Forums.GetSpecifyForumTemplateCount() > 0) ? 1 : 0); config.Save(); //config.Save();; if (String.IsNullOrEmpty(text)) { //base.Response.Redirect("forum_ForumsTree.aspx"); base.RegisterStartupScript("PAGE", "self.location.href='forum_ForumsTree.aspx';"); return; } base.Response.Write("<script>alert('用户:" + text + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>"); base.Response.End(); } }
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) { 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.UpdateForumInfo(forumInfo).Replace("'", "’"); 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) { 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(); } }