Esempio n. 1
0
        /// <summary>
        /// 返回频道URL静态地址
        /// </summary>
        /// <param name="Class"></param>
        /// <param name="Rules">0封面地址,1列表地址</param>
        /// <returns></returns>
        public string GetStaticChannel(int Class, int Rules)
        {
            try{
                string Url         = null;
                string FilePath    = ClassBll.GetClassField(Class, "FilePath");                    //频道目录
                string DefaultFile = ClassBll.GetClassField(Class, "DefaultFile");                 //生成静态文件的默认文件
                string ListeRules  = ClassBll.GetClassField(Class, "ListeRules");                  //列表规则
                FilePath   = FilePath.ToLower().Replace("{cmspath}", "/");                         //替换参数
                ListeRules = ListeRules.ToLower().Replace("{cmspath}", "/");                       //替换参数
                ListeRules = ListeRules.ToLower().Replace("{channel}", FilePath.Replace("/", "")); //替换参数
                ListeRules = ListeRules.ToLower().Replace("{class}", Class.ToString());            //替换参数

                if (Rules > 0)
                {
                    Url = FilePath + ListeRules;
                }
                else
                {
                    Url = FilePath + DefaultFile;
                }
                Url = Url.ToLower().Replace("///", "/").Replace("//", "/");//替换
                return(Url);
            }
            catch {
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 目录和分页重写方法
        /// </summary>
        /// <param name="URL"></param>
        /// <returns></returns>
        public static string IsIndexUrl(string URL, string SERVER)
        {
            ROYcms.Sys.BLL.ROYcms_class ClassBll = new ROYcms.Sys.BLL.ROYcms_class();

            string SQL_where = null;

            //判断是主域名
            if (("http://" + SERVER + "/").ToLowerInvariant() != ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("web_host").ToLowerInvariant())
            {
                SQL_where = "FilePath ='" + FormatUrl(URL)[0] + "' and DefaultFile='" + FormatUrl(URL)[1] + "' and WebsiteUrl='" + SERVER.ToLowerInvariant() + "' ";
            }
            else
            {
                SQL_where = "FilePath ='" + FormatUrl(URL)[0] + "' and DefaultFile='" + FormatUrl(URL)[1] + "' and WebsiteUrl='' ";
            }

            string TemplateIndex = ClassBll.GetClassField(SQL_where, "TemplateIndex");

            if (TemplateIndex != null)
            {
                return(TemplateIndex + "?class=" + ClassBll.GetClassField(SQL_where, "id"));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// XML help?
        /// </summary>
        public string GetUrl(string Id)
        {
            string Url = null;

            ROYcms.Sys.BLL.ROYcms_class ___ROYcms_class = new ROYcms.Sys.BLL.ROYcms_class();
            ROYcms.Sys.BLL.ROYcms_news  ___ROYcms_news  = new ROYcms.Sys.BLL.ROYcms_news();
            ROYcms.Sys.BLL.ROYcms_Url   ___ROYcms_Url   = new ROYcms.Sys.BLL.ROYcms_Url();
            int ClassId = Convert.ToInt32(___ROYcms_news.GetField(Convert.ToInt32(Id), "classname"));

            string ShowRules = ___ROYcms_class.GetClassField(ClassId, "ShowRules");

            string jumpurl = ___ROYcms_news.GetField(Convert.ToInt32(Id), "jumpurl").Trim();

            ShowRules = ShowRules.Replace("{id}", Id).Replace("{yyyy}/{MM}/{dd}/", "show_");
            if (jumpurl.Length > 2)
            {
                Url = jumpurl;
            }
            else
            {
                if (___ROYcms_Url.Exists_bh(Convert.ToInt32(Id)))
                {
                    Url = ___ROYcms_Url.GetUrl(Convert.ToInt32(Id));
                }
                else
                {
                    Url = (___ROYcms_class.GetClassField(ClassId, "FilePath").Replace("{cmspath}/", "/")) + ShowRules;
                }
            }
            return(Url);
        }
Esempio n. 4
0
 /// <summary>
 /// 地址
 /// </summary>
 /// <value>The id.</value>
 //public string Path
 //{
 //    get
 //    {
 //        if (_Path!= null)
 //        {
 //            if (Page.Request["path"] != null)
 //            {
 //                _Path = _Path.Replace("{path}".ToLowerInvariant(), Page.Request["path"]);
 //            }
 //        }
 //        return _Path;
 //    }
 //    set { _Path= value; }
 //}
 /// <summary>
 /// 输出
 /// </summary>
 /// <param name="output">The output.</param>
 protected override void Render(HtmlTextWriter output)
 {
     ROYcms.Sys.BLL.ROYcms_class ___ROYcms_class = new ROYcms.Sys.BLL.ROYcms_class();
     try
     {
         output.Write((___ROYcms_class.GetClassField(Convert.ToInt32(Rid), Name)).Replace("{cmspath}/", "/"));
     }
     catch { output.Write("<!--输出错误!-->"); }
     //if (Path == null)
     //{
     //    try
     //    {
     //        output.Write((___ROYcms_class.GetClassField(Convert.ToInt32(Rid), Name)).Replace("{cmspath}/", "/"));
     //    }
     //    catch { output.Write("<!--输出错误!-->"); }
     //}
     //else
     //{
     //    try
     //    {
     //        output.Write(___ROYcms_class.GetClassField(Convert.ToInt32(___ROYcms_class.GetId("{cmspath}/" + Path + "/")), Name).Replace("{cmspath}/", "/"));
     //    }
     //    catch { output.Write("<!--输出错误!-->"); }
     //}
 }
Esempio n. 5
0
 /// <summary>
 /// 返回频道数据
 /// </summary>
 /// <param name="IndexModels"></param>
 /// <returns></returns>
 public string ChannelDate(IndexModel IndexModels)
 {
     try
     {
         string TemplateIndex = ClassBll.GetClassField(IndexModels.type, "TemplateIndex");           //对应的模板文件
         string QPre          = "?type=" + IndexModels.type + "&classkind=" + IndexModels.classkind; //参数
         string MyUrl         = "http://" + this.GetDoMain() + TemplateIndex + QPre;                 //拼接后的地址
         string MyHtml        = ROYcms.Common.GetUrlText.GetText(MyUrl, EncodIng);
         return(MyHtml);
     }
     catch
     {
         new ROYcms.Sys.BLL.ROYcms_Log().InsertSystemLog("5", "获取返回频道数据失败", "获取返回频道数据失败");//写入日志
         return(null);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 文章详细页面重写
        /// </summary>
        /// <param name="URL"></param>
        /// <returns></returns>
        public static string IsShowUrl(string URL)
        {
            ROYcms.Sys.BLL.ROYcms_news  NewBll   = new ROYcms.Sys.BLL.ROYcms_news();
            ROYcms.Sys.BLL.ROYcms_class ClassBll = new ROYcms.Sys.BLL.ROYcms_class();


            string NewUrlModel = ROYcms.Config.ROYcmsConfig.GetCmsConfigValue("new_url_model");

            if (NewUrlModel == "" || NewUrlModel == null)
            {
                NewUrlModel = "show";
            }

            if (URL.Contains("/" + NewUrlModel + "_"))
            {
                string[] Parameters = URL.Substring(URL.LastIndexOf("/" + NewUrlModel + "_") + 6, URL.LastIndexOf(".") - (URL.LastIndexOf("/" + NewUrlModel + "_") + 6)).Split('_');
                string   ClassId    = Convert.ToString(NewBll.GetClassName(Convert.ToInt32(Parameters[0])));

                string NewPath = ClassBll.GetClassField(Convert.ToInt32(ClassId), "TemplateShow");;
                if (NewPath != "")
                {
                    if (Parameters.Length > 1)
                    {
                        NewPath = NewPath + String.Format("?id={0}&class={1}&page={2}", Parameters[0], ClassId, Parameters[1]);
                    }
                    else
                    {
                        NewPath = NewPath + String.Format("?id={0}&class={1}", Parameters[0], ClassId);
                    }

                    return(NewPath);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(URL);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 获取地址
        /// </summary>
        /// <param name="Id">新闻ID</param>
        /// <param name="Class">分类ID</param>
        /// <param name="Div">层级</param>
        /// <returns></returns>
        public string GetLink(int Id, int Class, int Div)
        {
            string Url = null;

            try
            {
                if (Class == 0) //返回文章URL地址
                {
                    int    ClassId   = Convert.ToInt32(ROYcms_newsBLL.GetField(Id, "classname"));
                    string ShowRules = ROYcms_classBll.GetClassField(ClassId, "ShowRules");

                    string jumpurl = ROYcms_newsBLL.GetField(Id, "jumpurl").Trim();
                    ShowRules = ShowRules.Replace("{id}", Id.ToString()).Replace("{yyyy}/{MM}/{dd}/", "show_");
                    if (jumpurl.Length > 2) //如果启用跳转则输出跳转的URL
                    {
                        Url = jumpurl;
                    }
                    else
                    {
                        //if (ROYcms_UrlBLL.Exists_bh(Convert.ToInt32(Id))) { Url = ___ROYcms_Url.GetUrl(Convert.ToInt32(this.Rid)); }
                        //else
                        //{
                        Url = (ROYcms_classBll.GetClassField(ClassId, "FilePath").Replace("{cmspath}/", "/")) + ShowRules;
                        //}
                    }
                }
                else //返回列表的链接地址 默认是封面 1是频道
                {
                    if (Div == 1)
                    {
                        string ListRules = ROYcms_classBll.GetClassField(Class, "ListeRules");
                        Url = (ROYcms_classBll.GetClassField(Class, "FilePath").Replace("{cmspath}/", "/")) + ListRules.Replace("{class}", Class.ToString());
                    }
                    else
                    {
                        string DefaultFile = ROYcms_classBll.GetClassField(Class, "DefaultFile");
                        if (DefaultFile == "index.aspx")
                        {
                            DefaultFile = "";
                        }
                        Url = (ROYcms_classBll.GetClassField(Class, "FilePath").Replace("{cmspath}/", "/")) + DefaultFile;
                    }
                }
                return(Url);
            }
            catch { return("<!--输出错误!-->"); }
        }