示例#1
0
        private string _webpath = string.Empty; //ҳ��·��

        #endregion Fields

        #region Constructors

        public TCGTagHandlers(HandlerService handlerService)
        {
            base.handlerService = handlerService;
            this._pattern = @"<tcg:([^<>]+)\s([^<>]+)>([\S\s]*?)</tcg:\1>";
            this._tcgsystemtag = "<!--TCG:{0}-->";
            this._pagerinfo = new TCGTagPagerInfo();
        }
示例#2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="conn">数据库连接</param>
        /// <param name="configservice">基本配置信息</param>
        /// <param name="handlersevice">所有操作方法句柄</param>
        /// <param name="adminhandlers">管理员操作方法</param>
        public AdminLoginHandlers(Connection conn, ConfigService configservice,HandlerService handlersevice, AdminHandlers adminhandlers)
        {
            base.conn = conn;

            base.handlerService = handlersevice;
            this._adminh = adminhandlers;
            this.Initialization();
        }
 public TCGTagAttributeHandlers(HandlerService handlerservice)
 {
     base.handlerService = handlerservice;
     this._attpattern = @"=""([\S\s]*?)""";
 }
 public TCGTagAttributeHandlers(HandlerService handlerservice)
 {
     base.handlerService = handlerservice;
     this._attpattern = @"=""([0-9A-Za-z\s,='!_\-\.%\|()$<>\/]+)""";
 }
示例#5
0
        /// <summary>
        /// 处理请求
        /// </summary>
        /// <param name="iHttpApplication"></param>
        /// <param name="iHttpContext"></param>
        /// <param name="Response"></param>
        /// <param name="Request"></param>
        public void Do(HttpApplication iHttpApplication, HttpContext iHttpContext, HttpResponse Response, HttpRequest Request)
        {
            HandlerService handlerService = new HandlerService();
            handlerService.configService = this.configService;
            handlerService.conn = this.conn;

            if (!Boolean.Parse(configService.baseConfig["IsReWrite"])) return;

            startTime = DateTime.Now;
            string OutHtml = string.Empty;

            TagService tagservice = new TagService(handlerService);
            tagservice.TCGTagHandlers.configService = this.configService;
            tagservice.TCGTagHandlers.conn = this.conn;

            //获得页面文件名
            string pagepath = Request.Url.Segments[Request.Url.Segments.Length - 1];

            //获得所有单页模版信息
            Dictionary<string, EntityBase> slpages = tagservice.handlerService.skinService.templateHandlers.GetTemplatesByTemplateType(TemplateType.SinglePageType);

            if (slpages != null && slpages.Count != 0)
            {
                foreach (KeyValuePair<string, EntityBase> entity in slpages)
                {
                    Template template = (Template)entity.Value;
                    string texturl = configService.baseConfig["WebSite"].Trim() + template.vcUrl;
                    if (texturl.IndexOf(configService.baseConfig["FileExtension"]) == -1) texturl += configService.baseConfig["FileExtension"];

                    if (texturl == Request.Url.AbsoluteUri)
                    {
                        tagservice.TCGTagHandlers.Template = template.Content;
                        tagservice.TCGTagHandlers.NeedCreate = false;
                        tagservice.TCGTagHandlers.Replace();
                        OutHtml = tagservice.TCGTagHandlers.Template;

                        TimeReplace(ref OutHtml);
                        Response.Write(OutHtml);
                        Response.End();
                        return;
                    }
                }
            }

            string DpagePath = Request.Url.AbsolutePath;
            int DcurPage = 1;
            //检测文件名特性
            string pattern = @"([\s\S]*)-c(\d+)\" + configService.baseConfig["FileExtension"];
            Match match = Regex.Match(pagepath, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
            if (match.Success)
            {
                pagepath = match.Result("$1") + configService.baseConfig["FileExtension"];
                DpagePath = DpagePath.Substring(0, DpagePath.LastIndexOf('/')) + "/" + pagepath;
                DcurPage = objectHandlers.ToInt(match.Result("$2"));
            }

            //检测分类文件
            Dictionary<string, EntityBase> allcategories = tagservice.handlerService.skinService.categoriesHandlers.GetAllCategoriesEntity();
            if (allcategories != null && allcategories.Count != 0)
            {
                if(!string.IsNullOrEmpty(pagepath))
                {
                    string [] p = pagepath.Split('.');
                    string exp = p[p.Length-1];
                    int num = DpagePath.LastIndexOf("." + exp);
                    string Qp = DpagePath.Substring(0, num);

                    foreach (KeyValuePair<string, EntityBase> entity in allcategories)
                    {
                        Categories tempcategories = (Categories)entity.Value;
                        if (tempcategories.vcUrl == Qp)
                        {
                            tagservice.TCGTagHandlers.Template = tempcategories.ResourceListTemplate.Content.Replace("_$ClassId$_", tempcategories.Id);
                            tagservice.TCGTagHandlers.NeedCreate = false;
                            tagservice.TCGTagHandlers.PagerInfo.DoAllPage = false;
                            tagservice.TCGTagHandlers.PagerInfo.Page = DcurPage;
                            tagservice.TCGTagHandlers.WebPath = tempcategories.vcUrl + configService.baseConfig["FileExtension"];
                            tagservice.TCGTagHandlers.Replace();

                            OutHtml = tagservice.TCGTagHandlers.Template;

                            TimeReplace(ref OutHtml);
                            Response.Write(OutHtml);
                            Response.End();
                            return;
                        }
                    }
                }
            }

            //检测文件名特性
            pattern = @"\d{8}\/([a-z0-9]{8}\-[a-z0-9]{4}-[a-z0-9]{4}\-[a-z0-9]{4}\-[a-z0-9]{12})\" + configService.baseConfig["FileExtension"];
            match = Regex.Match(DpagePath, pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline);
            if (match.Success)
            {
                string topicid = match.Result("$1");
                if (!string.IsNullOrEmpty(topicid))
                {
                    //获得文章对象

                    Resources item = tagservice.handlerService.resourcsService.resourcesHandlers.GetResourcesById(topicid);
                    if (item != null)
                    {
                        //获得分类信息
                        tagservice.TCGTagHandlers.Template = item.Categorie.ResourceTemplate.Content.Replace("_$Id$_", item.Id.ToString());
                        tagservice.TCGTagHandlers.NeedCreate = false;
                        tagservice.TCGTagHandlers.Replace();

                        OutHtml = tagservice.TCGTagHandlers.Template;

                        TimeReplace(ref OutHtml);
                        Response.Write(OutHtml);
                        Response.End();
                        return;
                    }

                    return;
                }
            }
        }
示例#6
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public TagService(HandlerService handlerservice)
 {
     base.handlerService = handlerservice;
 }