Пример #1
0
 /// <summary>
 /// 取得页面列表窗体
 /// </summary>
 /// <returns>返回页面列表代码</returns>
 public string List(int pageSize)
 {
     StringBuilder sr = new StringBuilder();
     CommentData cmtData = new CommentData(conn);
     if (SiteFun.IsPost)
     {
         int id = SiteFun.ToInt(SiteFun.Post("id"));
         bool verify = SiteFun.ToInt(SiteFun.Post("verify")) == 0 ? false : true;
         bool del = SiteFun.ToInt(SiteFun.Post("del")) == 0 ? false : true;
         if (del)
         {
             cmtData.DeleteComment(id);
             sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgDelDat")));
         }
         else
         {
             cmtData.UpdateCommentVerify(id, verify);
             sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat")));
         }
         ClearCache();
     }
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.TableStart());
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Author")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Content")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Article")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("DateTime")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Verify")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Delete")));
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Operate")));
     sr.Append(HtmlUI.TrFinal());
     //下面三行是分页设置
     int page = SiteFun.ToInt(SiteFun.Query("page"));
     if (page < 1) { page = 1; }
     DataList<CommentItem> list = cmtData.SelectComment(0, page, pageSize, true);
     int i = 1;
     foreach (CommentItem vItem in list)
     {
         PostItem postItem = new PostData(conn).GetPost(vItem.PostID);
         i++;
         sr.Append(HtmlUI.FormStart());
         sr.Append(HtmlUI.TrStart(i % 2 == 0 ? " cRow" : null));
         sr.Append(HtmlUI.CreateTd(SiteFun.HtmlEncode(SiteFun.StrCut(vItem.Author, 10))));
         sr.Append(HtmlUI.CreateTd(HtmlUI.Link(SiteFun.HtmlEncode(SiteFun.StrCut(vItem.Content, 50)), string.Format("?act=comment&amp;mode=post&amp;id={0}", vItem.ID))));
         sr.Append(HtmlUI.CreateTd(HtmlUI.Link(SiteFun.HtmlEncode(SiteFun.StrCut(postItem.Title, 30)), string.Format("?act=post&amp;mode=post&amp;m=A&amp;id={0}", postItem.ID))));
         sr.Append(HtmlUI.CreateTd(vItem.Publish));
         sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("verify", 1, vItem.Verify)));
         sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("del", 1, false)));
         sr.Append(HtmlUI.CreateTd(HtmlUI.HiddenInput("id", vItem.ID) + HtmlUI.SubmitButton(SiteDat.GetLan("BtnSave"))));
         sr.Append(HtmlUI.TrFinal());
         sr.Append(HtmlUI.FormFinal());
     }
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTd(new SitePages().Make(list.Number, page, pageSize, "?act=comment&amp;mode=list&amp;page={0}"), 7, null));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     return sr.ToString();
 }
 /// <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);
 }
Пример #3
0
 /// <summary>
 /// 获取文章列表
 /// </summary>
 /// <param name="cid">分类编号</param>
 /// <param name="limit">数据条数</param>
 /// <param name="length">标题长度</param>
 /// <param name="orderMode">0-时间,1-随机,2-阅读数,3-投票</param>
 /// <returns>返回获取的文章列表</returns>
 public string GetArticleList(int cid, int limit, int length, int orderMode)
 {
     DataList<PostItem> list = new PostData(conn).SelectPost(cid, null, null, 1, limit, orderMode, "A", false);
     string html = string.Empty;
     foreach (PostItem vItem in list)
     {
         string title = length > 0 ? SiteFun.StrCut(vItem.Title, length) : vItem.Title;
         html += string.Format("<li><a href=\"{0}\" title=\"{1}\">{2}</a><span>{3}</span></li>\n", string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, vItem.Local), SiteFun.HtmlEncode(vItem.Title), title, vItem.Publish);
     }
     return html;
 }
Пример #4
0
 /// <summary>
 /// 获取下一篇文章
 /// </summary>
 /// <param name="artId">当前文章编号</param>
 /// <param name="len">标题显示长度</param>
 /// <param name="text">替换文本</param>
 /// <returns>返回下一篇文章的文字链</returns>
 public string GetNextArticle(int artId, int len, string text)
 {
     PostItem art = new PostData(conn).GetClosePost(artId, true, "A");
     if (art.ID > 0)
     {
         return string.Format("<a href=\"{0}\">{1}</a>", string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(art.Local)), (string.IsNullOrEmpty(text)) ? SiteFun.HtmlEncode(SiteFun.StrCut(art.Title, len)) : text);
     }
     else
     {
         return string.IsNullOrEmpty(text) ? "没有了" : text;
     }
 }
Пример #5
0
 /// <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);
 }
Пример #6
0
 /// <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();
 }
Пример #7
0
 /// <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();
 }
Пример #8
0
        /// <summary>
        /// 获取文章内容页完整XML内容
        /// </summary>
        /// <param name="id">文章编号</param>
        /// <param name="local">文章标签</param>
        /// <param name="pwd">文章密码</param>
        /// <param name="page">当前页(评论用)</param>
        /// <param name="pageSize">分页大小(评论用)</param>
        /// <returns>完整XML内容</returns>
        public string OutWriteView(int id, string local, string pwd, int page, int pageSize)
        {
            SettingItem setting = this.OutSetting;
            PostData artData = new PostData(conn);
            SiteDat SiteDat = new SiteDat();
            //取得文章列表数据
            PostItem art = new PostItem();
            if (id > 0)
            {
                if (SiteDat.GetDat(string.Format(SiteCache.PostFormat, id)) == null)
                {
                    SiteDat.SetDat(string.Format(SiteCache.PostFormat, id), artData.GetPost(id));
                }
                art = (PostItem)SiteDat.GetDat(string.Format(SiteCache.PostFormat, id));
            }
            else
            {
                if (SiteDat.GetDat(string.Format(SiteCache.PostFormat, local)) == null)
                {
                    SiteDat.SetDat(string.Format(SiteCache.PostFormat, local), artData.GetPost(local));
                }
                art = (PostItem)SiteDat.GetDat(string.Format(SiteCache.PostFormat, local));
            }
            //取得栏目数据
            ColumnItem columnItem = new ColumnItem();
            if (SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, art.ColumnID)) == null)
            {
                SiteDat.SetDat(string.Format(SiteCache.ColumnFormat, art.ColumnID), new ColumnData(conn).GetColumn(art.ColumnID));
            }
            columnItem = (ColumnItem)SiteDat.GetDat(string.Format(SiteCache.ColumnFormat, art.ColumnID));

            artData.AddPostReader(art.ID);
            //设置模板引擎
            //设置密码文章显示状态
            bool viewPwdArt = pwd == art.Password;
            //本页XML处理
            StringBuilder xml = new StringBuilder();
            xml.Append("\t\t<article>\n");
            xml.AppendFormat("\t\t\t\t<link>{0}</link>\n", SiteFun.CDATA(string.Format(SitePath.ArticleLinkFormat, SiteCfg.Path, SiteFun.UrlEncode(art.Local))));
            xml.AppendFormat("\t\t\t\t<id>{0}</id>\n", art.ID);
            xml.AppendFormat("\t\t\t\t<title>{0}</title>\n", SiteFun.CDATA(art.Title));
            xml.AppendFormat("\t\t\t\t<local>{0}</local>\n", SiteFun.CDATA(art.Local));
            xml.AppendFormat("\t\t\t\t<tags>{0}</tags>\n", SiteFun.CDATA(art.Tags));
            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.AppendFormat("\t\t\t\t<explain>{0}</explain>\n", SiteFun.CDATA(CheckPasswordContent(art.Password, art.Explain, art.Local, viewPwdArt)));
            xml.AppendFormat("\t\t\t\t<content>{0}</content>\n", SiteFun.CDATA(CheckPasswordContent(art.Password, art.Content, art.Local, viewPwdArt)));
            xml.AppendFormat("\t\t\t\t<publish>{0}</publish>\n", art.Publish);
            xml.AppendFormat("\t\t\t\t<author>{0}</author>\n", SiteFun.CDATA(art.Author));
            xml.AppendFormat("\t\t\t\t<postCount>{0}</postCount>\n", art.PostCount);
            xml.AppendFormat("\t\t\t\t<reader>{0}</reader>\n", art.Reader);
            xml.AppendFormat("\t\t\t\t<vote>{0}</vote>\n", art.Vote);
            xml.Append("\t\t</article>\n");
            xml.Append("\t\t<comments>\n");
            xml.AppendFormat("\t\t\t<html>{0}</html>\n", SiteFun.CDATA(new CommentUI(conn).GetCommentList(art.ID, page, pageSize)));
            xml.Append("\t\t</comments>\n");
            //绑定XML并写出
            string title = string.Empty;
            if (art.ID > 0) { title = string.Format("{0} - {1} - {2}", art.Title, columnItem.Name, setting.Basic.Name); }
            return new _WebBaseXml(conn).OutBaseXml(title, xml.ToString());
        }
Пример #9
0
 /// <summary>
 /// 取得密码文章内容
 /// </summary>
 public void OutWriteOfPasswordArticle()
 {
     //初始化引擎
     string msg = string.Empty;
     int error = 1;
     string cont = string.Empty;
     int artId = SiteFun.ToInt(SiteFun.Post("artId"));
     //0-阐述,1-内容
     int result = SiteFun.ToInt(SiteFun.Post("isContent"));
     PostItem art = new PostData(conn).GetPost(artId);
     if (art.ID > 0 && art.Show)
     {
         if (art.Password == SiteFun.Post("pwd"))
         {
             error = 0;
             cont = result == 0 ? art.Explain : art.Content;
         }
         else { msg = SiteDat.GetLan("MsgPwdErr"); }
     }
     else { msg = SiteDat.GetLan("MsgArtNotExists"); }
     StringBuilder xml = new StringBuilder();
     xml.AppendFormat("\t\t<error>{0}</error>\n", error);
     xml.AppendFormat("\t\t<result>{0}</result>\n", SiteFun.CDATA(cont));
     xml.Append(new _ServiceBaseXml().OutBaseXml(msg, xml.ToString()));
     HttpContext.Current.Response.ContentType = "text/xml";
     HttpContext.Current.Response.Write(xml);
 }
Пример #10
0
 /// <summary>
 /// 执行SQL语句
 /// </summary>
 public string SQL()
 {
     StringBuilder sr = new StringBuilder();
     string sql = SiteFun.Post("sql");
     bool reCount = SiteFun.ToInt(SiteFun.Post("reCount")) == 0 ? false : true;
     if (SiteFun.IsPost && reCount)
     {
         int count = new PostData(conn).CountPost();
         count += new ColumnData(conn).CountColumnPost();
         sr.Append(AdminUI.SuccessBox(string.Format(SiteDat.GetLan("MsgCountSucc"), count)));
     }
     //数量重计
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.FormStart());
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("ReCount")));
     sr.Append(HtmlUI.CreateTd(HtmlUI.HiddenInput("reCount", 1) + HtmlUI.SubmitButton(SiteDat.GetLan("BtnCount")) + SiteDat.GetLan("IntroCount")));
     sr.Append(HtmlUI.TrFinal());
     sr.Append(HtmlUI.TableFinal());
     sr.Append(HtmlUI.FormFinal());
     sr.Append(AdminUI.AdminBoxFinal());
     //SQL执行
     sr.Append(AdminUI.AdminBoxStart(true));
     sr.Append(HtmlUI.FormStart());
     sr.Append(HtmlUI.TableStart("onCenter"));
     sr.Append(HtmlUI.TrStart());
     sr.Append(HtmlUI.CreateTh("SQL") + HtmlUI.CreateTd(HtmlUI.Textarea("sql", 20, 0, SiteFun.HtmlEncode(sql))));
     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());
     //取得默认值
     if (SiteFun.IsPost && !string.IsNullOrEmpty(sql))
     {
         try
         {
             DataSet ds = new DataBase().ExecSql(sql);
             sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgExeSqlSucc")));
             //显示执行结果
             if (ds.Tables.Count > 0)
             {
                 sr.Append(AdminUI.AdminBoxStart(true));
                 sr.Append(HtmlUI.FormStart());
                 sr.Append(HtmlUI.TableStart());
                 sr.Append(HtmlUI.TrStart());
                 for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
                 {
                     sr.Append(HtmlUI.CreateTh(ds.Tables[0].Columns[i].ColumnName));
                 }
                 sr.Append(HtmlUI.TrFinal());
                 for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                 {
                     sr.Append(HtmlUI.TrStart());
                     for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                     {
                         sr.Append(HtmlUI.CreateTd(SiteFun.HtmlEncode(ds.Tables[0].Rows[i][j].ToString())));
                     }
                     sr.Append(HtmlUI.TrFinal());
                 }
                 sr.Append(HtmlUI.TableFinal());
                 sr.Append(HtmlUI.FormFinal());
                 sr.Append(AdminUI.AdminBoxFinal());
             }
         }
         catch (Exception err) { sr.Append(AdminUI.ErrorBox(err.Message)); }
     }
     return sr.ToString();
 }
Пример #11
0
 /// <summary>
 /// 系统文章分类操作
 /// </summary>
 /// <returns>分类列表及操作表单</returns>
 public string List()
 {
     StringBuilder sr = new StringBuilder();
     DataList<ColumnItem> list = new ColumnData(conn).SelectColumn(-1, -1, true);
     if (list.Count > 0)
     {
         ColumnData cData = new ColumnData(conn);
         if (SiteFun.IsPost)
         {
             //取值
             ColumnItem postVal = new ColumnItem();
             postVal.ID = SiteFun.ToInt(SiteFun.Post("id"));
             postVal.Name = SiteFun.Post("name");
             postVal.Sorting = SiteFun.ToInt(SiteFun.Post("sorting"));
             postVal.Show = SiteFun.ToInt(SiteFun.Post("show")) == 0 ? false : true;
             postVal.Nav = SiteFun.ToInt(SiteFun.Post("nav")) == 0 ? false : true;
             //处理
             if (string.IsNullOrEmpty(postVal.Name)) { sr.Append(AdminUI.ErrorBox(SiteDat.GetLan("MsgNoName"))); }
             else
             {
                 if (postVal.ID > 0)
                 {
                     if (SiteFun.ToInt(SiteFun.Post("del")) == 0) { cData.UpdateColumnSome(postVal.ID, postVal.Name, postVal.Sorting, postVal.Nav, postVal.Show); sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat"))); }
                     else
                     {
                         PostData pData = new PostData(conn);
                         foreach (PostItem tmpPost in pData.SelectPost(postVal.ID, 1, int.MaxValue, null))
                         {
                             //删除附件
                             if (!string.IsNullOrEmpty(tmpPost.Attachments))
                             {
                                 AttachmentData attData = new AttachmentData(conn);
                                 foreach (AttachmentItem delAtt in attData.SelectAttachment(tmpPost.Attachments))
                                 {
                                     File.Delete(Path.Combine(SiteCfg.Router, delAtt.Path));
                                 }
                                 attData.DeleteAttachment(tmpPost.Attachments);
                             }
                         }
                         cData.DeleteColumn(postVal.ID);
                         sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgDelDat")));
                     }
                 }
             }
             ClearCache();
         }
         sr.Append(AdminUI.AdminBoxStart(true));
         sr.Append(HtmlUI.TableStart());
         sr.Append(HtmlUI.TrStart());
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Name")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Article")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Sorting")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Nav")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Show")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Delete")));
         sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Operate")));
         sr.Append(HtmlUI.TrFinal());
         int i = 1;
         foreach (ColumnItem vItem in list)
         {
             i++;
             sr.Append(HtmlUI.FormStart());
             sr.Append(HtmlUI.TrStart(i % 2 == 0 ? " cRow" : null));
             sr.Append(HtmlUI.CreateTd(HtmlUI.HiddenInput("id", vItem.ID) + HtmlUI.Input("name", 10, null, SiteFun.HtmlEncode(vItem.Name)) + HtmlUI.Link(SiteDat.GetLan("Edit"), string.Format("?act=column&amp;mode=post&amp;id={0}", vItem.ID))));
             sr.Append(HtmlUI.CreateTd(vItem.PostCount));
             sr.Append(HtmlUI.CreateTd(HtmlUI.Input("sorting", 5, null, vItem.Sorting)));
             sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("nav", 1, vItem.Nav)));
             sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("show", 1, vItem.Show)));
             sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("del", 1, false)));
             sr.Append(HtmlUI.CreateTd(HtmlUI.SubmitButton(SiteDat.GetLan("BtnSave"))));
             sr.Append(HtmlUI.TrFinal());
             sr.Append(HtmlUI.FormFinal());
         }
         sr.Append(HtmlUI.TableFinal());
         sr.Append(AdminUI.AdminBoxFinal());
     }
     else { sr.Append(Post()); }
     return sr.ToString();
 }
Пример #12
0
 /// <summary>
 /// 显示内容
 /// </summary>
 /// <param name="sender">基类对象</param>
 /// <param name="e">事件对象</param>
 protected void Page_Load(object sender, EventArgs e)
 {
     using (_DbHelper conn = new _DbHelper(SiteCfg.Conn))
     {
         conn.Open();
         conn.BeginTransaction();
         try
         {
             XsltTemplate tpl = new XsltTemplate(conn);
             //初始化全局页面类库
             _WebBase wb = new _WebBase();
             wb.InitConn();
             //开始执行
             switch (SiteFun.Query("act"))
             {
                 case "page":
                     {
                         int id = SiteFun.ToInt(SiteFun.Query("id"));
                         string local = SiteFun.Query("local");
                         WebPage webPg = new WebPage(conn);
                         tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webPg.OutTheme, "Page.View")));
                         tpl.BindXml(webPg.OutWrite(id, local));
                         break;
                     }
                 case "tags":
                     {
                         WebTags webTags = new WebTags(conn);
                         tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webTags.OutTheme, "Tag.List")));
                         tpl.BindXml(webTags.OutWrite());
                         break;
                     }
                 case "fellows":
                     {
                         WebFellows webFlw = new WebFellows(conn);
                         tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webFlw.OutTheme, "Fellow.List")));
                         tpl.BindXml(webFlw.OutWrite());
                         break;
                     }
                 case "expand":
                     {
                         foreach (object type in new SiteExpand().GetTypes(typeof(IWebExpand).FullName))
                         {
                             IWebExpand iae = ((IWebExpand)type);
                             if (iae.Key == SiteFun.Query("key"))
                             {
                                 StringBuilder xml = new StringBuilder();
                                 xml.Append("\t\t<expand>\n");
                                 xml.AppendFormat("\t\t\t<css>{0}</css>\n", SiteFun.CDATA(iae.Css));
                                 xml.AppendFormat("\t\t\t<html>{0}</html>\n", SiteFun.CDATA(iae.OutHtml()));
                                 xml.Append("\t\t</expand>\n");
                                 tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, iae.OutTheme, "Expand.View")));
                                 tpl.BindXml(new _WebBaseXml(conn).OutBaseXml(iae.Name, xml.ToString()));
                                 break;
                             }
                         }
                         break;
                     }
                 default:
                     {
                         WebArticle webArt = new WebArticle(conn);
                         switch (SiteFun.Query("mode"))
                         {
                             case "view":
                                 {
                                     int id = SiteFun.ToInt(SiteFun.Query("id"));
                                     string local = SiteFun.Query("local");
                                     string pwd = SiteFun.Post("pwd");
                                     int page = SiteFun.ToInt(SiteFun.Query("page"));
                                     int pageSize = webArt.OutSetting.Parameter.CommentNum;
                                     string tplFile = "Article.View";
                                     PostItem postItem = new PostData(conn).GetPost(id);
                                     ColumnItem columnItem = new ColumnData(conn).GetColumn(postItem.ColumnID);
                                     if (postItem.ID == 0) { postItem = new PostData(conn).GetPost(local); }
                                     if (!string.IsNullOrEmpty(columnItem.ViewTemplate) && File.Exists(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webArt.OutTheme, columnItem.ViewTemplate)))) { tplFile = columnItem.ViewTemplate; }
                                     tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webArt.OutTheme, tplFile)));
                                     tpl.BindXml(webArt.OutWriteView(id, local, pwd, page, pageSize));
                                     break;
                                 }
                             default:
                                 {
                                     int cid = SiteFun.ToInt(SiteFun.Query("cid"));
                                     string clocal = SiteFun.Query("clocal");
                                     string tag = SiteFun.Query("tag");
                                     string key = SiteFun.Query("key");
                                     int page = SiteFun.ToInt(SiteFun.Query("page"));
                                     int pageSize = webArt.OutSetting.Parameter.ArticleNum;
                                     string tplFile = "Article.List";
                                     //开始处理
                                     ColumnItem column = new ColumnData(conn).GetColumn(cid);
                                     if (column.ID == 0) { column = new ColumnData(conn).GetColumn(clocal); }
                                     if (column.ID == 0 && string.IsNullOrEmpty(tag) && string.IsNullOrEmpty(key) && page == 0 && File.Exists(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webArt.OutTheme, "Index")))) { tplFile = "Index"; }
                                     else
                                     {
                                         if (column.ID > 0)
                                         {
                                             if (!string.IsNullOrEmpty(column.ListTemplate) && File.Exists(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webArt.OutTheme, column.ListTemplate)))) { tplFile = column.ListTemplate; }
                                             if (column.PageSize > 0) { pageSize = column.PageSize; }
                                         }
                                     }
                                     tpl.LoadXslt(Path.Combine(SiteCfg.Router, string.Format(SitePath.ThemePathFormat, webArt.OutTheme, tplFile)));
                                     tpl.BindXml(webArt.OutWriteList(cid, clocal, tag, key, page, pageSize));
                                     break;
                                 }
                         }
                         break;
                     }
             }
             if (conn.ExecuteCount > 0) { conn.Commit(); }
             tpl.Print();
         }
         catch (Exception err)
         {
             if (conn.ExecuteCount > 0) { conn.Rollback(); }
             IMyError exeError = new MyError();
             foreach (IMyError myError in new SiteExpand().GetTypes(typeof(IMyError).FullName))
             {
                 exeError = myError;
                 break;
             }
             exeError.PrintError(err);
         }
         conn.Close();
     }
 }
Пример #13
0
        /// <summary>
        /// 取得文章列表窗体
        /// </summary>
        /// <param name="mode">模式:A-文章,P-单页</param>
        /// <returns>返回文章列表代码</returns>
        public string List(string mode)
        {
            StringBuilder sr = new StringBuilder();
            int cid = SiteFun.ToInt(SiteFun.Query("cid"));
            string key = SiteFun.Query("key");
            //下面三行是分页设置
            int page = SiteFun.ToInt(SiteFun.Query("page"));
            if (page < 1) { page = 1; }
            int pageSize = 20;
            PostData pData = new PostData(conn);
            DataList<PostItem> list = pData.SelectPost(cid, null, key, page, pageSize, 0, mode, true);
            if (list.Count > 0)
            {
                if (mode == "A" || mode == "P")
                {
                    bool isArticle = mode == "A";
                    if (SiteFun.IsPost)
                    {
                        int id = SiteFun.ToInt(SiteFun.Post("id"));
                        bool del = SiteFun.ToInt(SiteFun.Post("del")) == 0 ? false : true;
                        if (del)
                        {
                            PostItem tmpPost = pData.GetPost(id);
                            //删除附件
                            if (!string.IsNullOrEmpty(tmpPost.Attachments))
                            {
                                AttachmentData attData = new AttachmentData(conn);
                                foreach (AttachmentItem delAtt in attData.SelectAttachment(tmpPost.Attachments))
                                {
                                    File.Delete(Path.Combine(SiteCfg.Router, delAtt.Path));
                                }
                                attData.DeleteAttachment(tmpPost.Attachments);
                            }
                            pData.DeletePost(id);
                            sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgArtDelSucc")));
                        }
                        else
                        {
                            bool fine = SiteFun.ToInt(SiteFun.Post("fine")) == 0 ? false : true;
                            bool show = SiteFun.ToInt(SiteFun.Post("show")) == 0 ? false : true;
                            pData.UpdatePostFineAndShow(id, fine, show);
                            sr.Append(AdminUI.SuccessBox(SiteDat.GetLan("MsgUpdateDat")));
                        }
                        ClearCache();
                    }
                    if (isArticle)
                    {
                        //设置分类数据
                        DataList<ColumnItem> cateList = new ColumnData(conn).SelectColumn(-1, 0, false);
                        ArrayList values = new ArrayList();
                        ArrayList captions = new ArrayList();
                        values.Add(0);
                        captions.Add("--" + SiteDat.GetLan("Category") + "--");
                        for (int j = 0; j < cateList.Count; j++)
                        {
                            values.Add(cateList[j].ID);
                            captions.Add(cateList[j].Name);
                        }
                        //搜索
                        sr.Append(AdminUI.AdminBoxStart(true));
                        sr.Append(HtmlUI.FormStart(false, null, false));
                        sr.Append(HtmlUI.TableStart("onCenter"));
                        sr.Append(HtmlUI.TrStart());
                        sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Search") + HtmlUI.HiddenInput("act", "post") + HtmlUI.HiddenInput("mode", "list") + HtmlUI.HiddenInput("m", mode)));
                        sr.Append(HtmlUI.CreateTd(HtmlUI.CreateSelect("cid", values, captions, cid) + HtmlUI.Input("key", 30, null, SiteFun.HtmlEncode(key)) + HtmlUI.SubmitButton(SiteDat.GetLan("Search"))));
                        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("Title")));
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Local")));
                    if (isArticle)
                    {
                        sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Category")));
                        sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Top")));
                    }
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Show")));
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Delete")));
                    sr.Append(HtmlUI.CreateTh(SiteDat.GetLan("Operate")));
                    sr.Append(HtmlUI.TrFinal());
                    int i = 1;
                    foreach (PostItem vItem in list)
                    {
                        i++;
                        sr.Append(HtmlUI.FormStart());
                        sr.Append(HtmlUI.TrStart(i % 2 == 0 ? " cRow" : null));
                        sr.Append(HtmlUI.CreateTd(HtmlUI.Link(SiteFun.HtmlEncode(SiteFun.StrCut(vItem.Title, 50)), string.Format("?act=post&amp;mode=post&amp;m={1}&amp;id={0}", vItem.ID, mode))));
                        sr.Append(HtmlUI.CreateTd(SiteFun.HtmlEncode(SiteFun.StrCut(vItem.Local, 30))));
                        if (isArticle)
                        {
                            sr.Append(HtmlUI.CreateTd(SiteFun.HtmlEncode(new ColumnData(conn).GetColumn(vItem.ColumnID).Name)));
                            sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("fine", 1, vItem.Fine)));
                        }
                        sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("show", 1, vItem.Show)));
                        sr.Append(HtmlUI.CreateTd(HtmlUI.CheckBoxInput("del", 1, false)));
                        sr.Append(HtmlUI.CreateTd(HtmlUI.HiddenInput("id", vItem.ID) + HtmlUI.SubmitButton(SiteDat.GetLan("BtnSave"))));
                        sr.Append(HtmlUI.TrFinal());
                        sr.Append(HtmlUI.FormFinal());
                    }
                    sr.Append(HtmlUI.TrStart());
                    sr.Append(HtmlUI.CreateTd(new SitePages().Make(list.Number, page, pageSize, "?act=post&amp;mode=list&amp;cid=" + cid + "&amp;key=" + SiteFun.UrlEncode(key) + "&amp;m=" + mode + "&amp;page={0}"), (isArticle ? 7 : 5), null));
                    sr.Append(HtmlUI.TrFinal());
                    sr.Append(HtmlUI.TableFinal());
                    sr.Append(AdminUI.AdminBoxFinal());
                }
            }
            else { sr.Append(Post(mode)); }
            return sr.ToString();
        }
Пример #14
0
        /// <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();
        }