public WebTags(_DbHelper c)
 {
     conn = c;
     SettingData setData = new SettingData(conn);
     this._setting = setData.GetSetting();
     this._theme = setData.GetTheme;
 }
 /// <summary>
 /// 写出引用通告处理状态
 /// </summary>
 public void OutWrite()
 {
     //取值
     PostItem postItem = new PostData(conn).GetPost(SiteFun.ToInt(SiteFun.Query("id")));
     CommentItem value = new CommentItem();
     value.PostID = postItem.ID;
     value.Author = SiteFun.Post("blog_name");
     value.Content = SiteFun.Post("excerpt");
     value.Title = SiteFun.Post("title");
     value.Trackback = true;
     value.URL = SiteFun.FormatUrl(SiteFun.Post("url"));
     value.Verify = postItem.AutoVerifyTrackback;
     //错误状态和返回信息
     int error = 1;
     string msg = string.Empty;
     if (postItem.ID > 0 && postItem.Show)
     {
         if (postItem.SwitchTrackback)
         {
             if (string.IsNullOrEmpty(value.Content)) { msg = SiteDat.GetLan("MsgNoContent"); }
             else
             {
                 if (value.Content.Length > 255) { value.Content = value.Content.Substring(0, 252) + "..."; }
                 if (string.IsNullOrEmpty(value.Author)) { msg = SiteDat.GetLan("MsgNoName"); }
                 else
                 {
                     bool haveFilter = false;
                     string[] filters = new SettingData(conn).GetSetting().Basic.Filter.Split(',');
                     foreach (string filter in filters)
                     {
                         if (value.Content.Contains(filter)) { haveFilter = true; }
                     }
                     if (haveFilter) { msg = SiteDat.GetLan("MsgFilterTxt"); }
                     else
                     {
                         new CommentData(conn).InsertComment(value);
                         msg = SiteDat.GetLan("MsgSaveSucc");
                         error = 0;
                     }
                 }
             }
         }
         else { msg = SiteDat.GetLan("MsgArtAllowedSendTb"); }
     }
     else { msg = SiteDat.GetLan("MsgArtNotExists"); }
     //处理和返回
     StringBuilder xml = new StringBuilder();
     xml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
     xml.Append("<response>\n");
     xml.AppendFormat("\t<error>0</error>\n", error);
     xml.AppendFormat("\t<message>{0}</message>\n", SiteFun.CDATA(msg));
     xml.Append("</response>");
     HttpContext.Current.Response.ContentType = "text/xml";
     HttpContext.Current.Response.Write(xml);
 }
 /// <summary>
 /// 发表评论过程
 /// </summary>
 private void OutWritePost()
 {
     string msg = string.Empty;
     SettingItem setting = new SettingData(conn).GetSetting();
     //取值和设置
     PostItem postItem = new PostData(conn).GetPost(SiteFun.ToInt(SiteFun.Query("artId")));
     CommentItem postVal = new CommentItem();
     postVal.PostID = postItem.ID;
     postVal.Author = SiteFun.Post("author");
     postVal.Mail = SiteFun.Post("mail");
     postVal.URL = SiteFun.FormatUrl(SiteFun.Post("url"));
     postVal.Content = SiteFun.Post("content");
     postVal.Verify = postItem.AutoVerifyComment;
     //设置Cookie
     _wc.Set(postVal.Author, postVal.Mail, postVal.URL);
     //开始判断并发布
     if (postItem.ID > 0 && postItem.SwitchComment)
     {
         if (string.IsNullOrEmpty(postVal.Author)) { msg = SiteDat.GetLan("MsgNoNickName"); }
         else
         {
             if (string.IsNullOrEmpty(postVal.Mail)) { msg = SiteDat.GetLan("MsgNoMail"); }
             else
             {
                 if (string.IsNullOrEmpty(postVal.Content)) { msg = SiteDat.GetLan("MsgNoContent"); }
                 else
                 {
                     if (postVal.Content.Length > 255) { msg = SiteDat.GetLan("MsgContLenMax"); }
                     else
                     {
                         bool haveFilter = false;
                         string[] filters = setting.Basic.Filter.Split(',');
                         foreach (string filter in filters)
                         {
                             if (postVal.Content.Contains(filter)) { haveFilter = true; break; }
                         }
                         if (haveFilter) { msg = SiteDat.GetLan("MsgFilterTxt"); }
                         else
                         {
                             new CommentData(conn).InsertComment(postVal);
                             SiteDat.RemoveDat(SiteCache.NewComment);
                             SiteDat.RemoveDat(SiteCache.RandomPost);
                             SiteDat.ClearDat(string.Format("Comments-{0}-", postItem.ID));
                         }
                     }
                 }
             }
         }
     }
     else { msg = SiteDat.GetLan("MsgArtNotExistsOrLocked"); }
     PrintList(msg, postItem.ID);
 }
 /// <summary>
 /// 选择主题包
 /// </summary>
 public string Select()
 {
     StringBuilder sr = new StringBuilder();
     SettingData setData = new SettingData(conn);
     if (SiteFun.IsPost)
     {
         string postVal = SiteFun.Post("theme");
         if (!string.IsNullOrEmpty(postVal))
         {
             setData.SetTheme(postVal);
             sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateThemeSucc")));
         }
         ClearCache();
     }
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart());
     sr.Append(HtmlUI.TrStart());
     //取得系统模板名称并循环
     string theme = setData.GetTheme;
     int count = 0;
     foreach (string dir in Directory.GetDirectories(Path.Combine(SiteCfg.Router, "Common/Theme/")))
     {
         DirectoryInfo dirInfo = new DirectoryInfo(dir);
         string innerTable = HtmlUI.FormStart();
         innerTable += HtmlUI.TableStart();
         innerTable += HtmlUI.TrStart();
         innerTable += HtmlUI.CreateTd(HtmlUI.Image(string.Format("Common/Theme/{0}/Preview.png", dirInfo.Name), dirInfo.Name, null, 300, 180));
         innerTable += HtmlUI.TrFinal();
         innerTable += HtmlUI.TrStart();
         innerTable += HtmlUI.CreateTd(HtmlUI.HiddenInput("theme", dirInfo.Name) + HtmlUI.SubmitButton(string.Format(SiteDat.GetLan("BtnThemeSel"), dirInfo.Name), (dirInfo.Name == theme ? "red" : string.Empty)));
         innerTable += HtmlUI.TrFinal();
         innerTable += HtmlUI.TableFinal();
         innerTable += HtmlUI.FormFinal();
         //开始处理
         sr.Append(HtmlUI.CreateTd(innerTable));
         count++;
         if (count % 2 == 0)
         {
             sr.Append(HtmlUI.TrFinal());
             sr.Append(HtmlUI.TrStart());
         }
     }
     //循环结束
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     return sr.ToString();
 }
 /// <summary>
 /// 写出引用通告处理状态
 /// </summary>
 public void OutWrite()
 {
     //取值
     int cid = SiteFun.ToInt(SiteFun.Query("cid"));
     SettingItem set = new SettingData(conn).GetSetting();
     //处理和返回
     StringBuilder xml = new StringBuilder();
     xml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
     xml.Append("<rss version=\"2.0\">\n");
     xml.Append("<channel>\n");
     xml.AppendFormat("<title>{0}</title>\n", SiteFun.CDATA(set.Basic.Name));
     xml.AppendFormat("<link>{0}</link>\n", SiteFun.CDATA(set.Basic.URL));
     xml.AppendFormat("<description>{0}</description>\n", SiteFun.CDATA(set.Basic.Intro));
     xml.AppendFormat("<language>{0}</language>\n", SiteFun.CDATA(set.Basic.Language));
     xml.AppendFormat("<copyright>{0}</copyright>\n", SiteFun.CDATA("Copyright " + set.Basic.Name));
     xml.AppendFormat("<webMaster>{0}</webMaster>\n", SiteFun.CDATA(set.Basic.Mail));
     xml.AppendFormat("<generator>{0}</generator>\n", SiteFun.CDATA(SiteCfg.SystemVersionFull));
     xml.Append("<image>\n");
     xml.AppendFormat("\t<title>{0}</title>\n", SiteFun.CDATA(set.Basic.Name));
     xml.AppendFormat("\t<url>{0}</url>\n", SiteFun.CDATA(set.Basic.URL + "Common/Images/Logo.png"));
     xml.AppendFormat("\t<link>{0}</link>\n", SiteFun.CDATA(set.Basic.URL));
     xml.AppendFormat("\t<description>{0}</description>\n", SiteFun.CDATA(set.Basic.Intro));
     xml.Append("</image>\n");
     foreach (PostItem vItem in new PostData(conn).SelectPost(cid, null, null, 1, set.Parameter.RssNum, 0, "A", false))
     {
         xml.Append("<item>\n");
         xml.AppendFormat("\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, set.Basic.URL, vItem.Local)));
         xml.AppendFormat("\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t<author>{0}</author>\n", SiteFun.CDATA(vItem.Author));
         xml.AppendFormat("\t<category>{0}</category>\n", SiteFun.CDATA(new ColumnData(conn).GetColumn(vItem.ColumnID).Name));
         xml.AppendFormat("\t<pubDate>{0}</pubDate>\n", vItem.Publish);
         xml.AppendFormat("\t<guid>{0}</guid>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, set.Basic.URL, vItem.Local)));
         xml.AppendFormat("\t<description>{0}</description>\n", SiteFun.CDATA(string.IsNullOrEmpty(vItem.Password) ? (set.Parameter.RssMode == 0 ? vItem.Explain : vItem.Content) : SiteDat.GetLan("MsgEncContent")));
         xml.Append("</item>\n");
     }
     xml.Append("</channel>\n");
     xml.Append("</rss>");
     HttpContext.Current.Response.ContentType = "text/xml";
     HttpContext.Current.Response.Write(xml);
 }
 /// <summary>
 /// 获取 XML 内容
 /// </summary>
 /// <param name="title">标题</param>
 /// <param name="thisXmlText">本页单独的 XML 内容</param>
 /// <returns>返回完整的 XML 内容</returns>
 public string OutBaseXml(string title, string thisXmlText)
 {
     StringBuilder xml = new StringBuilder();
     xml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
     xml.Append("<ui>\n");
     //配置数据
     xml.Append("\t<config>\n");
     xml.AppendFormat("\t\t<path>{0}</path>\n", SiteFun.CDATA(SiteCfg.Path));
     xml.AppendFormat("\t\t<system>{0}</system>\n", SiteFun.CDATA(SiteCfg.System));
     xml.AppendFormat("\t\t<version>{0}</version>\n", SiteFun.CDATA(SiteCfg.Version));
     xml.AppendFormat("\t\t<fullVersion>{0}</fullVersion>\n", SiteFun.CDATA(SiteCfg.SystemVersionFull));
     xml.AppendFormat("\t\t<powered>{0}</powered>\n", SiteFun.CDATA(SiteCfg.Powered));
     xml.Append("\t</config>\n");
     //设置数据
     SettingData setData = new SettingData(conn);
     if (SiteDat.GetDat(SiteCache.Setting) == null)
     {
         SiteDat.SetDat(SiteCache.Setting, setData.GetSetting());
     }
     SettingItem setting = (SettingItem)SiteDat.GetDat(SiteCache.Setting);
     string theme = setData.GetTheme;
     xml.Append("\t<setting>\n");
     xml.AppendFormat("\t\t<theme>{0}</theme>\n", SiteFun.CDATA(theme));
     xml.AppendFormat("\t\t<language>{0}</language>\n", SiteFun.CDATA(setting.Basic.Language));
     xml.AppendFormat("\t\t<name>{0}</name>\n", SiteFun.CDATA(setting.Basic.Name));
     xml.AppendFormat("\t\t<url>{0}</url>\n", SiteFun.CDATA(setting.Basic.URL));
     xml.AppendFormat("\t\t<intro>{0}</intro>\n", SiteFun.CDATA(setting.Basic.Intro));
     xml.AppendFormat("\t\t<keywords>{0}</keywords>\n", SiteFun.CDATA(setting.Basic.Keywords));
     xml.AppendFormat("\t\t<icp>{0}</icp>\n", SiteFun.CDATA(setting.Basic.ICP));
     xml.AppendFormat("\t\t<affiche>{0}</affiche>\n", SiteFun.CDATA(setting.Basic.Affiche));
     xml.Append("\t</setting>\n");
     //导航
     xml.Append("\t<navigations>\n");
     xml.Append("\t\t<item>\n");
     xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(SiteCfg.Path));
     xml.AppendFormat("\t\t\t<name>{0}</name>\n", SiteFun.CDATA(SiteDat.GetLan("HomePage")));
     xml.AppendFormat("\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(setting.Basic.Name));
     xml.AppendFormat("\t\t\t<target>{0}</target>\n", SiteFun.CDATA("_self"));
     xml.AppendFormat("\t\t\t<current>{0}</current>\n", string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query));
     xml.Append("\t\t</item>\n");
     if (SiteDat.GetDat(SiteCache.Navigation) == null)
     {
         SiteDat.SetDat(SiteCache.Navigation, new ColumnData(conn).SelectColumn(1, -1, false));
     }
     foreach (ColumnItem vItem in (DataList<ColumnItem>)SiteDat.GetDat(SiteCache.Navigation))
     {
         string itemLink = string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local));
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(vItem.Jump ? vItem.JumpUrl : itemLink));
         xml.AppendFormat("\t\t\t<name>{0}</name>\n", SiteFun.CDATA(vItem.Name));
         xml.AppendFormat("\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(vItem.Intro));
         xml.AppendFormat("\t\t\t<target>{0}</target>\n", SiteFun.CDATA(vItem.Target));
         xml.AppendFormat("\t\t\t<current>{0}</current>\n", string.Format((SiteFun.ToInt(vItem.Local) > 0 ? "?act=defa&cid={0}" : "?act=defa&clocal={1}"), vItem.ID, SiteFun.UrlEncode(vItem.Local)).ToLower() == HttpContext.Current.Request.Url.Query.ToLower());
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</navigations>\n");
     //分类
     xml.Append("\t<categorys>\n");
     if (SiteDat.GetDat(SiteCache.Column) == null)
     {
         SiteDat.SetDat(SiteCache.Column, new ColumnData(conn).SelectColumn(-1, 0, false));
     }
     foreach (ColumnItem vItem in (DataList<ColumnItem>)SiteDat.GetDat(SiteCache.Column))
     {
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<name>{0}</name>\n", SiteFun.CDATA(vItem.Name));
         xml.AppendFormat("\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(vItem.Intro));
         xml.AppendFormat("\t\t\t<local>{0}</local>\n", SiteFun.CDATA(vItem.Local));
         xml.AppendFormat("\t\t\t<postCount>{0}</postCount>\n", vItem.PostCount);
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</categorys>\n");
     //随机文章
     xml.Append("\t<randomArticles>\n");
     if (SiteDat.GetDat(SiteCache.RandomPost) == null)
     {
         SiteDat.SetDat(SiteCache.RandomPost, new PostData(conn).SelectPost(0, null, null, 1, setting.Parameter.AppendRandomArticleNum, 4, "A", false));
     }
     foreach (PostItem vItem in (DataList<PostItem>)SiteDat.GetDat(SiteCache.RandomPost))
     {
         ColumnItem columnItem = new ColumnItem();
         if (SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID)) == null)
         {
             SiteDat.SetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID), new ColumnData(conn).GetColumn(vItem.ColumnID));
         }
         columnItem = (ColumnItem)SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID));
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t\t\t<tags>{0}</tags>\n", SiteFun.CDATA(vItem.Tags));
         xml.AppendFormat("\t\t\t<local>{0}</local>\n", SiteFun.CDATA(vItem.Local));
         xml.AppendFormat("\t\t\t<author>{0}</author>\n", SiteFun.CDATA(vItem.Author));
         xml.AppendFormat("\t\t\t<postCount>{0}</postCount>\n", vItem.PostCount);
         xml.AppendFormat("\t\t\t<reader>{0}</reader>\n", vItem.Reader);
         xml.AppendFormat("\t\t\t<vote>{0}</vote>\n", vItem.Vote);
         xml.AppendFormat("\t\t\t<fine>{0}</fine>\n", vItem.Fine);
         xml.AppendFormat("\t\t\t<publish>{0}</publish>\n", vItem.Publish);
         xml.Append("\t\t\t<category>\n");
         xml.AppendFormat("\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(columnItem.Local))));
         xml.AppendFormat("\t\t\t\t<id>{0}</id>\n", columnItem.ID);
         xml.AppendFormat("\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(columnItem.Local));
         xml.AppendFormat("\t\t\t\t<name>{0}</name>\n", SiteFun.CDATA(columnItem.Name));
         xml.AppendFormat("\t\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(columnItem.Intro));
         xml.AppendFormat("\t\t\t\t<postCount>{0}</postCount>\n", columnItem.PostCount);
         xml.Append("\t\t\t</category>\n");
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</randomArticles>\n");
     //热门文章
     xml.Append("\t<hotArticles>\n");
     if (SiteDat.GetDat(SiteCache.HotPost) == null)
     {
         SiteDat.SetDat(SiteCache.HotPost, new PostData(conn).SelectPost(0, null, null, 1, setting.Parameter.AppendHotArticleNum, 2, "A", false));
     }
     foreach (PostItem vItem in (DataList<PostItem>)SiteDat.GetDat(SiteCache.HotPost))
     {
         ColumnItem columnItem = new ColumnItem();
         if (SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID)) == null)
         {
             SiteDat.SetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID), new ColumnData(conn).GetColumn(vItem.ColumnID));
         }
         columnItem = (ColumnItem)SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID));
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t\t\t<tags>{0}</tags>\n", SiteFun.CDATA(vItem.Tags));
         xml.AppendFormat("\t\t\t<local>{0}</local>\n", SiteFun.CDATA(vItem.Local));
         xml.AppendFormat("\t\t\t<author>{0}</author>\n", SiteFun.CDATA(vItem.Author));
         xml.AppendFormat("\t\t\t<postCount>{0}</postCount>\n", vItem.PostCount);
         xml.AppendFormat("\t\t\t<reader>{0}</reader>\n", vItem.Reader);
         xml.AppendFormat("\t\t\t<vote>{0}</vote>\n", vItem.Vote);
         xml.AppendFormat("\t\t\t<fine>{0}</fine>\n", vItem.Fine);
         xml.AppendFormat("\t\t\t<publish>{0}</publish>\n", vItem.Publish);
         xml.Append("\t\t\t<category>\n");
         xml.AppendFormat("\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(columnItem.Local))));
         xml.AppendFormat("\t\t\t\t<id>{0}</id>\n", columnItem.ID);
         xml.AppendFormat("\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(columnItem.Local));
         xml.AppendFormat("\t\t\t\t<name>{0}</name>\n", SiteFun.CDATA(columnItem.Name));
         xml.AppendFormat("\t\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(columnItem.Intro));
         xml.AppendFormat("\t\t\t\t<postCount>{0}</postCount>\n", columnItem.PostCount);
         xml.Append("\t\t\t</category>\n");
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</hotArticles>\n");
     //好文章
     xml.Append("\t<fineArticles>\n");
     if (SiteDat.GetDat(SiteCache.FinePost) == null)
     {
         SiteDat.SetDat(SiteCache.FinePost, new PostData(conn).SelectPost(0, null, null, 1, setting.Parameter.AppendFineArticleNum, 3, "A", false));
     }
     foreach (PostItem vItem in (DataList<PostItem>)SiteDat.GetDat(SiteCache.FinePost))
     {
         ColumnItem columnItem = new ColumnItem();
         if (SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID)) == null)
         {
             SiteDat.SetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID), new ColumnData(conn).GetColumn(vItem.ColumnID));
         }
         columnItem = (ColumnItem)SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, vItem.ColumnID));
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t\t\t<tags>{0}</tags>\n", SiteFun.CDATA(vItem.Tags));
         xml.AppendFormat("\t\t\t<local>{0}</local>\n", SiteFun.CDATA(vItem.Local));
         xml.AppendFormat("\t\t\t<author>{0}</author>\n", SiteFun.CDATA(vItem.Author));
         xml.AppendFormat("\t\t\t<postCount>{0}</postCount>\n", vItem.PostCount);
         xml.AppendFormat("\t\t\t<reader>{0}</reader>\n", vItem.Reader);
         xml.AppendFormat("\t\t\t<vote>{0}</vote>\n", vItem.Vote);
         xml.AppendFormat("\t\t\t<fine>{0}</fine>\n", vItem.Fine);
         xml.AppendFormat("\t\t\t<publish>{0}</publish>\n", vItem.Publish);
         xml.Append("\t\t\t<category>\n");
         xml.AppendFormat("\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(columnItem.Local))));
         xml.AppendFormat("\t\t\t\t<id>{0}</id>\n", columnItem.ID);
         xml.AppendFormat("\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(columnItem.Local));
         xml.AppendFormat("\t\t\t\t<name>{0}</name>\n", SiteFun.CDATA(columnItem.Name));
         xml.AppendFormat("\t\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(columnItem.Intro));
         xml.AppendFormat("\t\t\t\t<postCount>{0}</postCount>\n", columnItem.PostCount);
         xml.Append("\t\t\t</category>\n");
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</fineArticles>\n");
     //最新评论
     xml.Append("\t<newComments>\n");
     if (SiteDat.GetDat(SiteCache.NewComment) == null)
     {
         SiteDat.SetDat(SiteCache.NewComment, new CommentData(conn).SelectComment(0, 1, setting.Parameter.AppendNewCommentNum, false));
     }
     foreach (CommentItem vItem in (DataList<CommentItem>)SiteDat.GetDat(SiteCache.NewComment))
     {
         PostItem postItem = new PostData(conn).GetPost(vItem.PostID);
         ColumnItem columnItem = new ColumnItem();
         if (SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, postItem.ColumnID)) == null)
         {
             SiteDat.SetDat(string.Format(SiteCache.ColumnFormat, postItem.ColumnID), new ColumnData(conn).GetColumn(postItem.ColumnID));
         }
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<author>{0}</author>\n", SiteFun.CDATA(vItem.Author));
         xml.AppendFormat("\t\t\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t\t\t<content>{0}</content>\n", SiteFun.CDATA(vItem.Content));
         xml.AppendFormat("\t\t\t<reply>{0}</reply>\n", SiteFun.CDATA(vItem.Reply));
         xml.AppendFormat("\t\t\t<mail>{0}</mail>\n", SiteFun.CDATA(vItem.Mail));
         xml.AppendFormat("\t\t\t<url>{0}</url>\n", SiteFun.CDATA(vItem.URL));
         xml.AppendFormat("\t\t\t<publish>{0}</publish>\n", vItem.Publish);
         xml.AppendFormat("\t\t\t<trackback>{0}</trackback>\n", vItem.Trackback);
         xml.Append("\t\t\t<article>\n");
         xml.AppendFormat("\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(postItem.Local))));
         xml.AppendFormat("\t\t\t\t<id>{0}</id>\n", postItem.ID);
         xml.AppendFormat("\t\t\t\t<title>{0}</title>\n", SiteFun.CDATA(postItem.Title));
         xml.AppendFormat("\t\t\t\t<tags>{0}</tags>\n", SiteFun.CDATA(postItem.Tags));
         xml.AppendFormat("\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(postItem.Local));
         xml.AppendFormat("\t\t\t\t<author>{0}</author>\n", SiteFun.CDATA(postItem.Author));
         xml.AppendFormat("\t\t\t\t<postCount>{0}</postCount>\n", postItem.PostCount);
         xml.AppendFormat("\t\t\t\t<reader>{0}</reader>\n", postItem.Reader);
         xml.AppendFormat("\t\t\t\t<vote>{0}</vote>\n", postItem.Vote);
         xml.AppendFormat("\t\t\t\t<fine>{0}</fine>\n", postItem.Fine);
         xml.AppendFormat("\t\t\t\t<publish>{0}</publish>\n", postItem.Publish);
         xml.Append("\t\t\t\t<category>\n");
         xml.AppendFormat("\t\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.CategoryLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(columnItem.Local))));
         xml.AppendFormat("\t\t\t\t\t<id>{0}</id>\n", columnItem.ID);
         xml.AppendFormat("\t\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(columnItem.Local));
         xml.AppendFormat("\t\t\t\t\t<name>{0}</name>\n", SiteFun.CDATA(columnItem.Name));
         xml.AppendFormat("\t\t\t\t\t<intro>{0}</intro>\n", SiteFun.CDATA(columnItem.Intro));
         xml.AppendFormat("\t\t\t\t\t<postCount>{0}</postCount>\n", columnItem.PostCount);
         xml.Append("\t\t\t\t</category>\n");
         xml.Append("\t\t\t</article>\n");
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</newComments>\n");
     //单页面
     xml.Append("\t<pages>\n");
     if (SiteDat.GetDat(SiteCache.Page) == null)
     {
         SiteDat.SetDat(SiteCache.Page, new PostData(conn).SelectPost(0, null, null, 1, 999, 0, "P", false));
     }
     foreach (PostItem vItem in (DataList<PostItem>)SiteDat.GetDat(SiteCache.Page))
     {
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.PageLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Local))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<title>{0}</title>\n", SiteFun.CDATA(vItem.Title));
         xml.AppendFormat("\t\t\t<local>{0}</local>\n", SiteFun.CDATA(vItem.Local));
         xml.AppendFormat("\t\t\t<publish>{0}</publish>\n", vItem.Publish);
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</pages>\n");
     //热门标签
     xml.Append("\t<tags>\n");
     if (SiteDat.GetDat(SiteCache.HotTag) == null)
     {
         SiteDat.SetDat(SiteCache.HotTag, new TagData(conn).SelectTag(1, setting.Parameter.AppendHotTagNum, "PostCount", "DESC"));
     }
     foreach (TagItem vItem in (TagList)SiteDat.GetDat(SiteCache.HotTag))
     {
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.TagLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(vItem.Key))));
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<key>{0}</key>\n", SiteFun.CDATA(vItem.Key));
         xml.AppendFormat("\t\t\t<postCount>{0}</postCount>\n", vItem.PostCount);
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</tags>\n");
     //首页链接
     xml.Append("\t<fellows>\n");
     if (SiteDat.GetDat(SiteCache.Fellow) == null)
     {
         SiteDat.SetDat(SiteCache.Fellow, new FellowData(conn).SelectFellow(1, int.MaxValue, true, false));
     }
     DataList<FellowItem> fellows = (DataList<FellowItem>)SiteDat.GetDat(SiteCache.Fellow);
     foreach (FellowItem vItem in fellows)
     {
         xml.Append("\t\t<item>\n");
         xml.AppendFormat("\t\t\t<id>{0}</id>\n", vItem.ID);
         xml.AppendFormat("\t\t\t<name>{0}</name>\n", SiteFun.CDATA(vItem.Name));
         xml.AppendFormat("\t\t\t<url>{0}</url>\n", SiteFun.CDATA(vItem.URL));
         xml.AppendFormat("\t\t\t<logo>{0}</logo>\n", SiteFun.CDATA(vItem.Logo));
         xml.AppendFormat("\t\t\t<explain>{0}</explain>\n", SiteFun.CDATA(SiteFun.HtmlMatch(vItem.Explain)));
         xml.AppendFormat("\t\t\t<style>{0}</style>\n", SiteFun.CDATA(vItem.Style));
         xml.Append("\t\t</item>\n");
     }
     xml.Append("\t</fellows>\n");
     //自定义标签
     xml.Append("\t<myTag>\n");
     if (SiteDat.GetDat(SiteCache.MyTag) == null)
     {
         SiteDat.SetDat(SiteCache.MyTag, new MyTagData(conn).SelectMyTag(1, int.MaxValue, false));
     }
     foreach (MyTagItem vItem in (DataList<MyTagItem>)SiteDat.GetDat(SiteCache.MyTag))
     {
         xml.AppendFormat("\t\t<{0}>{1}</{0}>\n", vItem.Key, SiteFun.CDATA(vItem.Code));
     }
     xml.Append("\t</myTag>\n");
     //单页数据
     xml.Append("\t<this>\n");
     xml.AppendFormat("\t\t<title>{0}</title>\n", SiteFun.CDATA(title));
     xml.Append(thisXmlText);
     xml.Append("\t</this>\n");
     //扩展部分
     xml.Append("\t<expand>\n");
     foreach (object type in new SiteExpand().GetTypes(typeof(IWebExpandXml).FullName))
     {
         IWebExpandXml iae = ((IWebExpandXml)type);
         xml.Append(iae.OutXML());
     }
     xml.Append("\t</expand>\n");
     xml.Append("</ui>\n");
     return xml.ToString();
 }
        /// <summary>
        /// 基础设置
        /// </summary>
        public string Basic()
        {
            StringBuilder sr = new StringBuilder();
            SettingData setData = new SettingData(conn);
            //取得默认值
            if (SiteFun.IsPost)
            {
                SettingBasicItem postVal = new SettingBasicItem();
                postVal.Name = SiteFun.Post("caption");
                postVal.URL = SiteFun.Post("url");
                if (!string.IsNullOrEmpty(postVal.URL))
                {
                    if (!postVal.URL.EndsWith("/")) { postVal.URL += "/"; }
                }
                postVal.ICP = SiteFun.Post("icp");
                //postVal.Language = SiteFun.Post("language");
                postVal.Intro = SiteFun.Post("intro");
                postVal.Keywords = SiteFun.Post("keywords");
                postVal.Affiche = SiteFun.Post("affiche");
                postVal.Filter = SiteFun.Post("filter");
                postVal.UploadExt = SiteFun.Post("uploadExt");
                postVal.Mail = SiteFun.Post("mail");
                postVal.MailFrom = SiteFun.Post("mailFrom");
                postVal.MailHost = SiteFun.Post("mailHost");
                postVal.MailPort = SiteFun.ToInt(SiteFun.Post("mailPort"));
                postVal.MailUserID = SiteFun.Post("mailUid");
                postVal.MailPassword = SiteFun.Post("mailPwd");
                setData.UpdateSettingBasic(postVal);
                sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat")));
                ClearCache();
            }
            SettingItem old = setData.GetSetting();
            sr.Append(HtmlUI.FormStart());
            sr.Append(AdminUI.AdminBoxStart(true));

            sr.Append(HtmlUI.TableStart("onCenter advancedBox"));
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("SiteCap")) + HtmlUI.CreateTd(HtmlUI.Input("caption", 20, null, SiteFun.HtmlEncode(old.Basic.Name))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("URL")) + HtmlUI.CreateTd(HtmlUI.Input("url", 50, null, SiteFun.HtmlEncode(old.Basic.URL))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Icp")) + HtmlUI.CreateTd(HtmlUI.Input("icp", 30, null, SiteFun.HtmlEncode(old.Basic.ICP))));
            sr.Append(HtmlUI.TrFinal());
            /*sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Lang")) + HtmlUI.CreateTd(HtmlUI.Input("language", 10, null, SiteFun.HtmlEncode(old.Basic.Language))));
            sr.Append(HtmlUI.TrFinal());*/
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Intro")) + HtmlUI.CreateTd(HtmlUI.Input("intro", 50, null, SiteFun.HtmlEncode(old.Basic.Intro))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Keywords")) + HtmlUI.CreateTd(HtmlUI.Input("keywords", 50, null, SiteFun.HtmlEncode(old.Basic.Keywords))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Affiche")) + HtmlUI.CreateTd(AdminUI.Editor("affiche", SiteFun.HtmlEncode(old.Basic.Affiche))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Mail")) + HtmlUI.CreateTd(HtmlUI.Input("mail", 30, null, SiteFun.HtmlEncode(old.Basic.Mail))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.TableFinal());
            //安全相关
            sr.Append(HtmlUI.TableStart("onCenter hidden advancedBox"));
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("IllChar")) + HtmlUI.CreateTd(HtmlUI.Textarea("filter", 10, 80, SiteFun.HtmlEncode(old.Basic.Filter))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("SafeSuffix")) + HtmlUI.CreateTd(HtmlUI.Input("uploadExt", 60, null, SiteFun.HtmlEncode(old.Basic.UploadExt))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TableFinal());
            //邮件服务器
            sr.Append(HtmlUI.TableStart("onCenter hidden advancedBox"));
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailFrom")) + HtmlUI.CreateTd(HtmlUI.Input("mailFrom", 30, null, SiteFun.HtmlEncode(old.Basic.MailFrom))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailSvr")) + HtmlUI.CreateTd(HtmlUI.Input("mailHost", 30, null, SiteFun.HtmlEncode(old.Basic.MailHost))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailSvrPort")) + HtmlUI.CreateTd(HtmlUI.Input("mailPort", 5, null, old.Basic.MailPort)));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailUserId")) + HtmlUI.CreateTd(HtmlUI.Input("mailUid", 20, null, SiteFun.HtmlEncode(old.Basic.MailUserID))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailPwd")) + HtmlUI.CreateTd(HtmlUI.PasswordInput("mailPwd", 20, null, SiteFun.HtmlEncode(old.Basic.MailPassword))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TableFinal());

            sr.Append(HtmlUI.TableStart("onCenter"));
            sr.Append(HtmlUI.TrStart());
            sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton() + HtmlUI.Button("advancedLink", SiteDat.GetLan("BtnAdvanced"))));
            sr.Append(HtmlUI.TrFinal());
            sr.Append(HtmlUI.TableFinal());

            sr.Append(AdminUI.AdminBoxFinal());
            sr.Append(HtmlUI.FormFinal());
            return sr.ToString();
        }
 /// <summary>
 /// 参数设置
 /// </summary>
 public string Parameter()
 {
     StringBuilder sr = new StringBuilder();
     SettingData setData = new SettingData(conn);
     //取得默认值
     if (SiteFun.IsPost)
     {
         SettingParameterItem postVal = new SettingParameterItem();
         postVal.WatermarkSeat = SiteFun.ToInt(SiteFun.Post("ws"));
         postVal.WatermarkPath = SiteFun.Post("wmPath");
         postVal.ArticleNum = SiteFun.ToInt(SiteFun.Post("artNum"));
         postVal.CommentNum = SiteFun.ToInt(SiteFun.Post("cmtNum"));
         postVal.AppendFineArticleNum = SiteFun.ToInt(SiteFun.Post("appFAN"));
         postVal.AppendRandomArticleNum = SiteFun.ToInt(SiteFun.Post("appRAN"));
         postVal.AppendHotArticleNum = SiteFun.ToInt(SiteFun.Post("appHAN"));
         postVal.AppendHotTagNum = SiteFun.ToInt(SiteFun.Post("appHTN"));
         postVal.AppendNewCommentNum = SiteFun.ToInt(SiteFun.Post("appNCN"));
         postVal.RssNum = SiteFun.ToInt(SiteFun.Post("rssNum"));
         postVal.RssMode = SiteFun.ToInt(SiteFun.Post("rssMode"));
         postVal.Key = SiteFun.Post("key");
         setData.UpdateSettingParameter(postVal);
         sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat")));
         ClearCache();
     }
     SettingItem old = setData.GetSetting();
     sr.Append(HtmlUI.FormStart());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RssNum")) + HtmlUI.CreateTd(HtmlUI.Input("rssNum", 5, null, old.Parameter.RssNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RssMode")) + HtmlUI.CreateTd(HtmlUI.RadioInput(SiteDat.GetLan("ShowExplain"), "rssMode", 0, old.Parameter.RssMode == 0) + HtmlUI.RadioInput(SiteDat.GetLan("ShowContent"), "rssMode", 1, old.Parameter.RssMode == 1)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("ArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("artNum", 5, null, old.Parameter.ArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("CmtNum")) + HtmlUI.CreateTd(HtmlUI.Input("cmtNum", 5, null, old.Parameter.CommentNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("TopArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appFAN", 5, null, old.Parameter.AppendFineArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("RandomArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appRAN", 5, null, old.Parameter.AppendRandomArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("HotArtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appHAN", 5, null, old.Parameter.AppendHotArticleNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("HotTagNum")) + HtmlUI.CreateTd(HtmlUI.Input("appHTN", 5, null, old.Parameter.AppendHotTagNum)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("NewCmtNum")) + HtmlUI.CreateTd(HtmlUI.Input("appNCN", 5, null, old.Parameter.AppendNewCommentNum)));
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd());
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //水印设置
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     ArrayList values = new ArrayList();
     for (int wmI = 0; wmI <= 9; wmI++)
     {
         values.Add(wmI);
     }
     ArrayList caps = new ArrayList();
     caps.Add(SiteDat.GetLan("Close"));
     caps.Add(SiteDat.GetLan("PTopLeft"));
     caps.Add(SiteDat.GetLan("PTopCen"));
     caps.Add(SiteDat.GetLan("PTopRight"));
     caps.Add(SiteDat.GetLan("PMdlLeft"));
     caps.Add(SiteDat.GetLan("PMdlCen"));
     caps.Add(SiteDat.GetLan("PMdlRight"));
     caps.Add(SiteDat.GetLan("PBtmLeft"));
     caps.Add(SiteDat.GetLan("PBtmCen"));
     caps.Add(SiteDat.GetLan("PBtmRight"));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("WmPosition")));
     sr.Append(HtmlUI.CreateTd(HtmlUI.Input("wmPath", 50, null, SiteFun.HtmlEncode(old.Parameter.WatermarkPath)) + HtmlUI.CreateSelect("ws", values, caps, old.Parameter.WatermarkSeat)));
     sr.Append(HtmlUI.TrFinal());
     if (File.Exists(Path.Combine(SiteCfg.Router, old.Parameter.WatermarkPath)))
     {
         sr.Append(HtmlUI.CreateTh());
         sr.Append(HtmlUI.CreateTd(HtmlUI.Image(SiteCfg.Path + old.Parameter.WatermarkPath, old.Parameter.WatermarkPath)));
         sr.Append(HtmlUI.TrFinal());
     }
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //水印
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("BusinessKey")) + HtmlUI.CreateTd(HtmlUI.Input("key", 15, null, SiteFun.HtmlEncode(old.Parameter.Key))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton()));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     sr.Append(HtmlUI.FormFinal());
     return sr.ToString();
 }
 /// <summary>
 /// 提交页面窗体
 /// </summary>
 /// <returns>返回发布页面控件代码</returns>
 public string Post()
 {
     StringBuilder sr = new StringBuilder();
     int id = SiteFun.ToInt(SiteFun.Query("id"));
     CommentData cmtData = new CommentData(conn);
     CommentItem old = cmtData.GetComment(id);
     PostItem postItem = new PostData(conn).GetPost(old.PostID);
     if (SiteFun.IsPost)
     {
         bool sendMail = false;
         if (SiteFun.ToInt(SiteFun.Post("sendMail")) != 0) { sendMail = true; }
         CommentItem postVal = new CommentItem();
         postVal.ID = id;
         postVal.PostID = postItem.ID;
         postVal.Author = old.Author;
         postVal.Mail = old.Mail;
         postVal.URL = old.URL;
         postVal.Title = old.Title;
         postVal.Content = old.Content;
         postVal.Reply = SiteFun.Post("reply");
         postVal.Trackback = SiteFun.ToInt(SiteFun.Post("isTb")) == 0 ? false : true;
         postVal.Publish = old.Publish;
         postVal.Verify = SiteFun.ToInt(SiteFun.Post("verify")) == 0 ? false : true;
         if (string.IsNullOrEmpty(postVal.Author)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoAuthor"))); }
         else
         {
             if (string.IsNullOrEmpty(postVal.Mail)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoMail"))); }
             else
             {
                 if (string.IsNullOrEmpty(postVal.Content)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoContent"))); }
                 else
                 {
                     try
                     {
                         if (sendMail)
                         {
                             SettingBasicItem basic = new SettingData(conn).GetSetting().Basic;
                             SiteMail mail = new SiteMail();
                             mail.To = old.Mail;
                             mail.Subject = string.Format(SiteDat.GetLan("MailTitle"), basic.Name);
                             mail.From = basic.MailFrom;
                             mail.Body = string.Format("<p><b>{0}: </b>{1}</p><p><b>{2}: </b>{3}</p><p><b>{4}: </b>{5}</p>", SiteDat.GetLan("Content"), SiteFun.ClearHtml(old.Content), SiteDat.GetLan("Reply"), SiteFun.ClearHtml(postVal.Reply), SiteDat.GetLan("URL"), string.Format(SitePath.ArticleLinkFormat, basic.URL, postItem.Local));
                             mail.Host = basic.MailHost;
                             mail.Port = basic.MailPort;
                             mail.UserName = basic.MailUserID;
                             mail.Password = basic.MailPassword;
                             mail.Send();
                         }
                         sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgSaveSucc"), "?act=comment&mode=list"));
                     }
                     catch (Exception err) { sr.Append(AdminUI.ErrorBox(err.Message)); }
                     old = cmtData.GetComment(cmtData.UpdateComment(postVal));
                 }
             }
         }
         ClearCache();
     }
     //取得默认值
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.FormStart());
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Author")) + HtmlUI.CreateTd(SiteFun.HtmlEncode(old.Author)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Mail")) + HtmlUI.CreateTd(SiteFun.HtmlEncode(old.Mail)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Website")) + HtmlUI.CreateTd(HtmlUI.Link(SiteFun.HtmlEncode(old.URL), old.URL, null, true)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Article")) + HtmlUI.CreateTd(SiteFun.HtmlEncode(postItem.Title)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Content")) + HtmlUI.CreateTd(SiteFun.HtmlEncode(old.Content)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Reply")) + HtmlUI.CreateTd(AdminUI.Editor("reply", SiteFun.HtmlEncode(old.Reply))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("DateTime")) + HtmlUI.CreateTd(old.Publish));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Virtue")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("Trackback"), "isTb", 1, old.Trackback) + HtmlUI.CheckBoxInput(SiteDat.GetLan("Verify"), "verify", 1, old.Verify) + HtmlUI.CheckBoxInput(SiteDat.GetLan("MailNotice"), "sendMail", 1, false)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton()));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(HtmlUI.FormFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     return sr.ToString();
 }
 /// <summary>
 /// 取得评论列表
 /// </summary>
 /// <param name="msg">返回消息</param>
 /// <param name="artID">文章编号</param>
 private void PrintList(string msg, int artID)
 {
     //初始化引擎
     SettingItem setting = new SettingData(conn).GetSetting();
     int page = SiteFun.ToInt(SiteFun.Query("page"));
     int pageSize = setting.Parameter.CommentNum;
     string listHtml = new CommentUI(conn).GetCommentList(artID, page, pageSize);
     string xmlInner = string.Format("\t\t<html>{0}</html>", SiteFun.CDATA(listHtml));
     string xml = new _ServiceBaseXml().OutBaseXml(msg, xmlInner);
     //输出
     HttpContext.Current.Response.ContentType = "text/xml";
     HttpContext.Current.Response.Write(xml);
 }
Exemple #11
0
 /// <summary>
 /// 备份和恢复
 /// </summary>
 public string Backup()
 {
     StringBuilder sr = new StringBuilder();
     string backupPath = Path.Combine(SiteCfg.Router, "Common/Data/Backup/");
     if (SiteFun.IsPost)
     {
         try
         {
             bool dbSel = SiteFun.ToInt(SiteFun.Post("dbSel")) > 0;
             bool attachSel = SiteFun.ToInt(SiteFun.Post("attachSel")) > 0;
             bool delBackup = SiteFun.ToInt(SiteFun.Post("del")) > 0;
             bool sendMail = SiteFun.ToInt(SiteFun.Post("sendMail")) > 0;
             string fileName = SiteFun.Post("fileName");
             //开始备份数据
             if (dbSel || attachSel)
             {
                 if (dbSel)
                 {
                     string dbFile = HttpContext.Current.Server.MapPath(SiteCfg.DBPath);
                     string tmpSavFileName = string.Format("{1}-{0}.bak", Path.GetFileNameWithoutExtension(dbFile), DateTime.Now.ToString("yyyyMMdd"));
                     File.Copy(dbFile, Path.Combine(backupPath, tmpSavFileName), true);
                 }
                 //开始备份附件
                 if (attachSel)
                 {
                     //Folder.CopyFolder(Path.Combine(SiteCfg.Router, @"Attach\"), Path.Combine(rootFolder, @"Attach\"));
                 }
                 sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgBackupSucc")));
             }
             else
             {
                 if (sendMail)
                 {
                     SettingBasicItem basic = new SettingData(conn).GetSetting().Basic;
                     SiteMail mail = new SiteMail();
                     string dt = DateTime.Now.ToString("yyyy-MM-dd");
                     mail.To = basic.Mail;
                     mail.Subject = string.Format("{0} DB BAK, {1}", basic.Name, dt);
                     mail.From = basic.MailFrom;
                     mail.Body = "Time: " + dt;
                     mail.Host = basic.MailHost;
                     mail.Port = basic.MailPort;
                     mail.UserName = basic.MailUserID;
                     mail.Password = basic.MailPassword;
                     mail.Send(Path.Combine(backupPath, fileName));
                     sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgBackupSucc")));
                 }
                 if (delBackup)
                 {
                     File.Delete(Path.Combine(backupPath, fileName));
                     sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgDelBackupSucc")));
                 }
             }
         }
         catch (Exception err) { sr.Append(AdminUI.ErrorBox(err.Message)); }
     }
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.FormStart());
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Backup")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("Database"), "dbSel", 1, false)));
     /*sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Backup")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("Database"), "dbSel", 1, false) + HtmlUI.CheckBoxInput(SiteDat.GetLan("Attach"), "attachSel", 1, false)));*/
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton()));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(HtmlUI.FormFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //列表
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("FileName")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("DateTime")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Size")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Delete")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("MailNotice")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Operate")));
     sr.Append(HtmlUI.TrFinal());
     //循环
     int i = 1;
     foreach (string file in Directory.GetFiles(backupPath))
     {
         i++;
         FileInfo fileInfo = new FileInfo(file);
         sr.Append(HtmlUI.FormStart());
         sr.Append(HtmlUI.TrStart(i % 2 == 0 ? " cRow" : null));
         sr.Append(HtmlUI.CreateTd(fileInfo.Name));
         sr.Append(HtmlUI.CreateTd(fileInfo.CreationTime));
         sr.Append(HtmlUI.CreateTd(SiteFun.ToInt(fileInfo.Length / 1024) + " Kb"));
         sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("del", 1, false)));
         sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("sendMail", 1, false)));
         sr.Append(HtmlUI.CreateTd(HtmlUI.HiddenInput("fileName", SiteFun.HtmlEncode(fileInfo.Name)) + HtmlUI.SubmitButton()));
         sr.Append(HtmlUI.TrFinal());
         sr.Append(HtmlUI.FormFinal());
     }
     //循环结束
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     return sr.ToString();
 }
 /// <summary>
 /// 提交分类数据
 /// </summary>
 /// <returns>返回发布分类代码</returns>
 public string Post()
 {
     StringBuilder sr = new StringBuilder();
     int id = SiteFun.ToInt(SiteFun.Query("id"));
     string theme = new SettingData(conn).GetTheme;
     ColumnData cateData = new ColumnData(conn);
     //取得默认值
     ColumnItem old = cateData.GetColumn(id);
     if (old.ID == 0)
     {
         //默认显示
         old.Show = true;
     }
     if (SiteFun.IsPost)
     {
         ColumnItem postVal = new ColumnItem();
         postVal.ID = id;
         postVal.Name = SiteFun.Post("name");
         postVal.Local = SiteFun.Post("local");
         postVal.Target = SiteFun.Post("target");
         postVal.ListTemplate = SiteFun.Post("listTpl");
         postVal.ViewTemplate = SiteFun.Post("viewTpl");
         postVal.PageSize = SiteFun.ToInt(SiteFun.Post("pageSize"));
         postVal.Jump = SiteFun.ToInt(SiteFun.Post("jump")) == 0 ? false : true;
         postVal.JumpUrl = SiteFun.Post("jumpUrl");
         postVal.Intro = SiteFun.Post("intro");
         postVal.Sorting = SiteFun.ToInt(SiteFun.Post("sorting"));
         postVal.Nav = SiteFun.ToInt(SiteFun.Post("nav")) == 0 ? false : true;
         postVal.Show = SiteFun.ToInt(SiteFun.Post("show")) == 0 ? false : true;
         if (string.IsNullOrEmpty(postVal.Name)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoName"))); }
         else
         {
             if (!string.IsNullOrEmpty(postVal.Local)) { postVal.Local = postVal.Local.Replace(" ", "-"); }
             if (!string.IsNullOrEmpty(postVal.Local) && (!SiteFun.IsLocal(postVal.Local) || cateData.ExistsLocal(postVal.Local, postVal.ID))) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoLocalOrExists"))); }
             else
             {
                 if (postVal.ID == 0)
                 {
                     cateData.InsertColumn(postVal);
                     sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgInsertDat"), "?act=column&mode=list"));
                 }
                 else
                 {
                     cateData.UpdateColumn(postVal);
                     sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat"), "?act=column&mode=list"));
                 }
             }
         }
         ClearCache();
         old = postVal;
     }
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.FormStart());
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Name")) + HtmlUI.CreateTd(HtmlUI.Input("name", 20, null, SiteFun.HtmlEncode(old.Name))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     if (Regex.IsMatch(old.Local, @"^\d+$")) { old.Local = string.Empty; }
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Local")) + HtmlUI.CreateTd(string.Format(SitePath.CategoryLinkFormat, null, HtmlUI.Input("local", 15, null, SiteFun.HtmlEncode(old.Local)))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("Jump"), "jump", 1, old.Jump) + HtmlUI.Input("jumpUrl", 50, null, SiteFun.HtmlEncode(old.JumpUrl))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Intro")) + HtmlUI.CreateTd(HtmlUI.Input("intro", 50, null, SiteFun.HtmlEncode(old.Intro))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Sorting")) + HtmlUI.CreateTd(HtmlUI.Input("sorting", 5, null, old.Sorting)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Target")) + HtmlUI.CreateTd(HtmlUI.Input("target", 10, null, SiteFun.HtmlEncode(old.Target))));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("ListTpl")) + HtmlUI.CreateTd(string.Format(SitePath.ThemePathFormat, theme, HtmlUI.Input("listTpl", 15, null, SiteFun.HtmlEncode(old.ListTemplate)))));
     sr.Append(HtmlUI.TrFinal());
     if (!string.IsNullOrEmpty(old.ListTemplate) && !File.Exists(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, theme, old.ListTemplate))))
     {
         sr.Append(HtmlUI.TrStart());
         sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(string.Format(SiteDat.GetLan("MsgFileNotExistsFormat"), old.ListTemplate)));
         sr.Append(HtmlUI.TrFinal());
     }
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("ViewTpl")) + HtmlUI.CreateTd(string.Format(SitePath.ThemePathFormat, theme, HtmlUI.Input("viewTpl", 15, null, SiteFun.HtmlEncode(old.ViewTemplate)))));
     sr.Append(HtmlUI.TrFinal());
     if (!string.IsNullOrEmpty(old.ViewTemplate) && !File.Exists(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, theme, old.ViewTemplate))))
     {
         sr.Append(HtmlUI.TrStart());
         sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(string.Format(SiteDat.GetLan("MsgFileNotExistsFormat"), old.ViewTemplate)));
         sr.Append(HtmlUI.TrFinal());
     }
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("PageSize")) + HtmlUI.CreateTd(HtmlUI.Input("pageSize", 5, null, old.PageSize)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Virtue")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("Nav"), "nav", 1, old.Nav) + HtmlUI.CheckBoxInput(SiteDat.GetLan("Show"), "show", 1, old.Show)));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton()));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(HtmlUI.FormFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     return sr.ToString();
 }
        /// <summary>
        /// 提交文章窗体
        /// </summary>
        /// <param name="mode">模式:A-文章,P-单页</param>
        /// <returns>返回发布文章控件代码</returns>
        public string Post(string mode)
        {
            StringBuilder sr = new StringBuilder();
            if (mode == "A" || mode == "P")
            {
                bool isArticle = mode == "A";
                SettingItem setting = new SettingData(conn).GetSetting();
                string theme = new SettingData(conn).GetTheme;
                string tmpFilePath = Path.Combine(SiteCfg.Router, "Common/Temp/post_cache.tmp");
                int id = SiteFun.ToInt(SiteFun.Query("id"));
                PostData artData = new PostData(conn);
                ColumnData cData = new ColumnData(conn);
                TagData tagData = new TagData(conn);
                //取得默认值
                string[] myUserInfo = _ac.Get();
                UserItem myUser = new UserData(conn).CheckUser(myUserInfo[0], SiteFun.Encryption(myUserInfo[1]), true);
                PostItem old = artData.GetPost(id);
                ColumnItem oldColumn = new ColumnData(conn).GetColumn(old.ColumnID);
                if (old.ID == 0)
                {
                    //默认显示、可评论并自动审核,可发通告
                    old.Show = true;
                    old.SwitchComment = true;
                    old.AutoVerifyComment = true;
                    old.SwitchTrackback = true;
                }
                if (string.IsNullOrEmpty(old.Author)) { old.Author = myUser.Name; }
                if (SiteFun.IsPost)
                {
                    //处理文章数据
                    PostItem postVal = new PostItem();
                    string content = SiteFun.HtmlMatch(SiteFun.Post("content"));
                    string explain = content;
                    if (!string.IsNullOrEmpty(explain))
                    {
                        explain = Regex.Replace(explain, SiteCfg.PageBreakRegular, SiteCfg.PageBreakSymbol, RegexOptions.Multiline | RegexOptions.IgnoreCase);
                        if (explain.IndexOf(SiteCfg.PageBreakSymbol) > 0)
                        {
                            explain = explain.Substring(0, explain.IndexOf(SiteCfg.PageBreakSymbol));
                            explain = SiteFun.HtmlMatch(explain);
                        }
                        explain = explain.Replace(SiteCfg.PageBreakSymbol, string.Empty);
                    }
                    postVal.ID = id;
                    postVal.ColumnID = SiteFun.ToInt(SiteFun.Post("cid"));
                    postVal.Title = SiteFun.Post("title");
                    postVal.Tags = SiteFun.Post("tags");
                    postVal.Local = SiteFun.Post("local");
                    postVal.Explain = explain;
                    postVal.Content = content;
                    postVal.Author = SiteFun.Post("author");
                    postVal.Publish = SiteFun.ToDate(SiteFun.Post("publish"));
                    postVal.Password = SiteFun.Post("pwd");
                    postVal.Vote = SiteFun.ToInt(SiteFun.Post("vote"));
                    postVal.Reader = SiteFun.ToInt(SiteFun.Post("reader"));
                    postVal.Fine = SiteFun.ToInt(SiteFun.Post("fine")) == 0 ? false : true;
                    postVal.Show = SiteFun.ToInt(SiteFun.Post("show")) == 0 ? false : true;
                    postVal.PostCount = old.PostCount;
                    postVal.SwitchComment = SiteFun.ToInt(SiteFun.Post("switchCmt")) == 0 ? false : true;
                    postVal.SwitchTrackback = SiteFun.ToInt(SiteFun.Post("switchTb")) == 0 ? false : true;
                    postVal.AutoVerifyComment = SiteFun.ToInt(SiteFun.Post("avcmt")) == 0 ? false : true;
                    postVal.AutoVerifyTrackback = SiteFun.ToInt(SiteFun.Post("avtb")) == 0 ? false : true;
                    postVal.Attachments = old.Attachments;
                    //分类
                    ColumnItem postColumn = new ColumnData(conn).GetColumn(postVal.ColumnID);
                    if (string.IsNullOrEmpty(postVal.Title)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoTitle"))); }
                    else
                    {
                        if (!string.IsNullOrEmpty(postVal.Local)) { postVal.Local = postVal.Local.Replace(" ", "-"); }
                        if (!string.IsNullOrEmpty(postVal.Local) && (!SiteFun.IsLocal(postVal.Local) || artData.ExistsLocal(postVal.Local, postVal.ID))) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoLocalOrExists"))); }
                        else
                        {
                            //处理上传图片的内容循环替换
                            if (!string.IsNullOrEmpty(postVal.Content))
                            {
                                string[] tmpFilesHandle = { postVal.Content, postVal.Explain };
                                string atts = new _AdminUpload(conn).SaveAs(HttpContext.Current.Request.Files, ref tmpFilesHandle[0], ref tmpFilesHandle[1], SiteFun.ToInt(SiteFun.Post("ws")), Path.Combine(SiteCfg.Router, setting.Parameter.WatermarkPath));
                                postVal.Content = tmpFilesHandle[0];
                                postVal.Explain = tmpFilesHandle[1];
                                if (!string.IsNullOrEmpty(atts))
                                {
                                    if (string.IsNullOrEmpty(postVal.Attachments)) { postVal.Attachments = atts; }
                                    else { postVal.Attachments += "," + atts; }
                                }
                            }
                            //保存或新增文章数据处理
                            if (postVal.ID == 0)
                            {
                                artData.InsertPost(postVal, mode);
                                //标签处理
                                tagData.InsertTagList(postVal.Tags);
                                //分类统计
                                //cData.CountCategoryPost(postVal.Category.ID);
                                sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgArtInsertSucc"), "?act=post&mode=list&M=" + mode));
                            }
                            else
                            {
                                artData.UpdatePost(postVal);
                                //标签处理
                                tagData.InsertTagList(postVal.Tags);
                                //类统计
                                cData.CountColumnPost(oldColumn.ID);
                                cData.CountColumnPost(postColumn.ID);
                                //更新修改后的显示
                                sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgArtUpdateSucc"), "?act=post&mode=list&M=" + mode));
                            }
                            try { File.Delete(tmpFilePath); }
                            catch { }
                        }
                    }
                    //处理引用通告
                    TrackbackLogData tbld = new TrackbackLogData(conn);
                    SettingBasicItem sbi = setting.Basic;
                    string tbUrls = SiteFun.Post("tbUrls");
                    if (!string.IsNullOrEmpty(tbUrls))
                    {
                        foreach (string vItem in tbUrls.Split('\n'))
                        {
                            if (!string.IsNullOrEmpty(vItem))
                            {
                                string[] tbState = new SiteTrackback().SendTrackback(vItem, string.Format(SitePath.ArticleLinkFormat, sbi.URL + SiteCfg.Path, postVal.Local), sbi.Name, postVal.Title, SiteFun.ClearHtml(postVal.Explain)).Split('|');
                                TrackbackLogItem tbVal = new TrackbackLogItem();
                                tbVal.Error = SiteFun.ToInt(tbState[0]) == 0 ? false : true;
                                tbVal.Message = tbState[1];
                                tbVal.URL = vItem;
                                tbld.InsertTrackbackLog(tbVal);
                            }
                        }
                    }
                    ClearCache();
                    old = postVal;
                }
                //设置分类数据
                DataList<ColumnItem> cateList = cData.SelectColumn(-1, 0, true);
                ArrayList values = new ArrayList();
                ArrayList captions = new ArrayList();
                for (int i = 0; i < cateList.Count; i++)
                {
                    values.Add(cateList[i].ID);
                    captions.Add(cateList[i].Name);
                }
                sr.Append(AdminUI.AdminBoxStart(true));
                sr.Append(HtmlUI.FormStart(null, true));

                sr.Append(HtmlUI.TableStart("onCenter advancedBox"));
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Title")) + HtmlUI.CreateTd(HtmlUI.Input("title", 50, null, SiteFun.HtmlEncode(old.Title)) + (isArticle ? HtmlUI.CreateSelect("cid", values, captions, oldColumn.ID) : string.Empty)));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                if (Regex.IsMatch(old.Local, @"^\d+$")) { old.Local = string.Empty; }
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Local")) + HtmlUI.CreateTd(string.Format((isArticle ? SitePath.ArticleLinkFormat : SitePath.PageLinkFormat), null, HtmlUI.Input("local", 30, null, SiteFun.HtmlEncode(old.Local)))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Content")) + HtmlUI.CreateTd(AdminUI.Editor("content", SiteFun.HtmlEncode(old.Content))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd((File.Exists(tmpFilePath) ? "<a id=\"reInsertContent\">" + SiteDat.GetLan("MsgClickArtReload") + "</a>" : string.Empty) + string.Format(SiteDat.GetLan("MsgArtAutoSaveState"), "<span id=\"autoSaveCountdown\">--</span>", "<a id=\"autoSaveButton\">--</a>", "<span id=\"autoSaveIs\"></span>")));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Attach") + ", <a id=\"addFilesA\">" + SiteDat.GetLan("Add") + "</a>") + HtmlUI.CreateTd(string.Format("<span id=\"filesMainBox\">{0}</span><a id=\"filesMainInsertA\">{1}</a><div id=\"filesAttBox\"></div>", HtmlUI.FileInput(null, "files"), SiteDat.GetLan("Insert"))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TableFinal());

                sr.Append(HtmlUI.TableStart("onCenter hidden advancedBox"));
                string attsHtml = string.Empty;
                DataList<AttachmentItem> attachments = new AttachmentData(conn).SelectAttachment(old.Attachments);
                foreach (AttachmentItem att in attachments)
                {
                    attsHtml += HtmlUI.Link(att.Name, att.Path, att.Type, true) + string.Format(", {0}, {1}, {2}<br/>", att.Publish, att.Size, att.Type);
                }
                if (attachments.Count > 0)
                {
                    sr.Append(HtmlUI.TrStart());
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Attach")) + HtmlUI.CreateTd(attsHtml));
                    sr.Append(HtmlUI.TrFinal());
                }
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Tag")) + HtmlUI.CreateTd(HtmlUI.Input("tags", "tags", 50, null, SiteFun.HtmlEncode(old.Tags))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.Button("getInputTags", SiteDat.GetLan("BtnTagsNow")) + "<div id=\"getInputTagsDsp\"></div>"));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Author")) + HtmlUI.CreateTd(HtmlUI.Input("author", 10, null, SiteFun.HtmlEncode(old.Author))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Time")) + HtmlUI.CreateTd(HtmlUI.Input("timeInput", "publish", 20, null, old.Publish) + HtmlUI.Button("updateTime", SiteDat.GetLan("BtnUpdateTime"))));
                sr.Append(HtmlUI.TrFinal());
                if (isArticle)
                {
                    sr.Append(HtmlUI.TrStart());
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Pwd")) + HtmlUI.CreateTd(HtmlUI.Input("pwd", 30, null, old.Password)));
                    sr.Append(HtmlUI.TrFinal());
                }
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("VoteNum")) + HtmlUI.CreateTd(HtmlUI.Input("vote", 5, null, old.Vote)));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Reader")) + HtmlUI.CreateTd(HtmlUI.Input("reader", 5, null, old.Reader)));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Virtue")) + HtmlUI.CreateTd((isArticle ? HtmlUI.CheckBoxInput(SiteDat.GetLan("Top"), "fine", 1, old.Fine) : string.Empty) + HtmlUI.CheckBoxInput(SiteDat.GetLan("Show"), "show", 1, old.Show)));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                ArrayList wmValues = new ArrayList();
                ArrayList caps = new ArrayList();
                for (int wmI = 0; wmI <= 9; wmI++) { wmValues.Add(wmI); }
                caps.Add("--" + SiteDat.GetLan("WmPosition") + "--");
                caps.Add(SiteDat.GetLan("PTopLeft"));
                caps.Add(SiteDat.GetLan("PTopCen"));
                caps.Add(SiteDat.GetLan("PTopRight"));
                caps.Add(SiteDat.GetLan("PMdlLeft"));
                caps.Add(SiteDat.GetLan("PMdlCen"));
                caps.Add(SiteDat.GetLan("PMdlRight"));
                caps.Add(SiteDat.GetLan("PBtmLeft"));
                caps.Add(SiteDat.GetLan("PBtmCen"));
                caps.Add(SiteDat.GetLan("PBtmRight"));
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Switch")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("InsertCmt"), "switchCmt", 1, old.SwitchComment) + HtmlUI.CheckBoxInput(SiteDat.GetLan("InsertTb"), "switchTb", 1, old.SwitchTrackback) + HtmlUI.CreateSelect("ws", wmValues, caps, setting.Parameter.WatermarkSeat)));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("AutoVerify")) + HtmlUI.CreateTd(HtmlUI.CheckBoxInput(SiteDat.GetLan("VerifyCmt"), "avcmt", 1, old.AutoVerifyComment) + HtmlUI.CheckBoxInput(SiteDat.GetLan("VerifyTb"), "avtb", 1, old.AutoVerifyTrackback)));
                sr.Append(HtmlUI.TrFinal());
                if (isArticle)
                {
                    sr.Append(HtmlUI.TrStart());
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Trackback")) + HtmlUI.CreateTd(HtmlUI.Textarea("tbUrls", 5, 80, null)));
                    sr.Append(HtmlUI.TrFinal());
                }
                sr.Append(HtmlUI.TableFinal());

                sr.Append(HtmlUI.TableStart("onCenter"));
                sr.Append(HtmlUI.TrStart());
                sr.Append(HtmlUI.CreateTh() + HtmlUI.CreateTd(HtmlUI.SubmitButton() + HtmlUI.ResetButton() + HtmlUI.Button("advancedLink", SiteDat.GetLan("BtnAdvanced"))));
                sr.Append(HtmlUI.TrFinal());
                sr.Append(HtmlUI.TableFinal());

                sr.Append(HtmlUI.FormFinal());
                sr.Append(AdminUI.AdminBoxFinal());
            }
            return sr.ToString();
        }