protected void Page_Load(object sender, EventArgs e) { config = GeneralConfigs.GetConfig(); // 如果IP访问列表有设置则进行判断 if (config.Adminipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { Context.Response.Redirect("syslogin.aspx"); return; } } #region 进行权限判断 int userid = Discuz.Forum.Users.GetUserIDFromCookie(); if (userid <= 0) { Context.Response.Redirect("syslogin.aspx"); return; } UserInfo u = Discuz.Forum.Users.GetUserInfo(userid); if (u.Adminid > 0 && u.Groupid > 0) { return; } else { Context.Response.Redirect("syslogin.aspx"); return; } #endregion }
public string GetHtmlTemplateByHandlers(string ColumnMode, string ColumnID, string SearchWord, string SeSearchWord) { GeneralConfigInfo gi = GeneralConfigs.GetConfig(); if (gi.StartTemplateMap) { HttpContext Context = HttpContext.Current; string channelUrl = We7Helper.GetChannelUrlFromUrl(Context.Request.RawUrl); string htmlTemplate = We7Helper.GetParamValueFromUrl(Context.Request.RawUrl, "template"); if (String.IsNullOrEmpty(htmlTemplate)) { if (channelUrl == "/" && ColumnMode == "") { htmlTemplate = GetHtmlTemplatePath("welcome"); if (!File.Exists(HttpContext.Current.Server.MapPath(htmlTemplate))) { htmlTemplate = GetHtmlTemplatePath("index"); if (!File.Exists(HttpContext.Current.Server.MapPath(htmlTemplate))) { return(GetTemplateByHandlers(ColumnMode, ColumnID, SearchWord, SeSearchWord)); } } } else { htmlTemplate = GetHtmlTemplatePath(channelUrl.Trim('/').Trim('\\') + "/" + (String.IsNullOrEmpty(ColumnMode)?"index":ColumnMode)); if (!File.Exists(HttpContext.Current.Server.MapPath(htmlTemplate))) { return(GetTemplateByHandlers(ColumnMode, ColumnID, SearchWord, SeSearchWord)); } } } return(htmlTemplate); } else { return(GetThisHtmlPageTemplate(ColumnMode, ColumnID, SearchWord, SeSearchWord)); } }
/// <summary> /// 获得上传路径 /// </summary> /// <param name="filename">文件名</param> /// <param name="forumid">论坛版块id</param> /// <returns>返回上传路径</returns> private string GetUploadFolder(string filename, string forumid) { GeneralConfigInfo config = GeneralConfigs.GetConfig(); Random random = new Random(unchecked ((int)DateTime.Now.Ticks)); string UploadDir = Utils.GetMapPath(BaseConfigs.GetForumPath + "upload/"); string savedir = GetDirInfo(filename, forumid); // 如果指定目录不存在则建立 if (!Directory.Exists(UploadDir + savedir)) { Utils.CreateDir(UploadDir + savedir); } // 如果临时目录不存在则建立 if (!Directory.Exists(UploadDir + "\\temp\\")) { Utils.CreateDir(UploadDir + "\\temp\\"); } return(UploadDir + savedir); }
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")); 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 void Page_Load(object sender, EventArgs e) { HelperFactory helperFactory = HelperFactory.Instance; TemplateHelper TemplateHelper = helperFactory.GetHelper <TemplateHelper>(); string editorUrl = "/admin/DataControlUI/Compose.aspx"; if (GeneralConfigs.GetConfig().DefaultTemplateEditor == "1") { editorUrl = "/admin/VisualTemplate/TemplateCreate.aspx"; } string bindName = string.Format("handler={0}&mode={1}&model={2}", BindConfig.Handler, BindConfig.Mode, BindConfig.Model); string urlCompose = string.Format("{0}?{1}", editorUrl, bindName); TitleLabel.Text = "没有匹配的" + BindConfig.ModelText + BindConfig.Description + "模板"; ActionLiteral.Text = string.Format("<a href='{0}' target='_blank'>创建{1}(模板)</a>", urlCompose, BindConfig.ModelText + BindConfig.Description); if (string.IsNullOrEmpty(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName) || !Directory.Exists(TemplateHelper.DefaultTemplateGroupPath)) { HelpLiteral.Text = "您也可以到微七插件商场下载一套完整模板。<a href='http://m.we7.cn' target='_blank'>去下载</a>"; TemplateGroup[] tg = TemplateHelper.GetTemplateGroups(null); int count = tg.Length; if (count > 0) { string urlSelectTemplate = "/admin/TemplateGroups.aspx"; HelpLiteral.Text += string.Format("<br>本地有{0}套可用模板组,您没有选用,要选用一个吗?<a href='{1}' target='_blank'>选一个</a>", count.ToString(), urlSelectTemplate); } } else { Template[] tps = TemplateHelper.GetTemplates(null, Path.GetFileNameWithoutExtension(GeneralConfigs.GetConfig().DefaultTemplateGroupFileName)); if (tps.Length > 0) { string urlBindTemplate = string.Format("/admin/Template/TemplateGroupEdit.aspx?file={0}&tab=3", GeneralConfigs.GetConfig().DefaultTemplateGroupFileName); HelpLiteral.Text = string.Format("您已经创建了{0}个模板页了,是否已经创建本页模板但尚未指定?<a href='{1}' target='_blank'>去看一下</a>", tps.Length, urlBindTemplate); } } }
public void LoadConfigInfo() { #region 加载配置信息 GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); modworkstatus.SelectedValue = configInfo.Modworkstatus.ToString(); userstatusby.SelectedValue = (configInfo.Userstatusby.ToString() != "0") ? "1" : "0"; rssttl.Text = configInfo.Rssttl.ToString(); losslessdel.Text = configInfo.Losslessdel.ToString(); editedby.SelectedValue = configInfo.Editedby.ToString(); allowswitcheditor.SelectedValue = configInfo.Allowswitcheditor.ToString(); reasonpm.SelectedValue = configInfo.Reasonpm.ToString(); hottopic.Text = configInfo.Hottopic.ToString(); starthreshold.Text = configInfo.Starthreshold.ToString(); fastpost.SelectedValue = configInfo.Fastpost.ToString(); tpp.Text = configInfo.Tpp.ToString(); ppp.Text = configInfo.Ppp.ToString(); enabletag.SelectedValue = configInfo.Enabletag.ToString(); string[] ratevalveset = configInfo.Ratevalveset.Split(','); ratevalveset1.Text = ratevalveset[0]; ratevalveset2.Text = ratevalveset[1]; ratevalveset3.Text = ratevalveset[2]; ratevalveset4.Text = ratevalveset[3]; ratevalveset5.Text = ratevalveset[4]; statstatus.SelectedValue = configInfo.Statstatus.ToString(); hottagcount.Text = configInfo.Hottagcount.ToString(); maxmodworksmonths.Text = configInfo.Maxmodworksmonths.ToString(); replynotificationstatus.SelectedValue = configInfo.Replynotificationstatus.ToString(); replyemailstatus.SelectedValue = configInfo.Replyemailstatus.ToString(); //allowforumindexposts.SelectedValue = configInfo.Allwoforumindexpost.ToString();首页快速发主题的功能 quickforward.SelectedValue = configInfo.Quickforward.ToString(); viewnewtopicminute.Text = configInfo.Viewnewtopicminute.ToString(); rssstatus.SelectedValue = configInfo.Rssstatus.ToString(); msgforwardlist.Text = configInfo.Msgforwardlist.Replace(",", "\r\n"); cachelog.SelectedValue = configInfo.Cachelog.ToString(); silverlight.SelectedValue = config.Silverlight.ToString(); #endregion }
/// <summary> /// 升级表和存储过程的方法 /// </summary> private void UpgradeProcess() { //当数据库不是Sql Server不允许升级 if (baseconfig.Dbtype != "SqlServer") { return; } try { //将首页默认定为论坛首页 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); } catch (Exception e) { Response.Write("{\"Result\":false,\"Message\":\"" + e.Message + "\"}"); Response.End(); } }
/// <summary> /// 检查general.config中的当前模板组是否物理存在 /// </summary> /// <returns></returns> public string GetCurrentExistTemplateGroup() { string currentTemplateGroupName = GeneralConfigs.GetConfig().DefaultTemplateGroupFileName; if (!string.IsNullOrEmpty(currentTemplateGroupName)) { string groupName = currentTemplateGroupName.Replace(".xml", ""); string groupXmlPath = HttpContext.Current.Server.MapPath("/" + string.Format("{0}\\{1}", Constants.SiteSkinsBasePath, currentTemplateGroupName)); string groupPath = HttpContext.Current.Server.MapPath("/" + string.Format("{0}\\{1}", Constants.SiteSkinsBasePath, groupName)); if (File.Exists(groupXmlPath) && Directory.Exists(groupPath)) { return(currentTemplateGroupName); } else { GeneralConfigInfo config = GeneralConfigs.GetConfig(); config.DefaultTemplateGroupFileName = ""; GeneralConfigs.SaveConfig(config); GeneralConfigs.ResetConfig(); } } return(string.Empty); }
protected void Page_Load(object sender, EventArgs e) { //更新在线表相关用户信息 config = GeneralConfigs.GetConfig(); OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); if (AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid).Radminid != 1) { HttpContext.Current.Response.Redirect("../"); return; } int olid = oluserinfo.Olid; OnlineUsers.DeleteRows(olid); //清除Cookie ForumUtils.ClearUserCookie(); HttpCookie cookie = new HttpCookie("dntadmin"); HttpContext.Current.Response.AppendCookie(cookie); FormsAuthentication.SignOut(); }
private void SaveGeneralConfigInfo() { GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); configInfo.Attachrefcheck = Convert.ToInt32(attachrefcheck.SelectedValue); configInfo.Attachsave = Convert.ToInt32(attachsave.SelectedValue); configInfo.Watermarkstatus = DNTRequest.GetInt("watermarkstatus", 0); configInfo.Attachimgpost = Convert.ToInt32(attachimgpost.SelectedValue); configInfo.Watermarktype = Convert.ToInt16(watermarktype.SelectedValue); configInfo.Showattachmentpath = Convert.ToInt32(showattachmentpath.SelectedValue); configInfo.Attachimgmaxheight = Convert.ToInt32(attachimgmaxheight.Text); configInfo.Attachimgmaxwidth = Convert.ToInt32(attachimgmaxwidth.Text); configInfo.Attachimgquality = Convert.ToInt32(attachimgquality.Text); configInfo.Watermarktext = watermarktext.Text; configInfo.Watermarkpic = watermarkpic.Text; configInfo.Watermarkfontname = watermarkfontname.SelectedValue; configInfo.Watermarkfontsize = Convert.ToInt32(watermarkfontsize.Text); configInfo.Watermarktransparency = Convert.ToInt16(watermarktransparency.Text); GeneralConfigs.Serialiaze(configInfo, Server.MapPath("../../config/general.config")); AdminVistLogs.InsertLog(userid, username, usergroupid, grouptitle, ip, "附件设置", ""); }
/// <summary> /// 根据IP查找用户 /// </summary> /// <param name="ip">ip地址</param> /// <returns>用户信息</returns> public static string CheckRegisterDateDiff(string ip) { ShortUserInfo userinfo = Discuz.Data.Users.GetShortUserInfoByIP(ip); if (GeneralConfigs.GetConfig().Regctrl > 0 && userinfo != null) { int Interval = Utils.StrDateDiffHours(userinfo.Joindate, GeneralConfigs.GetConfig().Regctrl); if (Interval <= 0) { return("抱歉, 系统设置了IP注册间隔限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册"); } } if (GeneralConfigs.GetConfig().Ipregctrl.Trim() != "" && Utils.InIPArray(DNTRequest.GetIP(), Utils.SplitString(GeneralConfigs.GetConfig().Ipregctrl, "\n")) && userinfo != null) { int Interval = Utils.StrDateDiffHours(userinfo.Joindate, 72); if (Interval < 0) { return("抱歉, 系统设置了特殊IP注册限制, 您必须在 " + (Interval * -1) + " 小时后才可以注册"); } } return(null); }
/// <summary> /// 自定义模块加载时的行为 /// </summary> /// <param name="content"></param> /// <returns></returns> public override string OnMouduleLoad(string content) { if (AlbumPluginProvider.GetInstance() == null || GeneralConfigs.GetConfig().Enablealbum != 1) { return("相册插件未安装,模块暂不可用"); } UserPrefsSaved userprefs = new UserPrefsSaved(this.Module.UserPref); int photocount = Utils.StrToInt(userprefs.GetValueByName("photocount"), 10); int albumid = Utils.StrToInt(userprefs.GetValueByName("albumid"), 0); List <PhotoInfo> photolist = DTOProvider.GetPhotoListByUserId(this.Module.Uid, albumid, photocount); StringBuilder sb = new StringBuilder(StaticFileProvider.GetContent(jsFile)); StringBuilder sbImgList = new StringBuilder(); for (int i = 0; i < photolist.Count; i++) { sbImgList.AppendFormat("data[\"-1_{0}\"] = \"img: {1}; url: {2}; target: _blank; \"\r\n", i + 1, BaseConfigs.GetForumPath + Discuz.Album.Globals.GetSquareImage(photolist[i].Filename), BaseConfigs.GetForumPath + "showalbumlist.aspx?uid=" + this.Module.Uid); } sb.Replace("{$templatepath}", BaseConfigs.GetForumPath + "templates/" + Templates.GetTemplateItem(GeneralConfigs.GetConfig().Templateid).Directory); sb.Replace("{$photolist}", sbImgList.ToString()); content = sb.ToString(); return(base.OnMouduleLoad(content)); }
/// <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(); return("{result:true,message:\"数据初始化完毕\"}"); } catch (Exception e) { return("{result:false,message:\"初始化过程出现错误(" + JsonCharFilter(e.Message) + ")\"}"); } }
/// <summary> /// 根据配置选择不同的模板选择器 /// </summary> /// <param name="ColumnMode"></param> /// <param name="ColumnID"></param> /// <param name="SearchWord"></param> /// <param name="SeSearchWord"></param> /// <returns></returns> public string GetTemplateByHandlers(string ColumnMode, string ColumnID, string SearchWord, string SeSearchWord) { GeneralConfigInfo gi = GeneralConfigs.GetConfig(); if (gi.StartTemplateMap) { HttpContext Context = HttpContext.Current; string channelUrl = We7Helper.GetChannelUrlFromUrl(Context.Request.RawUrl); string templatePath = We7Helper.GetParamValueFromUrl(Context.Request.RawUrl, "template"); if (string.IsNullOrEmpty(templatePath)) { if (channelUrl == "/" && ColumnMode == "") { templatePath = TemplateMap.GetTemplateFromMap("welcome", channelUrl); if (string.IsNullOrEmpty(templatePath)) { templatePath = templatePath = TemplateMap.GetTemplateFromMap("home", channelUrl); } } else { templatePath = TemplateMap.GetTemplateFromMap(ColumnMode, channelUrl); } if (!string.IsNullOrEmpty(templatePath)) { GeneralConfigInfo si = GeneralConfigs.GetConfig(); templatePath = GetTemplatePath(si.DefaultTemplateGroupFileName, templatePath); } } return(templatePath); } else { return(GetThisPageTemplate(ColumnMode, ColumnID, SearchWord, SeSearchWord)); } }
/// <summary> /// 保存模板信息 /// </summary> /// <param name="tp">模板信息</param> /// <param name="Templatefolder">模板文件夹</param> public void SaveTemplate(Template tp, string templatefolder) { string templatePath = DefaultTemplateGroupPath; SiteSettingHelper cdHelper = new SiteSettingHelper(); GeneralConfigInfo si = GeneralConfigs.GetConfig(); if (string.IsNullOrEmpty(templatefolder)) { templatefolder = si.DefaultTemplateGroupFileName; } else if (templatefolder.ToLower().EndsWith(".xml")) { templatefolder = templatefolder.Substring(0, templatefolder.Length - 4); } if (si.DefaultTemplateGroupFileName != templatefolder) { templatePath = String.Format("{0}\\{1}", Path.Combine(Root, Constants.TemplateBasePath), templatefolder); } else { templatePath = String.Format("{0}", DefaultTemplateGroupPath); } string fn = tp.FileName; fn += Constants.TemplateFileExtension; string target = Path.Combine(templatePath, fn); tp.ToFile(target); //清除模板列表缓存 HttpContext Context = HttpContext.Current; string key = string.Format(TemplatesKeyID, templatefolder); Context.Cache.Remove(key); }
/// <summary> /// 从云平台注册站点ID和KEY并保存在dzcloud.config中 /// </summary> /// <returns></returns> public static string RegisterSite() { DiscuzCloudConfigInfo config = DiscuzCloudConfigs.GetConfig(); DiscuzCloudMethodParameter mParams = new DiscuzCloudMethodParameter(); mParams.Add("sName", GeneralConfigs.GetConfig().Forumtitle); mParams.Add("sSiteKey", config.Sitekey); mParams.Add("sCharset", "utf-8"); mParams.Add("sTimeZone", "8"); mParams.Add("sLanguage", "zh_CN"); mParams.Add("sProductType", productType); mParams.Add("sProductVersion", productVersion); mParams.Add("sTimestamp", Utils.ConvertToUnixTimestamp(DateTime.Now).ToString()); mParams.Add("sApiVersion", "0.4"); mParams.Add("sSiteUid", BaseConfigs.GetFounderUid > 0 ? BaseConfigs.GetFounderUid.ToString() : "1"); mParams.Add("sProductRelease", PRODUCT_RELEASE); #if DEBUG mParams.Add("sUrl", "http://247.mydev.com/~cailong/"); mParams.Add("sUCenterUrl", "http://247.mydev.com/~cailong/"); #else mParams.Add("sUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath)); mParams.Add("sUCenterUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath)); #endif BaseCloudResponse <RegisterCloud> regCloudResult = GetCloudResponse <RegisterCloud>("site.register", mParams); if (regCloudResult.ErrCode == 0) { config.Cloudsiteid = regCloudResult.Result.CloudSiteId; config.Cloudsitekey = regCloudResult.Result.CloudSiteKey; DiscuzCloudConfigs.SaveConfig(config); DiscuzCloudConfigs.ResetConfig(); } return(regCloudResult.ErrMessage); }
public static void Init() { header = "<HEAD><title>安装" + GetAssemblyProductName() + "</title><meta http-equiv=\"Content-Type\" content=\"text/html\" charset=\"utf-8\">\r\n"; header += "<LINK rev=\"stylesheet\" media=\"all\" href=\"css/general.css\" type=\"text/css\" rel=\"stylesheet\">\r\n"; header += "<script type=\"text/javascript\" src=\"js/setup.js\"></script>\r\n"; GeneralConfigInfo gi = GeneralConfigs.GetConfig(); if (gi != null) { string copyright = gi.CopyrightOfWe7; if (gi.IsOEM) { copyright = gi.Copyright; } footer = string.Format("<div class='pubfooter'><p>{0}</p></div>", copyright); } else { footer = "<div class='pubfooter'><p>Powered by <a href=\"http://we7.cn/\" target=\"_blank\">" + GetAssemblyProductName() + "</a>"; footer += " ©" + GetAssemblyCopyright().Split(',')[0] + "<a href=\"http://www.westEngine.com/\" target=\"_blank\">WestEngine Inc.</a></p></div>"; } productName = GetAssemblyProductName(); }
/// <summary> /// 举报信息 /// </summary> /// <returns></returns> public static Hashtable GetReportUsers() { DNTCache cache = DNTCache.GetCacheService(); Hashtable ht = cache.RetrieveObject("/Forum/ReportUsers") as Hashtable; if (ht == null) { ht = new Hashtable(); string groupidlist = GeneralConfigs.GetConfig().Reportusergroup; if (!Utils.IsNumericList(groupidlist)) { return(ht); } DataTable dt = Discuz.Data.Users.GetUsers(groupidlist); for (int i = 0; i < dt.Rows.Count; i++) { ht[dt.Rows[i]["uid"]] = dt.Rows[i]["username"]; } cache.AddObject("/Forum/ReportUsers", ht); } return(ht); }
/// <summary> /// /// </summary> /// <returns></returns> public static Hashtable GetReportUsers() { DNTCache cache = DNTCache.GetCacheService(); Hashtable ht = cache.RetrieveObject("/ReportUsers") as Hashtable; if (ht == null) { ht = new Hashtable(); string groupidlist = GeneralConfigs.GetConfig().Reportusergroup; if (!Utils.IsNumericArray(groupidlist.Split(','))) { return(ht); } DataTable dt = DatabaseProvider.GetInstance().GetUsers(groupidlist); for (int i = 0; i < dt.Rows.Count; i++) { ht[dt.Rows[i]["uid"]] = dt.Rows[i]["username"]; } } return(ht); }
/// <summary> /// 返回在线用户列表 /// </summary> public static Discuz.Common.Generic.List <OnlineUserInfo> GetOnlineUserCollection() { Discuz.Common.Generic.List <OnlineUserInfo> coll = new Discuz.Common.Generic.List <OnlineUserInfo>(); if (appDBCache) { coll = IOnlineUserService.GetOnlineUserCollection(); } else { IDataReader reader = DatabaseProvider.GetInstance().GetOnlineUserList(); while (reader.Read()) { OnlineUserInfo onlineUserInfo = LoadSingleOnlineUser(reader); if (onlineUserInfo.Userid > 0 || (onlineUserInfo.Userid == -1 && GeneralConfigs.GetConfig().Whosonlinecontract == 0)) { onlineUserInfo.Actionname = UserAction.GetActionDescriptionByID((int)(onlineUserInfo.Action)); coll.Add(onlineUserInfo); } } reader.Close(); } //返回当前版块的在线用户表 return(coll); }
public void LoadConfigInfo() { #region 加载配置信息 GeneralConfigInfo configInfo = GeneralConfigs.GetConfig(); fulltextsearch.SelectedValue = configInfo.Fulltextsearch.ToString(); nocacheheaders.SelectedValue = configInfo.Nocacheheaders.ToString(); maxonlines.Text = configInfo.Maxonlines.ToString(); searchctrl.Text = configInfo.Searchctrl.ToString(); //postinterval.Text = configInfo.Postinterval.ToString(); //maxspm.Text = configInfo.Maxspm.ToString(); statscachelife.Text = configInfo.Statscachelife.ToString(); guestcachepagetimeout.Text = configInfo.Guestcachepagetimeout.ToString(); oltimespan.Text = configInfo.Oltimespan.ToString(); topiccachemark.Text = configInfo.Topiccachemark.ToString(); if (configInfo.Onlinetimeout >= 0) { showauthorstatusinpost.SelectedValue = "2"; } else { showauthorstatusinpost.SelectedValue = "1"; } #endregion }
/// <summary> /// 创建一个默认模板组 /// ~/_skin/Default /// </summary> public void CreateDefaultTemplateGroup() { //模板组名称:Default string groupName = "Default"; string folderPath = HttpContext.Current.Server.MapPath("/" + string.Format("{0}\\{1}", Constants.SiteSkinsBasePath, groupName)); //删除模板组 if (Directory.Exists(folderPath)) { DeleteTemplateGroup(folderPath); GeneralConfigInfo config = GeneralConfigs.GetConfig(); if (config.DefaultTemplateGroupFileName.ToLower() == groupName) { config.DefaultTemplateGroupFileName = ""; GeneralConfigs.SaveConfig(config); GeneralConfigs.ResetConfig(); } } //创建 SkinInfo Data = new SkinInfo(); Data.Name = groupName; Data.Description = "系统创建的默认模板组"; Data.Ver = GeneralConfigs.GetConfig().ProductVersion; string fileName = ""; if (CreateFolder(groupName)) { fileName = SaveSkinInfoAndPreviewFile(Data, groupName); GeneralConfigInfo config = GeneralConfigs.GetConfig(); config.DefaultTemplateGroupFileName = groupName + ".xml"; GeneralConfigs.SaveConfig(config); GeneralConfigs.ResetConfig(); } }
/// <summary> /// 保存信息 /// </summary> private void Save() { if (AppCtx.IsDemoSite) { return; } GeneralConfigInfo si = GeneralConfigs.GetConfig(); si.SiteTitle = ViewState["SiteTitle"].ToString(); si.Copyright = ViewState["Copyright"].ToString(); si.SiteFullName = ViewState["SiteFullName"].ToString(); si.IcpInfo = ViewState["IcpInfo"].ToString(); si.SiteLogo = ViewState["SiteLogo"].ToString(); lblSiteName.Text = ViewState["SiteTitle"].ToString(); GeneralConfigs.SaveConfig(si); //for (int i = 0; i < TemplateGroupsDataList.Items.Count; i++) //{ // RadioButton rad_selected = (RadioButton)TemplateGroupsDataList.Items[i].FindControl("rblTemplate").Controls[0]; // if (rad_selected.Checked) // { // //DoSomething // } //} }
/// <summary> /// 构造函数 /// </summary> public ArchiverPage() { config = GeneralConfigs.GetConfig(); if (config.Archiverstatus == 2 && DNTRequest.IsSearchEnginesGet())//启用,但当用户从搜索引擎点击时自动转向动态页面 { string url = OrganizeURL(HttpContext.Current.Request.Url); HttpContext.Current.Response.Redirect(url); } if (config.Archiverstatus == 3 && DNTRequest.IsBrowserGet()) //启用,但当用户使用浏览器访问时自动转向动态页面 { string url = OrganizeURL(HttpContext.Current.Request.Url); HttpContext.Current.Response.Redirect(url); } int onlineusercount = OnlineUsers.GetOnlineAllUserCount(); if (onlineusercount >= config.Maxonlines) { ShowError("抱歉,目前访问人数太多,你暂时无法访问论坛.", 0); } if (config.Nocacheheaders == 1) { HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); HttpContext.Current.Response.Expires = 0; HttpContext.Current.Response.CacheControl = "no-cache"; HttpContext.Current.Response.Cache.SetNoStore(); } OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); userid = oluserinfo.Userid; useradminid = oluserinfo.Adminid; // 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页 if (config.Closed == 1 && oluserinfo.Adminid != 1) { ShowError("", 1); } usergroupinfo = UserGroups.GetUserGroupInfo(oluserinfo.Groupid); // 如果不允许访问论坛则转向到tools/ban.htm if (usergroupinfo.Allowvisit != 1) { ShowError("抱歉, 您所在的用户组不允许访问论坛", 2); } // 如果IP访问列表有设置则进行判断 if (config.Ipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowError("抱歉, 系统设置了IP访问列表限制, 您无法访问本论坛", 0); return; } } // 如果IP访问列表有设置则进行判断 if (config.Ipdenyaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Ipdenyaccess, "\n"); if (Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { ShowError("由于您严重违反了论坛的相关规定, 已被禁止访问.", 2); return; } } // 如果当前用户请求页面不是登录页面并且当前用户非管理员并且论坛设定了时间段,当时间在其中的一个时间段内,则跳转到论坛登录页面 if (oluserinfo.Adminid != 1 && DNTRequest.GetPageName() != "login.aspx") { if (Scoresets.BetweenTime(config.Visitbanperiods)) { ShowError("在此时间段内不允许访问本论坛", 2); return; } } HttpContext.Current.Response.Write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n"); if (config.Seokeywords != "") { HttpContext.Current.Response.Write("<meta name=\"keywords\" content=\"" + config.Seokeywords + "\" />\r\n"); } if (config.Seodescription != "") { HttpContext.Current.Response.Write("<meta name=\"description\" content=\"" + config.Seodescription + "\" />\r\n"); } HttpContext.Current.Response.Write(config.Seohead.Trim()); HttpContext.Current.Response.Write("\r\n<link href=\"dntarchiver.css\" rel=\"stylesheet\" type=\"text/css\" />"); if (config.Archiverstatus == 0) { ShowError("系统禁止使用Archiver", 3); HttpContext.Current.Response.End(); return; } }
protected override void ShowPage() { //获取主题信息 topic = GetTopicInfo(); if (topic == null || IsErr()) { return; } topicid = topic.Tid; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); if (forum == null) { AddErrLine("不存在的版块ID"); return; } pagetitle = string.Format("{0} - {1}", topic.Title, Utils.RemoveHtml(forum.Name)); ///得到广告列表 GetForumAds(forum.Fid); // 检查是否具有版主的身份 if (useradminid != 0) { ismoder = Moderators.IsModer(useradminid, userid, forum.Fid) ? 1 : 0; admininfo = AdminGroups.GetAdminGroupInfo(usergroupid); //得到管理组信息 if (admininfo != null) { disablepostctrl = admininfo.Disablepostctrl; } } //验证不通过则返回 if (!ValidateInfo()) { return; } Caches.GetTopicTypeArray().TryGetValue(topic.Typeid, out topictypes); topictypes = topictypes != "" ? "[" + topictypes + "]" : ""; showratelog = GeneralConfigs.GetConfig().DisplayRateCount > 0 ? 1 : 0; score = Scoresets.GetValidScoreName(); scoreunit = Scoresets.GetValidScoreUnit(); //编辑器状态 EditorState(); navhomemenu = Caches.GetForumListMenuDivCache(usergroupid, userid, config.Extname); usesig = ForumUtils.GetCookie("sigstatus") == "0" ? 0 : 1; int price = 0; if (topic.Special != 4)//不是辩论帖,就跳转到showtopic页面显示 { HttpContext.Current.Response.Redirect(forumpath + this.ShowTopicAspxRewrite(topic.Tid, 1)); return; } if (topic.Moderated > 0) { moderactions = TopicAdmins.GetTopicListModeratorLog(topicid); } // 获取帖子总数 onlyauthor = Utils.StrIsNullOrEmpty(onlyauthor) ? "0" : onlyauthor; // 获取分页相关信息 BindPageCountAndId(); PostpramsInfo postpramsInfo = GetPostPramsInfo(price); //获取当前正反方列表 positivepostlist = Debates.GetPositivePostList(postpramsInfo, out attachmentlist, ismoder == 1); negativepostlist = Debates.GetNegativePostList(postpramsInfo, out attachmentlist, ismoder == 1); GetPostAds(postpramsInfo, positivepostlist.Count); //辩论帖 if (topic.Special == 4) { GetDebateInfo(postpramsInfo); } enabletag = (config.Enabletag & forum.Allowtag) == 1; if (enabletag) { relatedtopics = Topics.GetRelatedTopicList(topicid, 5); } //更新页面Meta信息 UpdateMetaInfo(Utils.RemoveHtml(debatepost.Message)); ///更新主题查看次数和在线用户信息 TopicStats.Track(topicid, 1); Topics.MarkOldTopic(topic); topicviews = topic.Views + 1 + (config.TopicQueueStats == 1 ? TopicStats.GetStoredTopicViewCount(topic.Tid) : 0); OnlineUsers.UpdateAction(olid, UserAction.ShowTopic.ActionID, forumid, forum.Name, topicid, topic.Title); BindDownloadAttachmentTip(); }
private UserInfo CreateUserInfo() { UserInfo userInfo = new UserInfo(); userInfo.Username = userName.Text; userInfo.Nickname = userName.Text; userInfo.Password = password.Text; userInfo.Secques = ""; userInfo.Gender = 0; int selectgroupid = Convert.ToInt32(groupid.SelectedValue); userInfo.Adminid = AdminUserGroups.AdminGetUserGroupInfo(selectgroupid).Radminid; userInfo.Groupid = selectgroupid; userInfo.Groupexpiry = 0; userInfo.Extgroupids = ""; userInfo.Regip = ""; userInfo.Joindate = Utils.GetDate(); userInfo.Lastip = ""; userInfo.Lastvisit = Utils.GetDate(); userInfo.Lastactivity = Utils.GetDate(); userInfo.Lastpost = Utils.GetDate(); userInfo.Lastpostid = 0; userInfo.Lastposttitle = ""; userInfo.Posts = 0; userInfo.Digestposts = 0; userInfo.Oltime = 0; userInfo.Pageviews = 0; userInfo.Credits = Convert.ToInt32(credits.Text); userInfo.Extcredits1 = 0; userInfo.Extcredits2 = 0; userInfo.Extcredits3 = 0; userInfo.Extcredits4 = 0; userInfo.Extcredits5 = 0; userInfo.Extcredits6 = 0; userInfo.Extcredits7 = 0; userInfo.Extcredits8 = 0; userInfo.Salt = "0"; //userInfo.Avatarshowid = 1; userInfo.Email = email.Text; userInfo.Bday = ""; userInfo.Sigstatus = 0; userInfo.Templateid = GeneralConfigs.GetConfig().Templateid; userInfo.Tpp = 16; userInfo.Ppp = 16; userInfo.Pmsound = 1; userInfo.Showemail = 1; userInfo.Newsletter = (ReceivePMSettingType)7; userInfo.Invisible = 0; userInfo.Newpm = 0; userInfo.Accessmasks = 0; //扩展信息 userInfo.Website = ""; userInfo.Icq = ""; userInfo.Qq = ""; userInfo.Yahoo = ""; userInfo.Msn = ""; userInfo.Skype = ""; userInfo.Location = ""; userInfo.Customstatus = ""; //userInfo.Avatar = ""; //userInfo.Avatarwidth = 32; //userInfo.Avatarheight = 32; userInfo.Medals = ""; userInfo.Bio = ""; userInfo.Signature = userName.Text; userInfo.Sightml = ""; userInfo.Authstr = ""; userInfo.Realname = realname.Text; userInfo.Idcard = idcard.Text; userInfo.Mobile = mobile.Text; userInfo.Phone = phone.Text; return(userInfo); }
protected void Origin_Page_Load(object sender, EventArgs e) { UserName.Attributes.Remove("class"); PassWord.Attributes.Remove("class"); UserName.AddAttributes("style", "width:200px"); PassWord.AddAttributes("style", "width:200px"); config = GeneralConfigs.GetConfig(); OnlineUserInfo oluserinfo = Discuz.Forum.OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); olid = oluserinfo.Olid; if (!Page.IsPostBack) { #region 如果IP访问列表有设置则进行判断 if (config.Adminipaccess.Trim() != "") { string[] regctrl = Utils.SplitString(config.Adminipaccess, "\n"); if (!Utils.InIPArray(DNTRequest.GetIP(), regctrl)) { StringBuilder sb = new StringBuilder(); sb.Append("<br /><br /><div style=\"width:100%\" align=\"center\"><div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\">"); sb.Append("<img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" /> 您的IP地址不在系统允许的范围之内</div></div>"); Response.Write(sb.ToString()); Response.End(); return; } } #endregion #region 用户身份判断 UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(oluserinfo.Groupid); if (oluserinfo.Userid <= 0 || usergroupinfo.Radminid != 1) { string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>无法确认您的身份</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"; message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">"; message += "<div align=\"center\" style=\"width:600px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> "; message += "无法确认您的身份, 请<a href=\"../login.aspx\">登录</a></div></div></body></html>"; Response.Write(message); Response.End(); return; } #endregion #region 判断安装目录文件信息 if (IsExistsSetupFile()) { string message = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; message += "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>请将您的安装目录即install/目录下的文件全部删除, 以免其它用户运行安装该程序!</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">"; message += "<link href=\"styles/default.css\" type=\"text/css\" rel=\"stylesheet\"></head><script type=\"text/javascript\">if(top.location!=self.location){top.location.href = \"syslogin.aspx\";}</script><body><br /><br /><div style=\"width:100%\" align=\"center\">"; message += "<div align=\"center\" style=\"width:660px; border:1px dotted #FF6600; background-color:#FFFCEC; margin:auto; padding:20px;\"><img src=\"images/hint.gif\" border=\"0\" alt=\"提示:\" align=\"absmiddle\" width=\"11\" height=\"13\" /> "; message += "请将您的安装目录(install/)下和升级目录(upgrade/)下的.aspx文件及bin/Discuz.Install.dll全部删除, 以免其它用户运行安装或升级程序!</div></div></body></html>"; Response.Write(message); Response.End(); return; } #endregion #region 显示相关页面登陆提交信息 if (Context.Request.Cookies["dntadmin"] == null || Context.Request.Cookies["dntadmin"]["key"] == null || ForumUtils.GetCookiePassword(Context.Request.Cookies["dntadmin"]["key"].ToString(), config.Passwordkey) != (oluserinfo.Password + Discuz.Forum.Users.GetUserInfo(oluserinfo.Userid).Secques + oluserinfo.Userid.ToString())) { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\">请重新进行管理员登录"; } if (oluserinfo.Userid > 0 && usergroupinfo.Radminid == 1 && oluserinfo.Username.Trim() != "") { UserName.Text = oluserinfo.Username; UserName.AddAttributes("readonly", "true"); UserName.CssClass = "nofocus"; UserName.Attributes.Add("onfocus", "this.className='nofocus';"); UserName.Attributes.Add("onblur", "this.className='nofocus';"); } if (DNTRequest.GetString("result") == "1") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不存在或密码错误</font>"; return; } if (DNTRequest.GetString("result") == "2") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">用户不是管理员身分,因此无法登陆后台</font>"; return; } if (DNTRequest.GetString("result") == "3") { Msg.Text = "<IMG alt=\"提示:\" src=\"images/warning.gif\" align=\"absMiddle\" border=\"0\" width=\"16\" height=\"16\"><font color=\"red\">验证码错误,请重新输入</font>"; return; } if (DNTRequest.GetString("result") == "4") { Msg.Text = ""; return; } #endregion } if (Page.IsPostBack) { VerifyLoginInf();//对提供的信息进行验证 } else { Response.Redirect("syslogin.aspx?result=4"); } }
public void VerifyLoginInf() { if (!Discuz.Forum.OnlineUsers.CheckUserVerifyCode(olid, DNTRequest.GetString("vcode"))) { Response.Redirect("syslogin.aspx?result=3"); return; } UserInfo userInfo = null; if (config.Passwordmode == 1) { userInfo = Users.GetUserInfo(Users.CheckDvBbsPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"))); } else if (config.Passwordmode == 0) { userInfo = Users.GetUserInfo(Users.CheckPassword(DNTRequest.GetString("username"), Utils.MD5(DNTRequest.GetString("password")), false)); } else//第三方加密验证模式 { userInfo = Users.CheckThirdPartPassword(DNTRequest.GetString("username"), DNTRequest.GetString("password"), -1, null); } if (userInfo != null) { UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid); if (usergroupinfo.Radminid == 1) { ForumUtils.WriteUserCookie(userInfo.Uid, 1440, GeneralConfigs.GetConfig().Passwordkey); //UserGroupInfo userGroupInfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid); HttpCookie cookie = new HttpCookie("dntadmin"); cookie.Values["key"] = ForumUtils.SetCookiePassword(userInfo.Password + userInfo.Secques + userInfo.Uid, config.Passwordkey); cookie.Expires = DateTime.Now.AddMinutes(30); HttpContext.Current.Response.AppendCookie(cookie); AdminVistLogs.InsertLog(userInfo.Uid, userInfo.Username, userInfo.Groupid, usergroupinfo.Grouptitle, DNTRequest.GetIP(), "后台管理员登陆", ""); try { SoftInfo.LoadSoftInfo(); } catch { Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>"); Response.End(); } //升级general.config文件 try { GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Server.MapPath("../config/general.config")); } catch { } Response.Write("<script type=\"text/javascript\">top.location.href='index.aspx';</script>"); Response.End(); } else { Response.Redirect("syslogin.aspx?result=2"); } } else { Response.Redirect("syslogin.aspx?result=1"); } }
private void GetStatInfo() { StringBuilder statInfo = new StringBuilder(); string forumname = GeneralConfigs.GetConfig().Forumtitle; int member = Convert.ToInt32(Statistics.GetStatisticsRowItem("totalusers")); int topics = Convert.ToInt32(Statistics.GetStatisticsRowItem("totaltopic")); int posts = Convert.ToInt32(Statistics.GetStatisticsRowItem("totalpost")); string serversoft = HttpContext.Current.Request.ServerVariables["SERVER_SOFTWARE"]; int dotnetmajor = Environment.Version.Major; int dotnetminor = Environment.Version.Minor; int dotnetbuild = Environment.Version.Build; int dbtype = 0; switch (Discuz.Config.BaseConfigs.GetDbType.ToLower()) { case "sqlserver": { dbtype = 0; break; } case "access": { dbtype = 101; break; } case "mysql": { dbtype = 201; break; } } string build = string.Empty; string strPath = Utils.GetMapPath(BaseConfigs.GetForumPath.ToLower() + "config/localupgradeini.config"); if (System.IO.File.Exists(strPath)) { XmlDocument lastupdate = new XmlDocument(); lastupdate.Load(strPath); build = lastupdate.SelectSingleNode("/localupgrade/requiredupgrade").InnerText; XmlNodeList list = lastupdate.SelectNodes("/localupgrade/optionalupgrade/dnt" + Utils.GetAssemblyVersion() + "/item"); if (list != null) { foreach (XmlNode node in list) { if (StrToDateTime(node.InnerText) > StrToDateTime(build)) { build = node.InnerText; } } } } string osversion = Environment.OSVersion.ToString(); string serverip = HttpContext.Current.Request.ServerVariables["LOCAL_ADDR"]; string servername = HttpContext.Current.Request.ServerVariables["SERVER_NAME"]; string dbversion = ""; if (dbtype == 0) { Regex regex = new Regex(@"\d{4}", RegexOptions.None); Match match = regex.Match(Databases.GetDataBaseVersion()); if (match.Length != 0) { dbversion = match.Value; } } string passwordmode = config.Passwordmode.ToString(); string enablealbum = config.Enablealbum.ToString(); string enablespace = config.Enablespace.ToString(); string enablemall = config.Enablemall.ToString(); string url = Utils.GetRootUrl(BaseConfigs.GetForumPath); statInfo.Append(Server.UrlEncode(forumname) + "," + member + "," + topics + "," + posts + "," + serversoft + "," + Utils.AssemblyFileVersion.FileMajorPart + "," + Utils.AssemblyFileVersion.FileMinorPart + "," + Utils.AssemblyFileVersion.FileBuildPart + ","); statInfo.Append(dotnetmajor + "," + dotnetminor + "," + dotnetbuild + "," + dbtype + "," + build + "," + osversion + "," + url + "," + servername + ","); statInfo.Append(dbversion + "," + passwordmode + "," + enablealbum + "," + enablespace + "," + enablemall + "," + config.Passwordkey); base.RegisterStartupScript("", string.Format("<script type='text/javascript' src='http://service.nt.discuz.net/news.aspx?update={0}'></script>", Convert.ToBase64String(Encoding.Default.GetBytes(statInfo.ToString())))); }
protected override void Initialize() { SiteConfigInfo ci = SiteConfigs.GetConfig(); GeneralConfigInfo si = GeneralConfigs.GetConfig(); SiteNameTextBox.Text = si.SiteTitle; txtSiteFullName.Text = si.SiteFullName; ImageValue.Text = si.SiteLogo; txtIcpInfo.Text = si.IcpInfo; RootUrlTextBox.Text = ci.RootUrl; IsHashedPasswordCheckBox.Checked = ci.IsPasswordHashed; txtSN.Text = ci.PluginSN; AllowSignupCheckBox.Checked = si.AllowSignup == "True"; //DefaultTemplateGroupTextBox.Text = si.DefaultTemplateGroup; DefaultTemplateGroupFileNameTextBox.Text = si.DefaultTemplateGroupFileName; HomePageTitleTextBox.Text = si.DefaultHomePageTitle; ChannelPageTitleTextBox.Text = si.DefaultChannelPageTitle; ContentPageTitleTextBox.Text = si.DefaultContentPageTitle; SySMailUserTextBox.Text = si.SysMailUser; SysMailPassTextBox.Text = si.SysMailPassword; SysMailServerTextBox.Text = si.SysMailServer; SystemMailTextBox.Text = si.SystemMail; NotifyMailTextBox.Text = si.NotifyMail; GenericUserManageTextBox.Text = si.GenericUserManageType; SysPopServerTextBox.Text = si.SysPopServer; //IsHashedPasswordCheckBox.Checked = si.IsPasswordHashed; IsAddLogCheckBox.Checked = si.IsAddLog; IsAuditCommentCheckBox.Checked = si.IsAuditComment; EnableLoginAuhenCodeCheckBox.Checked = (si.EnableLoginAuhenCode == "true"); AshxRadioButton.Checked = (si.UrlFormat == "aspx"); HtmlRadioButton.Checked = (si.UrlFormat == "html"); IISRadioButton.Checked = (si.UrlRewriterProvider == "iis"); ASPNETRadioButton.Checked = (si.UrlRewriterProvider == "asp.net"); ArticleUrlGeneratorTextBox.Text = si.ArticleUrlGenerator; ArticleUrlGeneratorDropDownList.SelectedValue = si.ArticleUrlGenerator; if (ArticleUrlGeneratorDropDownList.SelectedIndex == -1) { ArticleUrlGeneratorDropDownList.SelectedIndex = 3; } ArticleSourceDefaultTextBox.Text = si.ArticleSourceDefault; ArticleAutoPublish.Checked = (si.ArticleAutoPublish == "true"); ArticleAutoShare.Checked = (si.ArticleAutoShare == "true"); KeywordPageMetaTextBox.Text = si.KeywordPageMeta; DescriptionPageMetaTextBox.Text = si.DescriptionPageMeta; ADUrlTextBox.Text = ci.ADUrl; EnableCache.Checked = (si.EnableCache == "true"); CacheTimeSpanTextBox.Text = si.CacheTimeSpan.ToString(); OnlyLoginUserCanVisitCheckBox.Checked = si.OnlyLoginUserCanVisit; StartTemplateMapCheckbox.Checked = si.StartTemplateMap; SiteStateDropDownList.SelectedValue = si.SiteBuildState.ToLower(); AllowParentArticleCheckBox.Checked = si.AllowParentArticle; EnableSingleTable.Checked = si.EnableSingleTable; UseVisualTemplateCheckBox.Checked = si.DefaultTemplateEditor == "1"; EnableHtmlTemplate.Checked = si.EnableHtmlTemplate; hddnIPStrategy.Value = si.IPStrategy; ipstrategy.Attributes["src"] = "SystemStrategy.aspx?ipstrategy=" + si.IPStrategy; txtSSOUrls.Text = si.SSOSiteUrls; txtLinks.Text = si.Links; txtCopyright.Text = si.Copyright; //注册验证模式 List <ListItem> listItems = new List <ListItem>(); listItems.Add(new ListItem("不审核", "none")); listItems.Add(new ListItem("邮箱验证", "email")); listItems.Add(new ListItem("人工审核", "manual")); drpUserRegiseterMode.DataSource = listItems; drpUserRegiseterMode.SelectedValue = si.UserRegisterMode; drpUserRegiseterMode.DataBind(); }