protected void Addhelp_Click(object sender, EventArgs e) { #region 增加帮助项 if (this.CheckCookie()) { if (int.Parse(type.SelectedItem.Value) == 0) { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='global_addhelp.aspx';</script>"); } else { Helps.addhelp(tbtitle.Text, message.Text, int.Parse(type.SelectedItem.Value)); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加帮助", "添加帮助,标题为:" + tbtitle.Text); #if NET1 if (!base.IsStartupScriptRegistered("page")) { base.RegisterStartupScript("", "<script>window.location.href='global_helplist.aspx';</script>"); } #else base.RegisterStartupScript("", "<script>window.location.href='global_helplist.aspx';</script>"); #endif } } #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region FID删除相应的版块 if (DNTRequest.GetString("istrade") == "1") { //如果是交易版块,则选清除绑定的商品 if (MallPluginProvider.GetInstance() != null) { MallPluginProvider.GetInstance().EmptyGoodsCategoryFid(DNTRequest.GetInt("fid", 0)); MallPluginProvider.GetInstance().StaticWriteJsonFile(); DNTCache.GetCacheService().RemoveObject("/Mall/MallSetting/GoodsCategories"); } } if (Forums.DeleteForum(DNTRequest.GetString("fid"))) { ForumOperator.RefreshForumCache(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除论坛版块", "删除论坛版块,fid为:" + DNTRequest.GetString("fid")); base.RegisterStartupScript("", "<script>window.location.href='forum_ForumsTree.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('对不起,当前节点下面还有子结点,因此不能删除!');window.location.href='forum_ForumsTree.aspx';</script>"); } #endregion } }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { SpaceActiveConfigInfo __configinfo = SpaceActiveConfigs.GetConfig(); __configinfo.SpaceFooterInfo = spacefooterinfo.Text; __configinfo.Spacegreeting = greeting.Text; __configinfo.Enablespacerewrite = Utils.StrToInt(enablerewrite.SelectedValue, 0); SpaceActiveConfigs.SaveConfig(__configinfo); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "空间其它信息设置", ""); if (!Utils.IsNumeric(topictoblog.Text) || Convert.ToInt32(topictoblog.Text) > 10 || Convert.ToInt32(topictoblog.Text) < 0) { base.RegisterStartupScript("PAGE", "alert('自动加入日志数量取值必须在0~10之间');window.location='space_spacefooterinfo.aspx';"); return; } config.Topictoblog = Convert.ToInt32(topictoblog.Text); GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); base.RegisterStartupScript("PAGE", "window.location='space_spacefooterinfo.aspx';"); } #endregion }
private void DeleteAttachment_Click(object sender, EventArgs e) { #region 除选中的附件 if (this.CheckCookie()) { if (DNTRequest.GetString("aid") != "") { string aidlist = DNTRequest.GetString("aid"); DataTable dt = Attachments.GetAttachList(ViewState["condition"].ToString(), Posts.GetPostTableName()); foreach (DataRow dr in dt.Select("aid IN(" + aidlist + ")")) { DeleteFile(dr["filename"].ToString()); } Attachments.DeleteAttachment(aidlist); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件", "ID:" + aidlist); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchattchment.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_searchattchment.aspx';</script>"); } } #endregion }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { __usergroupinfo.System = 0; __usergroupinfo.Type = 0; __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); __usergroupinfo.Allowdirectpost = 1; __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.Radminid = -1; __usergroupinfo.Grouptitle = groupTitle.Text; __usergroupinfo.Creditshigher = 0; __usergroupinfo.Creditslower = 0; __usergroupinfo.Stars = Convert.ToInt32(stars.Text); __usergroupinfo.Color = color.Text; __usergroupinfo.Groupavatar = groupavatar.Text; __usergroupinfo.Maxprice = Convert.ToInt32(maxprice.Text); __usergroupinfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); __usergroupinfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); __usergroupinfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); __usergroupinfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); __usergroupinfo.Attachextensions = attachextensions.GetSelectString(","); __usergroupinfo.Raterange = ""; usergrouppowersetting.GetSetting(ref __usergroupinfo); if (AdminUserGroups.AddUserGroupInfo(__usergroupinfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加特殊用户组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } } } #endregion }
private void DelRec_Click(object sender, EventArgs e) { #region 除指定的表情记录 if (this.CheckCookie()) { if (DNTRequest.GetString("id") != "") { string idlist = DNTRequest.GetString("id"); DatabaseProvider.GetInstance().DeleteSmilies(idlist); UpdateSmiliesCache(); Caches.GetSmiliesCache(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "表情文件删除", "ID:" + idlist); Response.Redirect("forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0)); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_smilegrid.aspx?typeid=" + DNTRequest.GetInt("typeid", 0) + "';</script>"); } } #endregion }
private void RunSqlString_Click(object sender, EventArgs e) { #region 运行指定的SQL语句 if (this.CheckCookie()) { if (!base.IsFounderUid(userid)) { Response.Write(base.GetShowMessage()); Response.End(); return; } if (sqlstring.Text.Trim() == "") { base.RegisterStartupScript("", "<script language=\"javascript\">alert('请您输入SQL语句!');</script>"); return; } string message = DatabaseProvider.GetInstance().RunSql(sqlstring.Text.Replace("dnt_", BaseConfigs.GetTablePrefix)); if (message != string.Empty) { base.RegisterStartupScript("", "<script language=\"javascript\">showalert('" + message + "');</script>"); return; } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "运行SQL语句", sqlstring.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_runsql.aspx';"); } #endregion }
private void SaveAttachType_Click(object sender, EventArgs e) { #region 保存附件类型修改 int rowid = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { string extension = DataGrid1.GetControlValue(rowid, "extension").Trim(); string maxsize = DataGrid1.GetControlValue(rowid, "maxsize").Trim(); if ((extension == "") || (maxsize == "")) { error = true; continue; } Attachments.UpdateAttchType(extension, maxsize, int.Parse(o.ToString())); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑附件类型", "编辑附件类型,扩展名为:" + extension); rowid++; } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumSetting/AttachmentType"); if (error) { base.RegisterStartupScript("", "<script>alert('某些记录取值不正确,未能被更新!');window.location.href='forum_attachtypesgrid.aspx';</script>"); } else { base.RegisterStartupScript("PAGE", "window.location.href='forum_attachtypesgrid.aspx';"); } #endregion }
protected void DataGrid_Update(Object sender, DataGridCommandEventArgs E) { #region 更新相关的在线图例信息 int groupid = Utils.StrToInt(DataGrid1.DataKeys[E.Item.ItemIndex].ToString(), 0); int displayorder = Utils.StrToInt(((TextBox)E.Item.Cells[2].Controls[0]).Text, 0); if (displayorder < 0) { displayorder = 0; //不允许出现负数 } string title = ((TextBox)E.Item.Cells[3].Controls[0]).Text; string img = ((DropDownList)E.Item.FindControl("imgdropdownlist")).SelectedValue; AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "在线列表定制", title); try { DatabaseProvider.GetInstance().UpdateOnlineList(groupid, displayorder, img, title); BindData(); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/OnlineIconList"); base.RegisterStartupScript("PAGE", "window.location.href='global_onlinelistgrid.aspx';"); } catch { base.RegisterStartupScript("", "<script>alert('无法更新数据库');window.location.href='global_onlinelistgrid.aspx';</script>"); } #endregion }
private void AddIdentifyInfo_Click(object sender, EventArgs e) { #region 添加鉴定记录 if (this.CheckCookie()) { string fileName = uploadfile.UpdateFile(); if (fileName.Trim() == "") { base.RegisterStartupScript("PAGE", "alert('没有选择鉴定图片');window.location.href='forum_identifymanage.aspx';"); } if (Identifys.AddIdentify(name.Text, fileName)) { DNTCache.GetCacheService().RemoveObject("/Forum/TopicIdentifys"); DNTCache.GetCacheService().RemoveObject("/Forum/TopicIndentifysJsArray"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件添加", name.Text); base.RegisterStartupScript("PAGE", "window.location.href='forum_identifymanage.aspx';"); } else { base.RegisterStartupScript("PAGE", "alert('插入失败,可能名称与原有的相同');window.location.href='forum_identifymanage.aspx';"); } } #endregion }
protected void DataGrid_Update(Object sender, DataGridCommandEventArgs E) { #region 更新相关的图标信息 int id = Utils.StrToInt(DataGrid1.DataKeys[E.Item.ItemIndex].ToString(), 0); int displayorder = Utils.StrToInt(((TextBox)E.Item.Cells[3].Controls[0]).Text, 0); string code = ((TextBox)E.Item.Cells[5].Controls[0]).Text; string url = ((TextBox)E.Item.Cells[6].Controls[0]).Text; AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "表情文件更新", code); try { DatabaseProvider.GetInstance().UpdateSmilies(id, displayorder, 1, code, url); BindData(); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/IconsList"); } catch { base.RegisterStartupScript("", "<script>alert('无法更新数据库.');window.location.href='forum_iconfilegrid.aspx';</script>"); return; } #endregion }
private void DelRec_Click(object sender, EventArgs e) { #region 除选定的图版轮换页 if (this.CheckCookie()) { string rowidlist = DNTRequest.GetString("rowid"); if (rowidlist != "") { int delcount = 0; XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes; foreach (string menuid in rowidlist.Split(',')) { doc.SelectSingleNode(targetNode).RemoveChild(__xmlnodelist.Item(int.Parse(menuid) - delcount)); delcount++; } doc.Save(configPath); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除选定的图版轮换页", "删除选定的图版轮换页,ID为: " + DNTRequest.GetString("id").Replace("0 ", "")); Response.Redirect("aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename")); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>"); } } #endregion }
private void addrota_Click(Object sender, EventArgs e) { #region 插入聚合页图版轮换广告 if ((rotaimg.Text.Trim() != "") && (url.Text.Trim() != "") && (titlecontent.Text.Trim() != "")) { if ((!Utils.IsURL(rotaimg.Text.Trim()) || (!Utils.IsURL(url.Text.Trim())))) { base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>"); BindData(); ResetForm(); return; } XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); int lastRotatepicid = 0; if (doc.SelectSingleNode(targetNode) != null) { if (doc.SelectSingleNode(targetNode).InnerText != "") { lastRotatepicid = int.Parse(doc.SelectSingleNode(targetNode).LastChild["rotatepicid"].InnerText); } } lastRotatepicid++; XmlElement rotatepicNode = doc.CreateElement(nodeName); doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", lastRotatepicid.ToString()); doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1"); doc.AppendChildElementByNameValue(ref rotatepicNode, "img", rotaimg.Text.Trim()); doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url.Text.Trim()); doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent.Text.Trim()); doc.CreateNode(targetNode).AppendChild(rotatepicNode); doc.Save(configPath); AggregationFacade.BaseAggregation.ClearAllDataBind(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + titlecontent.Text.Trim()); try { BindData(); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList"); ResetForm(); base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';"); return; } catch { base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>"); return; } } else { base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>"); return; } #endregion }
private void AddUserGroupInf_Click(object sender, EventArgs e) { #region 插入相关组信息数据 if (this.CheckCookie()) { __usergroupinfo.System = 0; __usergroupinfo.Type = 0; __usergroupinfo.Readaccess = Convert.ToInt32(readaccess.Text == "" ? "0" : readaccess.Text); __usergroupinfo.Radminid = 0; __usergroupinfo.Grouptitle = groupTitle.Text; __usergroupinfo.Creditshigher = Convert.ToInt32(creditshigher.Text); __usergroupinfo.Creditslower = Convert.ToInt32(creditslower.Text); usergrouppowersetting.GetSetting(ref __usergroupinfo); if (__usergroupinfo.Creditshigher >= __usergroupinfo.Creditslower) { base.RegisterStartupScript("", "<script>alert('操作失败, 金币下限必须小于金币上限');</script>"); return; } if (__usergroupinfo.Allowbonus == 1 && (__usergroupinfo.Minbonusprice >= __usergroupinfo.Maxbonusprice)) { base.RegisterStartupScript("", "<script>alert('操作失败, 最低悬赏价格必须小于最高悬赏价格');</script>"); return; } __usergroupinfo.Stars = Convert.ToInt32(stars.Text); __usergroupinfo.Color = color.Text; __usergroupinfo.Groupavatar = groupavatar.Text; __usergroupinfo.Maxprice = Convert.ToInt32(maxprice.Text); __usergroupinfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); __usergroupinfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); __usergroupinfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); __usergroupinfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); __usergroupinfo.Attachextensions = attachextensions.GetSelectString(","); __usergroupinfo.Raterange = ""; if (AdminUserGroups.AddUserGroupInfo(__usergroupinfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台添加用户组", "组名:" + groupTitle.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupgrid.aspx';</script>"); } } } #endregion }
public void AddMedalInfo_Click(object sender, EventArgs e) { #region 添加勋章节 if (this.CheckCookie()) { if (image.Text == "") { base.RegisterStartupScript("", "<script>alert('上传图片不能为空');</script>"); return; } //string sqlstring = string.Format("INSERT INTO [" + BaseConfigs.GetTablePrefix + "medals] (medalid,name,available,image) Values ('{0}','{1}','{2}','{3}')", // Convert.ToString(Convert.ToInt32(DbHelper.SelectMaxID("" + BaseConfigs.GetTablePrefix + "medals", "medalid")) + 1), // name.Text, // available.SelectedValue, // image.Text); //DbHelper.ExecuteNonQuery(sqlstring); DatabaseProvider.GetInstance().AddMedal( DatabaseProvider.GetInstance().GetMaxMedalId(), name.Text, int.Parse(available.SelectedValue), image.Text); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/MedalsList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "勋章文件添加", name.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_medalgrid.aspx';"); } #endregion }
/// <summary> /// 删除主题分类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void delButton_Click(object sender, EventArgs e) { #region 除主题分类 if (this.CheckCookie()) { if (DNTRequest.GetString("id") != "") { //取得要删除的ID列表,以“,”分隔 string idlist = DNTRequest.GetString("id"); //调用更新版块的方法 DeleteForumTypes(idlist); //从主题分类表(dnt_topictypes)中删除相应的分类并写日志 TopicTypes.DeleteTopicTypes(idlist); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除主题分类", "删除主题分类,ID为:" + DNTRequest.GetString("id").Replace("0 ", "")); //更新主题分类缓存 DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypes"); Response.Redirect("forum_topictypesgrid.aspx"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_attachtypesgrid.aspx';</script>"); } } #endregion }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); Hashtable TimeHash = new Hashtable(); TimeHash.Add("禁止访问时间段", visitbanperiods.Text); TimeHash.Add("禁止发帖时间段", postbanperiods.Text); TimeHash.Add("发帖审核时间段", postmodperiods.Text); TimeHash.Add("禁止下载附件时间段", attachbanperiods.Text); TimeHash.Add("禁止全文搜索时间段", searchbanperiods.Text); string key = ""; if (Utils.IsRuleTip(TimeHash, "timesect", out key) == false) { base.RegisterStartupScript("erro", "<script>alert('" + key.ToString() + ",时间格式错误');</script>"); return; } configInfo.Visitbanperiods = visitbanperiods.Text; configInfo.Postbanperiods = postbanperiods.Text; configInfo.Postmodperiods = postmodperiods.Text; configInfo.Searchbanperiods = searchbanperiods.Text; configInfo.Attachbanperiods = attachbanperiods.Text; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "时间段设置", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_timespan.aspx';"); } #endregion }
private void UpdateAnnounceInfo_Click(object sender, EventArgs e) { #region 更新公告相关信息 if (this.CheckCookie()) { AnnouncementInfo announcementInfo = new AnnouncementInfo(); announcementInfo.Id = DNTRequest.GetInt("id", 0); announcementInfo.Poster = poster.Text.Trim(); announcementInfo.Title = title.Text.Trim(); announcementInfo.Displayorder = TypeConverter.StrToInt(displayorder.Text); announcementInfo.Starttime = Convert.ToDateTime(starttime.Text); announcementInfo.Endtime = Convert.ToDateTime(endtime.Text); announcementInfo.Message = DNTRequest.GetString("announcemessage_hidden").Trim(); Announcements.UpdateAnnouncement(announcementInfo); //移除公告缓存 Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList"); //记录日志 AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "更新公告", "更新公告,标题为:" + title.Text); base.RegisterStartupScript("PAGE", "window.location.href='global_announcegrid.aspx';"); } #endregion }
protected void SaveFriend_Click(Object sender, EventArgs e) { #region 保存友情链接修改 int row = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { int id = int.Parse(o.ToString()); int displayorder = int.Parse(DataGrid1.GetControlValue(row, "displayorder")); string name = DataGrid1.GetControlValue(row, "name").Trim(); string url = DataGrid1.GetControlValue(row, "url").Trim(); string note = DataGrid1.GetControlValue(row, "note").Trim(); string logo = DataGrid1.GetControlValue(row, "logo").Trim(); Regex r = new Regex("(http|https)://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?"); if (name == "" || !r.IsMatch(url.Replace("'", "''"))) { error = true; continue; } DatabaseProvider.GetInstance().UpdateForumLink(id, displayorder, name, url, note, logo); row++; } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量更新友情链接", ""); if (error) { base.RegisterStartupScript("PAGE", "alert('某些信息不完整,未能更新!');window.location.href='global_forumlinksgrid.aspx';"); } else { base.RegisterStartupScript("PAGE", "window.location.href='global_forumlinksgrid.aspx';"); } #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindData(); } #region 插入相关友情链接记录 if ((DNTRequest.GetString("displayorder").Trim() != "") && (DNTRequest.GetString("name").Trim() != "")) { Regex r = new Regex("(http|https)://([\\w-]+\\.)+[\\w-]+(/[\\w-./?%&=]*)?"); if (!r.IsMatch(DNTRequest.GetString("url").Replace("'", "''"))) { base.RegisterStartupScript("", "<script>alert('链接地址不是有效的网页地址.');</script>"); return; } try { ForumLinks.CreateForumLink(DNTRequest.GetInt("displayorder", 0), DNTRequest.GetString("name"), DNTRequest.GetString("url"), DNTRequest.GetString("note"), DNTRequest.GetString("logo")); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加友情链接", "添加友情链接,名称为: " + DNTRequest.GetString("name")); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList"); BindData(); } catch { base.RegisterStartupScript("", "<script>alert('无法更新数据库');window.location.href='global_forumlinksgrid.aspx';</script>"); return; } } #endregion }
protected void SaveFriend_Click(Object sender, EventArgs e) { #region 保存友情链接修改 int row = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { int displayorder = int.Parse(DataGrid1.GetControlValue(row, "displayorder")); string name = DataGrid1.GetControlValue(row, "name").Trim(); string url = DataGrid1.GetControlValue(row, "url").Trim(); string note = DataGrid1.GetControlValue(row, "note").Trim(); string logo = DataGrid1.GetControlValue(row, "logo").Trim(); if (ForumLinks.UpdateForumLink(int.Parse(o.ToString()), displayorder, name, url, note, logo) == -1) { error = true; } else { row++; } } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量更新友情链接", ""); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList"); if (error) { base.RegisterStartupScript("PAGE", "alert('某些信息不完整,未能更新!');window.location.href='global_forumlinksgrid.aspx';"); } else { base.RegisterStartupScript("PAGE", "window.location.href='global_forumlinksgrid.aspx';"); } #endregion }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Seotitle = seotitle.Text; configInfo.Seokeywords = seokeywords.Text; configInfo.Seodescription = seodescription.Text; configInfo.Seohead = seohead.Text; configInfo.Archiverstatus = Convert.ToInt16(archiverstatus.SelectedValue); configInfo.Sitemapstatus = Convert.ToInt16(sitemapstatus.SelectedValue); configInfo.Sitemapttl = Convert.ToInt32(sitemapttl.Text); configInfo.Aspxrewrite = Convert.ToInt16(aspxrewrite.SelectedValue); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "搜索引擎优化设置", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_searchengine.aspx';"); } #endregion }
private void SaveMedal_Click(object send, EventArgs e) { #region 保存勋章信息修改 int row = 0; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { int id = int.Parse(o.ToString()); string name = DataGrid1.GetControlValue(row, "name").Trim(); string image = DataGrid1.GetControlValue(row, "image").Trim(); if (name == "" || image == "") { error = true; continue; } Medals.UpdateMedal(id, name, image); row++; } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "批量更新勋章信息", ""); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/MedalsList"); if (error) { base.RegisterStartupScript("PAGE", "alert('某些信息不完整,未能更新!');window.location.href='global_medalgrid.aspx';"); } else { base.RegisterStartupScript("PAGE", "window.location.href='global_medalgrid.aspx';"); } #endregion }
/// <summary> /// 增加新主题分类 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AddNewRec_Click(object sender, EventArgs e) { #region 增加新主题分类 //检查输入是否合法 if (!CheckValue(typename.Text, displayorder.Text, description.Text)) { return; } //检查是否有同名分类存在 if (TopicTypes.IsExistTopicType(typename.Text)) { base.RegisterStartupScript("", "<script>alert('数据库中已存在相同的主题分类名称');window.location.href='forum_topictypesgrid.aspx';</script>"); return; } //增加分类到dnt_topictypes,并写日志 TopicTypes.CreateTopicTypes(typename.Text, int.Parse(displayorder.Text), description.Text); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加主题分类", "添加主题分类,名称为:" + typename.Text); //更新分类缓存 DNTCache.GetCacheService().RemoveObject("/Forum/TopicTypes"); base.RegisterStartupScript("", "<script>window.location.href='forum_topictypesgrid.aspx';</script>"); return; #endregion }
private void DeleteUserGroupInf_Click(object sender, EventArgs e) { #region 除用户组 if (this.CheckCookie()) { if (AdminUserGroups.DeleteUserGroupInfo(DNTRequest.GetInt("groupid", -1))) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); UserGroups.GetUserGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除特殊用户组", "组ID:" + DNTRequest.GetInt("groupid", -1)); base.RegisterStartupScript("PAGE", "window.location.href='global_usergroupspecialgrid.aspx';"); } else { if (AdminUserGroups.opresult != "") { base.RegisterStartupScript("", "<script>alert('操作失败,原因:" + AdminUserGroups.opresult + "');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_usergroupspecialgrid.aspx';</script>"); } } } #endregion }
protected void Page_Load(object sender, EventArgs e) { if (DNTRequest.GetString("currentfid") != "") { if (!AdminForums.MovingForumsPos(DNTRequest.GetString("currentfid"), DNTRequest.GetString("targetfid"), DNTRequest.GetString("isaschildnode") == "1" ? true : false)) { base.RegisterStartupScript("", "<script>alert('当前版块下面有子版块,因此无法移动!');window.location.href='forum_forumsTree.aspx';</script>"); } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "移动论坛版块", "移动论坛版块ID:" + DNTRequest.GetString("currentfid") + "到ID:" + DNTRequest.GetString("targetfid")); } if (!Page.IsPostBack) { DataTable dt = DatabaseProvider.GetInstance().GetForums(); ViewState["dt"] = dt; if (dt.Rows.Count == 0) { Server.Transfer("forum_AddFirstForum.aspx"); //如果版块表中没有任何版块, 则跳转到"添加第一个版块"页面. } else { AddTree(0, dt.Select("layer=0 AND [parentid]=0"), ""); str = "<script type=\"text/javascript\">\r\n var obj = [" + str; str = str.Substring(0, str.Length - 3); str += "];\r\n var newtree = new tree(\"newtree\",obj,\"reSetTree\");"; str += "</script>"; } ShowTreeLabel.Text = str; } }
//private void UpDateInfo(string active,string other) //{ // AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, active, other); //} public void SubmitButton_Click(object sender, EventArgs e) { #region 保存新建主题鉴定 bool ok = true; for (int i = 1; i <= fileList.Count; i++) { if (DNTRequest.GetFormString("id" + i) != "") { try { if (!Identifys.AddIdentify(DNTRequest.GetString("name" + i), DNTRequest.GetString("file" + i))) { ok = false; } } catch { base.RegisterStartupScript("", "<script>alert('出现错误,可能名称超出长度!');window.location.href='forum_identifymanage.aspx';</script>"); } } } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "鉴定文件增加", ""); if (!ok) { base.RegisterStartupScript("", "<script>alert('某些记录未能插入,因为与数据库中原有的名称相同');window.location.href='forum_identifymanage.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>window.location.href='forum_identifymanage.aspx';</script>"); } #endregion }
private void DelRec_Click(object sender, EventArgs e) { #region 除公告 if (this.CheckCookie()) { if (DNTRequest.GetString("id") != "") { DatabaseProvider.GetInstance().DeleteAnnouncements(DNTRequest.GetString("id")); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AnnouncementList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/SimplifiedAnnouncementList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除公告", "删除公告,公告ID为: " + DNTRequest.GetString("id")); Response.Redirect("global_announcegrid.aspx"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='global_announcegrid.aspx';</script>"); } } #endregion }
private void DeleteAttachment_Click(object sender, EventArgs e) { #region 除选中的附件 if (this.CheckCookie()) { if (DNTRequest.GetString("aid") != "") { string aidlist = DNTRequest.GetString("aid"); DataTable dt = GetAttachDataTable(); foreach (DataRow dr in dt.Select("aid IN(" + aidlist + ")")) { DeleteFile(dr["filename"].ToString()); } //DbHelper.ExecuteNonQuery("DELETE FROM [" + BaseConfigs.GetTablePrefix + "attachments] WHERE [aid] IN(" + aidlist + ")"); DatabaseProvider.GetInstance().DeleteAttachment(aidlist); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除附件", "ID:" + aidlist); base.RegisterStartupScript("PAGE", "window.location.href='forum_searchattchment.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('您未选中任何选项');window.location.href='forum_searchattchment.aspx';</script>"); } } #endregion }
private void UpdateUserGroupInf_Click(object sender, EventArgs e) { #region 更新系统管理组信息 if (this.CheckCookie()) { userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(DNTRequest.GetInt("groupid", -1)); userGroupInfo.System = 0; userGroupInfo.Type = 0; userGroupInfo.Readaccess = Convert.ToInt32(readaccess.Text); userGroupInfo.Allowviewstats = 0; userGroupInfo.Allownickname = 0; userGroupInfo.Allowhtml = 0; userGroupInfo.Allowcstatus = 0; userGroupInfo.Allowuseblog = 0; userGroupInfo.Allowinvisible = 0; userGroupInfo.Allowtransfer = 0; userGroupInfo.Allowmultigroups = 0; userGroupInfo.Reasonpm = 0; //if (radminid.SelectedValue == "0") //当未选取任何管理模板时 //{ // Discuz.Forum.AdminGroups.DeleteAdminGroupInfo((short)userGroupInfo.Groupid); // userGroupInfo.Radminid = 0; //} Users.UpdateUserAdminIdByGroupId(userGroupInfo.Radminid, userGroupInfo.Groupid); userGroupInfo.Grouptitle = groupTitle.Text; userGroupInfo.Creditshigher = Convert.ToInt32(creditshigher.Text); userGroupInfo.Creditslower = Convert.ToInt32(creditslower.Text); userGroupInfo.Stars = Convert.ToInt32(stars.Text); userGroupInfo.Color = color.Text; userGroupInfo.Groupavatar = groupavatar.Text; userGroupInfo.Maxprice = Convert.ToInt32(maxprice.Text); userGroupInfo.Maxpmnum = Convert.ToInt32(maxpmnum.Text); userGroupInfo.Maxsigsize = Convert.ToInt32(maxsigsize.Text); userGroupInfo.Maxattachsize = Convert.ToInt32(maxattachsize.Text); userGroupInfo.Maxsizeperday = Convert.ToInt32(maxsizeperday.Text); userGroupInfo.Maxspaceattachsize = Convert.ToInt32(maxspaceattachsize.Text); userGroupInfo.Maxspacephotosize = Convert.ToInt32(maxspacephotosize.Text); userGroupInfo.Attachextensions = attachextensions.GetSelectString(","); usergrouppowersetting.GetSetting(ref userGroupInfo); if (AdminUserGroups.UpdateUserGroupInfo(userGroupInfo)) { Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UserGroupList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台更新系统组", "组ID:" + DNTRequest.GetInt("groupid", -1)); base.RegisterStartupScript("PAGE", "window.location.href='global_sysadminusergroupgrid.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_sysadminusergroupgrid.aspx';</script>"); } } #endregion }