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 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 }
/// <summary> /// 升级表和存储过程的方法 /// </summary> private void UpgradeProcess() { //当数据库不是Sql Server不允许升级 if (baseconfig.Dbtype != "SqlServer") { return; } //将首页默认定为论坛首页 GeneralConfigs.GetConfig().Forumurl = "forumindex.aspx"; GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config")); //获取升级脚本的文件夹 string upgradeSqlScriptPath = string.Format("sqlscript/{0}/", baseconfig.Dbtype.ToString().Trim()); string upgradeTableScriptFileName = Server.MapPath(string.Format("{0}upgradetable{1}.sql", upgradeSqlScriptPath, rblBBSVersion.SelectedValue)); string upgradeProcedureScriptFileName = Server.MapPath(string.Format("{0}upgradeprocedure_2000.sql", upgradeSqlScriptPath)); if (DbHelper.ExecuteScalar(CommandType.Text, "SELECT @@VERSION").ToString().Substring(20, 24).IndexOf("2000") == -1) //查询SQLSERVER的版本 { upgradeProcedureScriptFileName = Server.MapPath(string.Format("{0}upgradeprocedure_2005.sql", upgradeSqlScriptPath)); } //升级脚本不存在 if (!File.Exists(upgradeTableScriptFileName) || !File.Exists(upgradeProcedureScriptFileName)) { return; } //升级表 UpgradeTable(upgradeTableScriptFileName); //升级存储过程 UpgradeProcedure(upgradeProcedureScriptFileName); }
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 RefreshConfigMaxCateId(int id) { var config = Configinfo; config.MaxCategoryId = id; GeneralConfigs.Serialiaze(config, Server.MapPath(WebUtils.GetWebConfigPath())); }
private void RefreshConfigVersionNo() { var config = Configinfo; config.VersionNo = DateTime.Now.ToString("yyyyMMddhhmmss"); GeneralConfigs.Serialiaze(config, Server.MapPath(WebUtils.GetWebConfigPath())); DataCache.RemoveCache("CategoriesInfoCache"); }
/// <summary> /// 保存屏蔽特殊字符列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveAntiPamReplacement_Click(object sender, EventArgs e) { config.Antispamreplacement = antipamreplacement.Text; GeneralConfigs.Serialiaze(config, Server.MapPath("../../config/general.config")); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "屏蔽特殊字符", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_wordgrid.aspx';"); }
private void DeleteUserGroupInf_Click(object sender, EventArgs e) { #region 除相关组信息 if (this.CheckCookie()) { if (AdminUserGroups.DeleteUserGroupInfo(DNTRequest.GetInt("groupid", -1))) { //删除举报组 GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); string tempstr = ""; foreach (string report in configInfo.Reportusergroup.Split(',')) { if (report != userGroupInfo.Groupid.ToString()) { if (tempstr == "") { tempstr = report; } else { tempstr += "," + report; } } } configInfo.Reportusergroup = tempstr; tempstr = ""; foreach (string photomangegroup in configInfo.Photomangegroups.Split(',')) { if (photomangegroup != userGroupInfo.Groupid.ToString()) { if (tempstr == "") { tempstr = photomangegroup; } else { tempstr += "," + photomangegroup; } } } configInfo.Photomangegroups = tempstr; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/AdminGroupList"); Discuz.Forum.AdminGroups.GetAdminGroupList(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "后台删除管理组", "组ID:" + DNTRequest.GetInt("groupid", -1)); base.RegisterStartupScript("PAGE", "window.location.href='global_adminusergroupgrid.aspx';"); } else { base.RegisterStartupScript("", "<script>alert('操作失败');window.location.href='global_adminusergroupgrid.aspx';</script>"); } } #endregion }
private void OpenMall(int fid) { GeneralConfigInfo configInfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); if (fid != 0 && configInfo.Enablemall == 0) { configInfo.Enablemall = 1; GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); } }
/// <summary> /// 修改分享站点列表 /// </summary> private void UpgradeGeneralConfig() { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); if (!configInfo.Sharelist.Contains("百度收藏")) { configInfo.Sharelist += ",5|qq|qq书签|1,6|google|google书签|1,7|vivi|爱问收藏|1,8|live|live收藏|1,9|favorite|收藏夹|1,10|baidu|百度收藏|1"; } GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../config/general.config")); }
/// <summary> /// 返回最新未使用的凭证号 /// </summary> /// <returns></returns> public static string GetNewNum() { GeneralConfigInfo ManageConfig = GeneralConfigs.GetConfig(); ManageConfig.CertificateCode = (Convert.ToInt32(Config.GeneralConfigs.GetConfig().CertificateCode.Trim()) + 1).ToString(); GeneralConfigs.Serialiaze(ManageConfig, Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config")); BaseConfigs.ResetConfig(); return(ManageConfig.CertificateCode); }
/// <summary> /// 返回最新未使用单据号 /// </summary> /// <returns></returns> public static string GetNewOrderNum() { GeneralConfigInfo ManageConfig = GeneralConfigs.GetConfig(); ManageConfig.OrderID = (Convert.ToInt64(Config.GeneralConfigs.GetConfig().OrderID.Trim()) + 1).ToString(); GeneralConfigs.Serialiaze(ManageConfig, Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config")); BaseConfigs.ResetConfig(); return(ManageConfig.OrderID); }
private void RestoreInf_Click(object sender, EventArgs e) { if (this.CheckCookie()) { GeneralConfigInfo __configinfo = AdminConfigs.GetConfig(); 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_restoresetupinf.aspx';"); } }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { string resultMessage = ""; if (EnableSpace.SelectedValue == "1" && !Databases.IsExistTable("spaceconfigs")) { resultMessage = "您未能正确安装空间插件的数据库表"; } if (EnableAlbum.SelectedValue == "1" && !Databases.IsExistTable("albums")) { resultMessage += (resultMessage != "" ? "\\r\\n" : "") + "您未能正确安装相册插件的数据库表"; } if (resultMessage != "") { base.RegisterStartupScript("", "<script>alert('" + resultMessage + "');location.href=location.href;</script>"); return; } GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Forumtitle = forumtitle.Text; configInfo.Webtitle = webtitle.Text; configInfo.Weburl = weburl.Text; configInfo.Licensed = TypeConverter.StrToInt(licensed.SelectedValue); configInfo.Icp = icp.Text; configInfo.Debug = TypeConverter.StrToInt(debug.SelectedValue); configInfo.Statcode = Statcode.Text; configInfo.Linktext = Linktext.Text; configInfo.Spacename = spacename.Text; configInfo.Albumname = albumname.Text; configInfo.Closed = TypeConverter.StrToInt(closed.SelectedValue); configInfo.Closedreason = closedreason.Text; configInfo.Enablespace = Convert.ToInt32(EnableSpace.SelectedValue); configInfo.Enablealbum = Convert.ToInt32(EnableAlbum.SelectedValue); //configInfo.Enablemall = Convert.ToInt32(EnableMall.SelectedValue); //bool message = Databases.IsExistTable("albums"); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); if (configInfo.Aspxrewrite == 1) { AdminForums.SetForumsPathList(true, configInfo.Extname); } else { AdminForums.SetForumsPathList(false, configInfo.Extname); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); Discuz.Forum.TopicStats.SetQueueCount(); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "站点设置", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_siteset.aspx';"); } #endregion }
protected virtual void Page_Load(object sender, EventArgs e) { if (this.userid > 0) { if (CheckUserPopedoms("X")) { Act = HTTPRequest.GetString("Act"); if (!ispost) { ManageConfig = GeneralConfigs.GetConfig(); if (ManageConfig == null) { AddErrLine("获取配置信息发生错误.<br>"); } else { dList = M_Utils.GetM_ConfigInfoList(" 1=1 order by m_ConfigInfoID desc").Tables[0]; } } else { try { ManageConfig = GeneralConfigs.GetConfig(); ManageConfig.Taobao_Open = HTTPRequest.GetInt("Taobao_Open", 0); ManageConfig.Taobao_SandBox = HTTPRequest.GetInt("Taobao_SandBox", 1); GeneralConfigs.Serialiaze(ManageConfig, Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config")); BaseConfigs.ResetConfig(); Caches.ReSet(); AddMsgLine("提交成功!"); SetBackLink("mconfig.aspx?r=" + Utils.GetRanDomCode()); SetMetaRefresh(1, "mconfig.aspx?r=" + Utils.GetRanDomCode()); } catch (Exception ex) { AddErrLine("提交时发生错误:<br>" + ex.Message.ToString()); } } } else { AddErrLine("权限不足!"); AddScript("window.parent.HidBox();"); } } else { AddErrLine("请先登录!"); SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer())); } }
private void UpdateShare_Click(object sender, EventArgs e) { StringBuilder shareList = new StringBuilder(); string[] newDisplayOrder = DNTRequest.GetFormString("newdisplayorder").Split(','); string[] title = DNTRequest.GetFormString("title").Split(','); string[] site = DNTRequest.GetFormString("site").Split(','); string[] newDisplayOrder_clone = DNTRequest.GetFormString("newdisplayorder").Split(','); string[] shareDisable = DNTRequest.GetFormString("sharedisable").Split(','); if (Utils.IsNumericArray(newDisplayOrder)) { newDisplayOrder_clone = InsertionSort(newDisplayOrder_clone); for (int i = 0; i < newDisplayOrder_clone.Length; i++) { for (int j = 0; j < newDisplayOrder.Length; j++) { if (newDisplayOrder_clone[i] == newDisplayOrder[j]) { if (TypeConverter.StrToInt(newDisplayOrder[j]) < 0) { shareList.Append("0"); } else { shareList.Append(newDisplayOrder[j]); } shareList.Append("|"); shareList.Append(site[j]); shareList.Append("|"); shareList.Append(title[j]); shareList.Append("|"); if (Utils.InArray(site[j], shareDisable)) { shareList.Append("1"); } else { shareList.Append("0"); } shareList.Append(","); break; } } } GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Sharelist = shareList.ToString().TrimEnd(','); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); } base.RegisterStartupScript("PAGE", "window.location.href='global_sharelistgrid.aspx';"); }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { Hashtable HT = new Hashtable(); HT.Add("最大在线人数", maxonlines.Text); HT.Add("发帖灌水预防", postinterval.Text); HT.Add("搜索时间限制", searchctrl.Text); HT.Add("60 秒最大搜索次数", maxspm.Text); foreach (DictionaryEntry de in HT) { if (!Utils.IsInt(de.Value.ToString())) { base.RegisterStartupScript("", "<script>alert('输入错误:" + de.Key.ToString().Trim() + ",只能是0或者正整数');window.location.href='global_safecontrol.aspx';</script>"); return; } } if (disablepostad.SelectedValue == "1" && disablepostadregular.Text == "") { base.RegisterStartupScript("", "<script>alert('新用户广告强力屏蔽正则表达式为空');window.location.href='forum_option.aspx';</script>"); return; } GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.VerifyImageAssemly = VerifyImage.SelectedValue; configInfo.Maxonlines = Convert.ToInt32(maxonlines.Text); configInfo.Postinterval = Convert.ToInt32(postinterval.Text); configInfo.Searchctrl = Convert.ToInt32(searchctrl.Text); configInfo.Seccodestatus = seccodestatus.Text.Trim().Replace("\r\n", ","); configInfo.Maxspm = Convert.ToInt32(maxspm.Text); configInfo.Secques = Convert.ToInt32(secques.SelectedValue); configInfo.Admintools = Convert.ToInt16(admintools.SelectedValue); configInfo.Antispamregisterusername = antispamusername.Text.Trim(); configInfo.Antispamregisteremail = antispamemail.Text.Trim(); configInfo.Antispamposttitle = antispamtitle.Text.Trim(); configInfo.Antispampostmessage = antispammessage.Text.Trim(); configInfo.Disablepostad = Convert.ToInt16(disablepostad.SelectedValue); configInfo.Disablepostadregminute = Convert.ToInt16(disablepostadregminute.Text); configInfo.Disablepostadpostcount = Convert.ToInt16(disablepostadpostcount.Text); configInfo.Disablepostadregular = disablepostadregular.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_safecontrol.aspx';"); } #endregion }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Bbcodemode = TypeConverter.StrToInt(bbcodemode.SelectedValue); configInfo.Defaulteditormode = TypeConverter.StrToInt(defaulteditormode.SelectedValue); configInfo.Allowswitcheditor = TypeConverter.StrToInt(allowswitcheditor.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_editorset.aspx';"); } #endregion }
/// <summary> /// 升级 /// </summary> protected void UpgradeProcess() { //当数据库不是Sql Server不允许升级 if (baseconfig.Dbtype != "SqlServer") { ShowErrorMessage("你的论坛不是Sql Server版本,不能用此程序升级"); return; } try { //将首页默认定为论坛首页 GeneralConfigs.GetConfig().Forumurl = "forumindex.aspx"; GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config")); if (Utils.ASSEMBLY_VERSION != GetForumVersion()) { //升级表 UpgradeTable(); //升级分表 UpgradeDetachTable(); //升级存储过程 UpgradeProcedure(); //数据库升级完毕后工作 UpgradeConfig(); MoveCommonUpgradeIniConfig(); //生成后台菜单 MenuManage.CreateMenuJson(); //重新设置最新的论坛版本 SetForumVersion(); ShowMessage("安装成功,点击\"完成\"进入首页......"); } else { ShowMessage("您的论坛已经最新版本,无需要升级,点击\"完成\"进入首页......"); } //升级完成 Succeed(); } catch (ThreadAbortException e) { ShowErrorMessage("升级过程中出现异常,升级将程序终止。请参照错误信息提示修改错误再刷新重试。如果无法解决,请<a href=\'http://nt.discuz.net/support/\' target=\'_blank\' style=\'color:red;\'>点击这里</a>进行反馈。"); return; } catch (Exception e) { ShowErrorMessage("升级过程中出现异常:" + e.Message); return; } }
public ActionResult AdminBaseConfig(GeneralConfigInfo model) { try { var config = Configinfo; config.Webtitle = model.Webtitle; config.Icp = model.Icp; config.IndexPagerCount = model.IndexPagerCount; config.CatePagerCount = model.CatePagerCount; config.CommentPagerCount = model.CommentPagerCount; config.NotePagerCount = model.NotePagerCount; config.ForumPagerCount = model.ForumPagerCount; config.ThreadPagerCount = model.ThreadPagerCount; config.WebDescription = WebUtils.MyString(model.WebDescription).Replace("\r\n", "<br>"); config.ThumbnailInfo = model.ThumbnailInfo; config.Theme = model.Theme; config.DefaultLang = model.DefaultLang; config.WebContentLang = model.WebContentLang; config.MaxSummaryCharCount = model.MaxSummaryCharCount; config.AdminEmail = model.AdminEmail; config.SmtpServer = model.SmtpServer; config.SmtpUser = model.SmtpUser; config.SmtpPass = model.SmtpPass; config.SmtpPort = model.SmtpPort; config.IfSendReplyEmail = model.IfSendReplyEmail; config.IfWebStatic = model.IfWebStatic; config.IfHtmlCreated = model.IfHtmlCreated; config.WebStaticFolderPart1 = model.WebStaticFolderPart1.Trim('/'); config.WebStaticFolderPart2 = string.IsNullOrEmpty(model.WebStaticFolderPart2) ? "" : model.WebStaticFolderPart2.Trim(); config.WebStaticFolder = config.WebStaticFolderPart1 + "/{lang}/" + config.WebStaticFolderPart2; config.WebLangList = model.WebLangList; config.UserPermission = model.UserPermission; config.IfValidateCode = model.IfValidateCode; config.IfPagingAjax = model.IfPagingAjax; config.IfIndependentContentViaLang = model.IfIndependentContentViaLang; config.LangTemplateStr = model.LangTemplateStr; config.Logo = model.Logo; //WebUtils.ChangeTheme(WebUtils.GetLangTemplate(model.DefaultLang, model.LangTemplateStr)); //var cultureinfo = new CultureInfo(model.DefaultLang == "zh-cn" ? "" : Configinfo.DefaultLang); //System.Web.HttpContext.Current.Session["CurrentLanguage"] = cultureinfo; GeneralConfigs.Serialiaze(config, Server.MapPath(WebUtils.GetWebConfigPath())); } catch (Exception) { return(Content(res.ModifyFailed + " <a href=\"" + Url.Action("AdminBaseConfig", "Admin") + "\">" + res.ContinueModify + "</a>", "text/html;charset=UTF-8")); } return(Content(res.ModifiedSuccessfully + " <a href=\"" + Url.Action("AdminBaseConfig", "Admin") + "\">" + res.ContinueModify + "</a>", "text/html;charset=UTF-8")); }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); ; 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_userrights.aspx';"); } #endregion }
protected void Page_Load(object sender, EventArgs e) { configInfo = GeneralConfigs.GetConfig(); dsSrc.ReadXml(Server.MapPath("../../config/forumhot.config")); if (action == "editsave" && id != -1) { EditSave(); //base.RegisterStartupScript("page", "window.location.href='forum_forumhot.aspx';"); Response.Redirect("forum_forumhot.aspx"); } if (action == "closeforumhot") { configInfo.Disableforumhot = TypeConverter.StrToInt(DNTRequest.GetString("forumhot")); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); Response.Redirect("forum_forumhot.aspx"); } }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存设置信息 if (this.CheckCookie()) { GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config")); __configinfo.Enablemall = Convert.ToInt16(EnableMall.SelectedValue); __configinfo.Gpp = Convert.ToInt16(gpp.Text); GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("../../config/general.config")); base.RegisterStartupScript("PAGE", "window.location.href='mall_mallsetting.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); if (extname.Text.Trim() == "") { base.RegisterStartupScript("", "<script>alert('您未输入相应的伪静态url扩展名!');</script>"); return; } configInfo.Extname = extname.Text.Trim(); if (configInfo.Aspxrewrite == 1) { AdminForums.SetForumsPathList(true, configInfo.Extname); } else { AdminForums.SetForumsPathList(false, configInfo.Extname); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); configInfo.Iisurlrewrite = Convert.ToInt16(iisurlrewrite.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 }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //插件是否可以安装检测 //if (Discuz.Plugin.Space.SpacePluginProvider.GetInstance() != null || // Discuz.Plugin.Album.AlbumPluginProvider.GetInstance() != null || // Discuz.Plugin.Mall.MallPluginProvider.GetInstance() != null) //{ // showInstallPluginLink = true; // return; //} userID = Request.Form["adminName"]; password = Request.Form["adminPassword"]; GeneralConfigInfo config = GeneralConfigs.GetConfig(); config.Installation = 1; GeneralConfigs.Serialiaze(config, Server.MapPath("../config/general.config")); } }
private void RemoveTemplateInDB(string templateidlist, string tempstr) { #region 移除模板 GeneralConfigInfo __configinfo = GeneralConfigs.GetConfig(); if (tempstr.IndexOf("," + __configinfo.Templateid + ",") >= 0) //当要删除的模板是系统的默认模板时 { __configinfo.Templateid = 1; } GeneralConfigs.Serialiaze(__configinfo, AppDomain.CurrentDomain.BaseDirectory + "config/general.config"); DatabaseProvider.GetInstance().UpdateForumAndUserTemplateId(templateidlist); AdminTemplates.DeleteTemplateItem(templateidlist); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateIDList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/TemplateListBoxOptions"); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "从数据库中删除模板文件", "ID为:" + DNTRequest.GetString("templateid").Replace("0 ", "").Trim()); #endregion }
private static bool SerialiazeTest() { try { string configPath = HttpContext.Current.Server.MapPath("/config/general.config"); GeneralConfigInfo __configinfo = new GeneralConfigInfo(); if (!File.Exists(configPath)) { GeneralConfigs.Serialiaze(__configinfo, configPath); } __configinfo = GeneralConfigs.Deserialize(configPath); //__configinfo.IcpInfo =""; GeneralConfigs.Serialiaze(__configinfo, configPath); return(true); } catch { return(false); } }
/// <summary> /// 将模板从数据库中移除 /// </summary> /// <param name="templateIdList">要移除的模板Id列表</param> /// <param name="uid">操作者的Uid</param> /// <param name="userName">操作者的用户名</param> /// <param name="groupId">操作者的组Id</param> /// <param name="groupTitle">操作者的组名称</param> /// <param name="ip">操作者的Ip</param> public static void RemoveTemplateInDB(string templateIdList, int uid, string userName, int groupId, string groupTitle, string ip) { #region 移除模板 GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); if (("," + templateIdList + ",").IndexOf("," + configInfo.Templateid + ",") >= 0) //当要删除的模板是系统的默认模板时 { configInfo.Templateid = 1; } GeneralConfigs.Serialiaze(configInfo, Utils.GetMapPath("../../config/general.config")); Data.Forums.UpdateForumAndUserTemplateId(templateIdList); Data.Templates.DeleteTemplateItem(templateIdList); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/TemplateIDList"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/TemplateListBoxOptionsForForumIndex"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/TemplateListBoxOptions"); AdminVistLogs.InsertLog(uid, userName, groupId, groupTitle, ip, "从数据库中删除模板文件", "ID为:" + templateIdList); #endregion }
private void SaveInfo_Click(object sender, EventArgs e) { #region 保存信息 if (this.CheckCookie()) { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Forumtitle = forumtitle.Text; configInfo.Webtitle = webtitle.Text; configInfo.Weburl = weburl.Text; configInfo.Licensed = TypeConverter.StrToInt(licensed.SelectedValue); configInfo.Icp = icp.Text; configInfo.Debug = TypeConverter.StrToInt(debug.SelectedValue); configInfo.Statcode = Statcode.Text; configInfo.Linktext = Linktext.Text; configInfo.Spacename = spacename.Text; configInfo.Albumname = albumname.Text; configInfo.Closed = TypeConverter.StrToInt(closed.SelectedValue); configInfo.Closedreason = closedreason.Text; configInfo.Enablespace = Convert.ToInt32(EnableSpace.SelectedValue); configInfo.Enablealbum = Convert.ToInt32(EnableAlbum.SelectedValue); configInfo.Enablemall = Convert.ToInt32(EnableMall.SelectedValue); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); Urls.config = configInfo; if (configInfo.Aspxrewrite == 1) { AdminForums.SetForumsPathList(true, configInfo.Extname); } else { AdminForums.SetForumsPathList(false, configInfo.Extname); } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); Discuz.Forum.TopicStats.SetQueueCount(); Caches.ReSetConfig(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "站点设置", ""); base.RegisterStartupScript("PAGE", "window.location.href='global_siteset.aspx';"); } #endregion }
/// <summary> /// 初始化起始数据 /// </summary> /// <param name="adminName"></param> /// <param name="adminPassword"></param> /// <returns></returns> public static string InitialForumSource(string adminName, string adminPassword) { try { StringBuilder sb = new StringBuilder(); using (StreamReader objReader = new StreamReader(Utils.GetMapPath(dbScriptPath + "setup3.sql"), Encoding.UTF8)) { sb.Append(objReader.ReadToEnd()); objReader.Close(); } if (BaseConfigs.GetTablePrefix.ToLower() == "dnt_") { DbHelper.ExecuteNonQuery(CommandType.Text, sb.ToString()); } else { DbHelper.ExecuteNonQuery(CommandType.Text, sb.ToString().Replace("dnt_", BaseConfigs.GetTablePrefix)); } DbHelper.ExecuteNonQuery(CommandType.Text, string.Format("INSERT INTO [{0}users] ([username],[nickname],[password],[adminid],[groupid],[invisible],[email]) VALUES('{1}','{1}','{2}','1','1','0','')", BaseConfigs.GetTablePrefix, adminName, Utils.MD5(adminPassword))); DbHelper.ExecuteNonQuery(CommandType.Text, "INSERT INTO [" + BaseConfigs.GetTablePrefix + "userfields] ([uid]) VALUES('1')"); //将论坛是否执行安装程序的状态改为1(已安装) GeneralConfigInfo config = GeneralConfigs.GetConfig(); config.Installation = 1; GeneralConfigs.Serialiaze(config, Utils.GetMapPath("../config/general.config")); GeneralConfigs.ResetConfig(); //写入版本信息 string filePath = Utils.GetMapPath("../config/forumversion.config"); File.WriteAllText(filePath, Discuz.Common.Utils.ASSEMBLY_VERSION); return("{result:true,message:\"数据初始化完毕\"}"); } catch (Exception e) { return("{result:false,message:\"初始化过程出现错误(" + JsonCharFilter(e.Message) + ")\"}"); } }