예제 #1
0
        public bool updatesite(SiteGroupCms.Entity.Site obj)
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.ConditionExpress = "id=@id";
                _doh.AddConditionParameter("@id", obj.ID);
                _doh.AddFieldItem("title", obj.Title);
                _doh.AddFieldItem("webtitle", obj.WebTitle);
                //  _doh.AddFieldItem("location", obj.Location);

                _doh.AddFieldItem("description", obj.Description);
                _doh.AddFieldItem("meta_keywords", obj.Keyword);
                _doh.AddFieldItem("iswork", obj.IsWork);
                _doh.AddFieldItem("domain", obj.Domain);


                _doh.AddFieldItem("indextemplate", obj.Indextemplate);
                _doh.AddFieldItem("listtemplate", obj.Listtemplate);
                _doh.AddFieldItem("contenttemplate", obj.Contenttemplate);

                _doh.AddFieldItem("emailserver", obj.EmailServer);
                _doh.AddFieldItem("emailuser", obj.EmailUser);
                _doh.AddFieldItem("emailpwd", obj.EmailPwd);

                _doh.AddFieldItem("ftpserver", obj.FtpServer);
                _doh.AddFieldItem("ftpuser", obj.FtpUser);
                _doh.AddFieldItem("ftpport", obj.FtpPort);
                _doh.AddFieldItem("ftppwd", obj.FtpPwd);
                _doh.AddFieldItem("ftpdir", obj.FtpDir);
                int _update = _doh.Update("yy_siteinfo");
                return(_update == 1);
            }
        }
예제 #2
0
        public int addsite(SiteGroupCms.Entity.Site obj, int type)//站点类型  type 1,系统站点,2,普通站点  ,系统站点整个系统只有一个
        {
            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.AddFieldItem("title", obj.Title);
                _doh.AddFieldItem("webtitle", obj.WebTitle);
                _doh.AddFieldItem("location", obj.Location);

                _doh.AddFieldItem("meta_description", obj.Description);
                _doh.AddFieldItem("meta_keywords", obj.Keyword);
                _doh.AddFieldItem("iswork", obj.IsWork);
                _doh.AddFieldItem("domain", obj.Domain);
                _doh.AddFieldItem("type", type);//一般添加普通站点


                _doh.AddFieldItem("indextemplate", obj.Indextemplate);
                _doh.AddFieldItem("listtemplate", obj.Listtemplate);
                _doh.AddFieldItem("contenttemplate", obj.Contenttemplate);

                _doh.AddFieldItem("emailserver", obj.EmailServer);
                _doh.AddFieldItem("emailuser", obj.EmailUser);
                _doh.AddFieldItem("emailpwd", obj.EmailPwd);

                _doh.AddFieldItem("ftpserver", obj.FtpServer);
                _doh.AddFieldItem("ftpuser", obj.FtpUser);
                _doh.AddFieldItem("ftpport", obj.FtpPort);
                _doh.AddFieldItem("ftppwd", obj.FtpPwd);
                _doh.AddFieldItem("ftpdir", obj.FtpDir);


                return(_doh.Insert("yy_siteinfo"));
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Admin_Load("1", "json");
                _admin = (SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"];
                site   = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            }
            method     = Request.QueryString["method"];
            title      = Request.Form["title"];
            temcontent = Request.Form["temcontent"];
            type       = Request.Form["type_val"];
            filename   = Request.Form["filename"];
            source     = Request.Form["source"];
            id         = Request.Form["id"];
            switch (method)
            {
            case "add":
                addtemplate();
                break;

            case "update":
                updatetemplate();
                break;

            case "delete":
                deletetemplate();
                break;
            }
            Response.Write(_response);
        }
예제 #4
0
        private void getsiteinfo()
        {
            SiteGroupCms.Dal.AdminDal admindal = new SiteGroupCms.Dal.AdminDal();
            SiteGroupCms.Entity.Admin admin    = new SiteGroupCms.Entity.Admin();
            SiteGroupCms.Dal.RoleDal  roledal  = new SiteGroupCms.Dal.RoleDal();
            SiteGroupCms.Entity.Site  site     = new SiteGroupCms.Entity.Site();
            SiteGroupCms.Dal.SiteDal  sitedal  = new SiteGroupCms.Dal.SiteDal();
            if (id == "0")//站点id
            {
                site = (SiteGroupCms.Entity.Site)Session["site"];
            }
            else
            {
                site = sitedal.GetEntity(Str2Int(id));
            }

            SiteGroupCms.Entity.Role role = roledal.GetEntity(admin.RoleId);
            if (site != null)
            {
                _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"siteid\":" + site.ID + ",";
                _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Title) + ",\"webtitle\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.WebTitle) + ",\"iswork_val\":\"" + site.IsWork + "\",";
                _response += "\"location\":\"" + site.Location + "\",\"domain\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Domain) + ",\"keywords\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Keyword) + ",";
                _response += "\"description\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.Description) + ",\"ftpserver\":\"" + site.FtpServer + "\",\"ftpport\":\"" + site.FtpPort + "\",";
                _response += "\"ftpuser\":\"" + site.FtpUser + "\",\"ftppwd\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.FtpPwd) + ",\"ftpdir\":\"" + site.FtpDir + "\",";
                _response += "\"indextemplate_val\":\"" + site.Indextemplate + "\",\"listtemplate_val\":\"" + site.Listtemplate + "\",\"contenttemplate_val\":\"" + site.Contenttemplate + "\",";
                _response += "\"emailserver\":\"" + site.EmailServer + "\",\"emailuser\":\"" + site.EmailUser + "\",\"emailpwd\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.EmailPwd);
                _response += "}}";
            }
            Response.Write(_response);
        }
예제 #5
0
 protected void getftp()
 {
     SiteGroupCms.Dal.SiteDal sitedal = new SiteGroupCms.Dal.SiteDal();
     SiteGroupCms.Entity.Site site    = sitedal.GetBaseEntity();
     _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{";
     _response += "\"ftpserver\":\"" + site.FtpServer + "\",\"ftpport\":" + site.FtpPort + ",\"ftpuser\":\"" + site.FtpUser + "\"";
     _response += ",\"ftppwd\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.FtpPwd) + ",\"ftpdir\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(site.FtpDir) + "";
     _response += "}}";
     Response.Write(_response);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            Server.ScriptTimeout = 99999;
            Admin_Load("1", "json");
            type      = Request.QueryString["type"];
            ids       = Request.Form["ids"];
            catalogid = Request.Form["catalogid"];
            site      = (SiteGroupCms.Entity.Site)Session["site"];
            switch (type)
            {
            case "some":
                publishsome(ids);
                break;

            case "catalog":
                publishcatalog(catalogid, true);
                _response += "{\"IsError\":false,\"Message\":\"发布成功\",\"Data\":{\"art\":0}}";
                Response.Write(_response);
                break;

            case "site":
                publishsite();
                break;

            case "someall":
                publishallcontent();
                break;

            case "viewcatalog":
                viewcatalog();
                break;

            case "viewsite":
                viewsite();
                break;

            case "allsite":
                // System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(allsite));
                //  thread.Start();
                allsite();

                /* SiteGroupCms.Dal.work w = new Dal.work();
                 * if (w.State != 1)
                 * {
                 *   w.runwork();
                 *   //Page.RegisterStartupScript("", "<script>alert('hello world')</script>");
                 * }*/
                //  SiteGroupCms.Entity.Publicprocess publisprocess = (SiteGroupCms.Entity.Publicprocess)Session["publishprocess"];
                // _response = HttpContext.Current.Session["publishprocess"].ToString();

                break;
            }
        }
예제 #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Admin_Load("", "html");
         _admin = (SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"];
         site   = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
         loadmenu();
         //loadsite();
         weburl = "/sites/" + site.Location + "/pub/index.html";
     }
 }
예제 #8
0
        /// <summary>
        /// 取出栏目中需要生成的文件的总数目
        /// 包括文字也 栏目页 子集栏目页 和首页
        /// </summary>
        /// <returns></returns>
        public int getcatalogneespublishnum(string catalogid) //catalogid=0 表示从根站点开始
        {
            int total = 1;                                    //当前栏目页

            SiteGroupCms.Entity.Site        _site       = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            SiteGroupCms.Entity.Catalogtree catalogtree = getTree(_site.ID.ToString(), catalogid, true);
            //先计算所有需要发布的文档
            total += getpublishcontnum(catalogid);
            //在计算自己栏目
            for (int i = 0; i < catalogtree.SubChild.Count; i++)
            {
                total += getcatalogneespublishnum(catalogtree.SubChild[i].Id);
            }
            return(total);
        }
예제 #9
0
 public void updatesite()
 {
     SiteGroupCms.Entity.Site site    = new SiteGroupCms.Entity.Site();
     SiteGroupCms.Dal.SiteDal sitedal = new SiteGroupCms.Dal.SiteDal();
     if (id == "0")//是当前站点
     {
         site.ID = ((SiteGroupCms.Entity.Admin)(Session["admin"])).CurrentSite;
     }
     else
     {
         site.ID = Str2Int(id);
     }
     site.Title       = title;
     site.WebTitle    = webtitle;
     site.Keyword     = keywords;
     site.Description = description;
     // site.Location = location;  //不可修改
     site.Domain          = domain;
     site.IsWork          = Str2Int(iswork);
     site.Indextemplate   = Str2Int(indextemplate);
     site.Listtemplate    = Str2Int(listtemplate);
     site.Contenttemplate = Str2Int(contenttemplate);
     site.EmailServer     = mailserver;
     site.EmailUser       = mailuser;
     site.EmailPwd        = mailpwd;
     site.FtpDir          = ftpdir;
     site.FtpPort         = Str2Int(ftpport);
     site.FtpUser         = ftpuser;
     site.FtpPwd          = ftppwd;
     site.FtpServer       = ftpserver;
     if (sitedal.updatesite(site))
     {
         _response = "{\"IsError\":false,\"Message\":\"修改成功\",\"Data\":0}";
         new SiteGroupCms.Dal.LogDal().SaveLog(20);
         if (id == "0")
         {
             Session["site"] = sitedal.GetEntity(site.ID); //更新session的值
         }
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"修改失败\",\"Data\":0}";
     }
 }
예제 #10
0
        public void addsite()
        {
            SiteGroupCms.Entity.Site site    = new SiteGroupCms.Entity.Site();
            SiteGroupCms.Dal.SiteDal sitedal = new SiteGroupCms.Dal.SiteDal();

            site.Title           = title;
            site.WebTitle        = webtitle;
            site.Keyword         = keywords;
            site.Description     = description;
            site.Location        = location; //不可修改
            site.Domain          = domain;
            site.IsWork          = Str2Int(iswork);
            site.Indextemplate   = Str2Int(indextemplate);
            site.Listtemplate    = Str2Int(listtemplate);
            site.Contenttemplate = Str2Int(contenttemplate);
            site.EmailServer     = mailserver;
            site.EmailUser       = mailuser;
            site.EmailPwd        = mailpwd;
            site.FtpDir          = ftpdir;
            site.FtpPort         = Str2Int(ftpport);
            site.FtpUser         = ftpuser;
            site.FtpPwd          = ftppwd;
            site.FtpServer       = ftpserver;
            if (sitedal.Exists("location='" + site.Location + "'"))
            {
                _response = "{\"IsError\":true,\"Message\":\"存在相同路径了\",\"Data\":0}";
                return;
            }
            if (sitedal.addsite(site) > 0)
            {
                _response = "{\"IsError\":false,\"Message\":\"新建成功\",\"Data\":0}";
                SiteGroupCms.Utils.DirFile.CreateDir("/sites/" + site.Location + "/pub");
                SiteGroupCms.Utils.DirFile.CreateDir("/sites/" + site.Location + "/templates/atts");
                new SiteGroupCms.Dal.LogDal().SaveLog(21);
            }
            else
            {
                _response = "{\"IsError\":true,\"Message\":\"新建失败\",\"Data\":0}";
            }
        }
예제 #11
0
 public virtual string GetContent(string _ContentId)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_articleinfo] WHERE  [Id]=" + _ContentId;
         DataTable dtSearch = _doh.GetDataTable();
         if (dtSearch.Rows.Count == 0)
         {
             dtSearch.Clear();
             dtSearch.Dispose();
             return("内容错误");
         }
         SiteGroupCms.Dal.ArticleDal articledal = new ArticleDal();
         SiteGroupCms.Entity.Article article    = articledal.GetEntity(_ContentId);
         SiteGroupCms.Entity.Site    site       = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
         TemplateEngineDAL           te         = new TemplateEngineDAL(article.Catalogid.ToString());
         string PageStr = string.Empty;
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_articleinfo] WHERE  [Id]=" + _ContentId;
         DataTable dtContent = _doh.GetDataTable();
         string    ChannelId = dtContent.Rows[0]["catalogid"].ToString();
         te.PageNav         = Go2Site() + " &raquo;" + Go2Channel(ChannelId, 0);
         te.PageTitle       = site.WebTitle + "--" + dtContent.Rows[0]["title"].ToString();
         te.PageKeywords    = dtContent.Rows[0]["keywords"].ToString();
         te.PageDescription = dtContent.Rows[0]["abstract"].ToString();
         p__GetChannel_Article(te, dtContent, ref PageStr); //提取出模板的内容
         te.ReplacePublicTag(ref PageStr);                  //包含include解析 siteconfig解析 已经注释掉了  replaceTag_ChannelLoop解析
         //te.ReplaceChannelTag(ref PageStr, ChannelId);
         // PageStr = PageStr.Replace("{$channelid}",ChannelId);
         te.replaceTag_ChannelLoop(ref PageStr, ChannelId);      //替换频道循环标签
         te.ReplaceContentTag(ref PageStr, _ContentId);          //解释单片文档的所有标签
         te.ReplaceContentLoopTag(ref PageStr);                  //
         te.ReplaceChannelTag(ref PageStr, ChannelId);           //替换
         te.ExcuteLastHTML(ref PageStr);                         //替换注释标签
         PageStr = SiteGroupCms.Utils.Strings.UBB2HTML(PageStr); //替换ubb标签
         return(PageStr.Replace("{$Content}", dtContent.Rows[0]["content"].ToString()));
         // .Replace("{$_getPageBar()}", getPageBar(1, "html", 7, ContentList.Count - 1, 1, _CurrentPage, Go2View(true, _ChannelId, _ContentId, false), Go2View(true, _ChannelId, _ContentId, false), Go2View((true), _ChannelId, _ContentId, false), 0));
     }
 }
예제 #12
0
        /// <summary>
        /// 获得主网站参数  site表必须存在一个type=1的主网站
        /// </summary>
        /// <returns></returns>
        public SiteGroupCms.Entity.Site GetBaseEntity()
        {
            SiteGroupCms.Entity.Site eSite = new SiteGroupCms.Entity.Site();
            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.SqlCmd = "SELECT top 1 * FROM [yy_siteinfo] WHERE [type]=1";
                DataTable dt = _doh.GetDataTable();
                if (dt.Rows.Count > 0)
                {
                    eSite.ID               = Str2Int(dt.Rows[0]["id"].ToString());
                    eSite.Title            = dt.Rows[0]["title"].ToString();
                    eSite.Location         = dt.Rows[0]["location"].ToString();
                    eSite.WebTitle         = dt.Rows[0]["webtitle"].ToString();
                    eSite.Description      = dt.Rows[0]["description"].ToString();
                    eSite.Meta_Description = dt.Rows[0]["meta_description"].ToString();
                    eSite.Keyword          = dt.Rows[0]["meta_keywords"].ToString();
                    eSite.UploadSize       = Str2Int(dt.Rows[0]["uploadsize"].ToString());
                    eSite.UploadType       = dt.Rows[0]["uploadtype"].ToString();
                    eSite.EmailServer      = dt.Rows[0]["emailserver"].ToString();
                    eSite.EmailUser        = dt.Rows[0]["emailuser"].ToString();
                    eSite.EmailPwd         = dt.Rows[0]["emailpwd"].ToString();
                    eSite.FtpServer        = dt.Rows[0]["ftpserver"].ToString();
                    eSite.FtpUser          = dt.Rows[0]["ftpuser"].ToString();
                    eSite.FtpPort          = Str2Int(dt.Rows[0]["ftpport"].ToString());
                    eSite.FtpDir           = dt.Rows[0]["ftpdir"].ToString();
                    eSite.FtpPwd           = dt.Rows[0]["ftppwd"].ToString();
                    eSite.Domain           = dt.Rows[0]["domain"].ToString();
                    eSite.IsWork           = Str2Int(dt.Rows[0]["iswork"].ToString());
                    eSite.Type             = Str2Int(dt.Rows[0]["type"].ToString());
                    eSite.Indextemplate    = Str2Int(dt.Rows[0]["indextemplate"].ToString());
                    eSite.Listtemplate     = Str2Int(dt.Rows[0]["listtemplate"].ToString());
                    eSite.Contenttemplate  = Str2Int(dt.Rows[0]["contenttemplate"].ToString());
                }

                return(eSite);
            }
        }
예제 #13
0
        public string GetChannelLink(string _channelid, int type) //type=0 输出a标签 type=1 不输出a标签
        {
            string linkurl = "";

            SiteGroupCms.Entity.Site site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
            string linkurltitle           = "";

            SiteGroupCms.Entity.Catalog catalog = new SiteGroupCms.Dal.CatalogDal().GetEntity(_channelid);
            while (catalog.Father != 0)
            {
                if (type == 0)
                {
                    linkurl = "&raquo;<a href=" + GetChannelLink(catalog.ID.ToString(), 1) + ">" + catalog.Title + "</a>" + linkurl;
                }
                else
                {
                    linkurltitle = catalog.Dirname + "/" + linkurltitle;
                }
                catalog = new SiteGroupCms.Dal.CatalogDal().GetEntity(catalog.Father.ToString());
            }
            if (type == 0)
            {
                linkurl = "<a href=" + GetChannelLink(catalog.ID.ToString(), 1) + ">" + catalog.Title + "</a>" + linkurl;
            }
            else
            {
                linkurltitle = "/sites/" + site.Location + "/pub/" + catalog.Dirname + "/" + linkurltitle;
            }
            if (type == 0)
            {
                return(linkurl);
            }
            else
            {
                return(linkurltitle);
            }
        }
예제 #14
0
 /// <summary>
 /// 链接到站点首页
 /// </summary>
 public string Go2Site()
 {
     SiteGroupCms.Entity.Site site = (SiteGroupCms.Entity.Site)HttpContext.Current.Session["site"];
     return("<a href='/sites/" + site.Location + "/pub/'>首页</a>");
 }