protected void Page_Load(object sender, EventArgs e) { SetPageTitle("主题管理"); string[] filelist = Directory.GetFileSystemEntries(Server.MapPath("../../themes/default")); foreach (string str in filelist) { // Response.Write(str+"<br>"); } // System.IO.Directory.Delete(Server.MapPath("../themes/test"),true); string type = PressRequest.GetQueryString("type", true); if (Operate == OperateType.Update) { BlogConfigInfo s = BlogConfig.GetSetting(); switch (type) { case "mobile": s.MobileTheme = themename; break; case "pc": default: s.Theme = themename; break; } BlogConfig.UpdateSetting(); Response.Redirect("theme_list.aspx?result=2"); } else if (Operate == OperateType.Insert) { string srcPath = Server.MapPath("../themes/" + themename); if (!string.IsNullOrEmpty(themename) && System.IO.Directory.Exists(srcPath)) { string aimPath = string.Empty; int count = 1; while (true) { count++; aimPath = Server.MapPath("../themes/" + themename + "-" + count); if (!System.IO.Directory.Exists(aimPath)) { break; } } CopyDir(srcPath, aimPath); Response.Redirect("theme_list.aspx?result=1"); } } else if (Operate == OperateType.Delete) { if (themename == "default") { Response.Redirect("theme_list.aspx?result=5"); } else { string path = Server.MapPath("../themes/" + themename); if (System.IO.Directory.Exists(path)) { System.IO.Directory.Delete(path, true); Response.Redirect("theme_list.aspx?result=3"); } } } ShowResult(); }
/// <summary> /// 编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, EventArgs e) { BlogConfigInfo s = BlogConfig.GetSetting(); if (s != null) { s.SiteName = HttpHelper.HtmlEncode(txtSiteName.Text); s.SiteDescription = HttpHelper.HtmlEncode(txtSiteDescription.Text); s.MetaKeywords = HttpHelper.HtmlEncode(txtMetaKeywords.Text); s.MetaDescription = HttpHelper.HtmlEncode(txtMetaDescription.Text); // s.RewriteExtension = ddlRewriteExtension.SelectedValue; s.SiteStatus = chkSiteStatus.Checked ? 1 : 0; // s.CommentApproved = chkCommentApproved.Checked ? 1 : 0; // //c.GuestBookVerifyStatus = chkGuestBookVerifyStatus.Checked ? 1 : 0; s.EnableVerifyCode = chkEnableVerifyCode.Checked ? 1 : 0; // s.PageSizeTagCount = TypeConverter.StrToInt(txtPageSizeTagCount.Text, 10); s.PageSizePostCount = TypeConverter.StrToInt(txtPageSizePostCount.Text, 10); s.PageSizeCommentCount = TypeConverter.StrToInt(txtPageSizeCommentCount.Text, 50); s.SidebarPostCount = TypeConverter.StrToInt(txtSidebarPostCount.Text, 10); s.SidebarTagCount = TypeConverter.StrToInt(txtSidebarTagCount.Text, 10); s.SidebarCommentCount = TypeConverter.StrToInt(txtSidebarCommentCount.Text, 10); // //c.TagArticleNum = TypeConverter.StrToInt(txtTagArticleNum.Text, 10); s.FooterHtml = txtFooterHtml.Text; // //c.ArticleShowType = TypeConverter.StrToInt(ddlArticleShowType.SelectedValue, 0); //水印 s.WatermarkType = TypeConverter.StrToInt(ddlWatermarkType.SelectedValue, 1); s.WatermarkText = txtWatermarkText.Text; s.WatermarkFontName = ddlWatermarkFontName.SelectedValue; s.WatermarkFontSize = TypeConverter.StrToInt(ddlWatermarkFontSize.SelectedValue, 14); s.WatermarkImage = txtWatermarkImage.Text; s.WatermarkTransparency = TypeConverter.StrToInt(ddlWatermarkTransparency.SelectedValue, 10); s.WatermarkPosition = TypeConverter.StrToInt(ddlWatermarkPosition.SelectedValue, 1); s.WatermarkQuality = TypeConverter.StrToInt(ddlWatermarkQuality.SelectedValue, 100); //评论 s.CommentStatus = chkCommentStatus.Checked ? 1 : 0; s.CommentOrder = TypeConverter.StrToInt(ddlCommentOrder.SelectedValue, 1); s.CommentApproved = TypeConverter.StrToInt(ddlCommentApproved.SelectedValue, 1); s.CommentSpamwords = txtCommentSpamwords.Text; //rss s.RssStatus = chkRssStatus.Checked ? 1 : 0; s.RssRowCount = TypeConverter.StrToInt(txtRssRowCount.Text, 20); s.RssShowType = TypeConverter.StrToInt(ddlRssShowType.SelectedValue, 2); //rewrite s.RewriteExtension = ddlRewriteExtension.SelectedValue; s.UrlFormatType = TypeConverter.StrToInt(ddlUrlType.SelectedValue, 1); //total s.SiteTotalType = TypeConverter.StrToInt(ddlTotalType.SelectedValue, 1); s.PostShowType = TypeConverter.StrToInt(ddlPostShowType.SelectedValue, 2); //邮件 s.SmtpEmail = txtSmtpEmail.Text.Trim(); s.SmtpServer = txtSmtpServer.Text.Trim(); s.SmtpServerPost = TypeConverter.StrToInt(txtSmtpServerPort.Text, 25); s.SmtpUserName = txtSmtpUserName.Text.Trim(); s.SmtpPassword = txtSmtpPassword.Text.Trim(); s.SmtpEnableSsl = chkSmtpEnableSsl.Checked == true ? 1 : 0; //发送邮件设置 s.SendMailAuthorByPost = chkSendMailAuthorByPost.Checked == true ? 1 : 0; s.SendMailAuthorByComment = chkSendMailAuthorByComment.Checked == true ? 1 : 0; s.SendMailNotifyByComment = chkSendMailNotifyByComment.Checked == true ? 1 : 0; if (BlogConfig.UpdateSetting()) { Response.Redirect("blog_set.aspx?result=2"); } } }