Example #1
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var curData = (DataRowView)e.Item.DataItem;

                var lnkRegister = (HyperLink)e.Item.FindControl("lnkRegister");
                var litName     = (Literal)e.Item.FindControl("litName");
                var litContent  = (Literal)e.Item.FindControl("litContent");
                var rptDocument = (Repeater)e.Item.FindControl("rptDocument");

                litName.Text    = curData["Content_Name"].ToString();
                litContent.Text = curData["Content_Body"].ToString();

                lnkRegister.NavigateUrl = UrlFilter.BuildUrlByZoneID(
                    ConvertUtility.ToInt32(
                        SettingDB.GetValue(AppEnv.CMS_ZoneClassRegister + AppEnv.GetLanguageFrontEnd()))) +
                                          "&lh=" + curData["Distribution_ZoneID"];

                var strSQL = "SELECT CMS_ContentDownload.*, CMS_Download.* FROM CMS_ContentDownload ";
                strSQL += " INNER JOIN CMS_Download ON CMS_ContentDownload.Download_ID = CMS_Download.Download_ID ";
                strSQL += " WHERE 1=1 ";
                strSQL += " AND CMS_Download.Download_Visible=1 ";
                strSQL += " AND CMS_ContentDownload.Content_ID=" + curData["Content_ID"] + " ";

                strSQL += " ORDER BY CMS_ContentDownload.Priority ASC ";

                var source = DataHelper.GetDataFromTable(strSQL);

                rptDocument.DataSource = source;
                rptDocument.DataBind();
            }
        }
        protected virtual void AddFilteredContentElement(CurrentLanguageContent languageContentInfo, IList <XElement> xmlElements)
        {
            if (ContentFilter.ShouldExcludeContent(languageContentInfo, SiteSettings, SitemapData))
            {
                return;
            }

            var    content = languageContentInfo.Content;
            string url;

            var localizableContent = content as ILocalizable;

            if (localizableContent != null)
            {
                string language = string.IsNullOrWhiteSpace(this.SitemapData.Language)
                    ? languageContentInfo.CurrentLanguage.Name
                    : this.SitemapData.Language;

                url = this.UrlResolver.GetUrl(content.ContentLink, language);

                if (string.IsNullOrWhiteSpace(url))
                {
                    return;
                }

                // Make 100% sure we remove the language part in the URL if the sitemap host is mapped to the page's LanguageBranch.
                if (this.HostLanguageBranch != null && localizableContent.Language.Name.Equals(this.HostLanguageBranch, StringComparison.InvariantCultureIgnoreCase))
                {
                    url = url.Replace(string.Format("/{0}/", this.HostLanguageBranch), "/");
                }
            }
            else
            {
                url = this.UrlResolver.GetUrl(content.ContentLink);

                if (string.IsNullOrWhiteSpace(url))
                {
                    return;
                }
            }

            url = GetAbsoluteUrl(url);

            var fullContentUrl = new Uri(url);

            if (this.UrlSet.Contains(fullContentUrl.ToString()) || UrlFilter.IsUrlFiltered(fullContentUrl.AbsolutePath, this.SitemapData))
            {
                return;
            }

            XElement contentElement = this.GenerateSiteElement(content, fullContentUrl.ToString());

            if (contentElement == null)
            {
                return;
            }

            xmlElements.Add(contentElement);
            this.UrlSet.Add(fullContentUrl.ToString());
        }
Example #3
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData     = (DataRowView)e.Item.DataItem;
                var litName     = (Literal)e.Item.FindControl("litName");
                var litTeaser   = (Literal)e.Item.FindControl("litTeaser");
                var litDatetime = (Literal)e.Item.FindControl("litDatetime");
                var imgAvatar   = (Image)e.Item.FindControl("imgAvatar");

                litName.Text   = curData["Content_Name"].ToString();
                litTeaser.Text = curData["Content_Teaser"].ToString();

                litDatetime.Text = ConvertUtility.ToDateTime(curData["Distribution_CreateDate"]).ToString("dd MMMM yyyy");

                var coverInfo = ImageDB.GetCover(ConvertUtility.ToInt32(curData["Content_ID"]));
                if (coverInfo != null)
                {
                    var avatar = coverInfo.Image_File;
                    if (avatar.Length > 0)
                    {
                        imgAvatar.ImageUrl = UrlFilter.BuildImageScaleHeight(avatar, 0, 50);
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
                else
                {
                    imgAvatar.Visible = false;
                }
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zonecurrent = ZoneUtility.GetZoneCurrent();

            var zoneInfo = ZoneDB.GetInfo(_zonecurrent);

            if (zoneInfo != null)
            {
                lnkZone.Text        = zoneInfo.Zone_Name;
                lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(_zonecurrent);
                var listStyle = zoneInfo.Zone_ContentListingDisplay;
                if (listStyle == "one")
                {
                    SpecialInZone1.Visible = false;
                    PlaceHolder1.Controls.Add(Page.LoadControl("UserControls/NewsFocus.ascx"));
                }
                else
                {
                    PlaceHolder1.Controls.Add(Page.LoadControl("Project/TuyenSinhList.ascx"));
                }
            }
            else
            {
                Response.Redirect("/");
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string boxtname = "tuyensinhhome";
            var          zoneid   = ConvertUtility.ToInt32(ZoneDB.GetIDByFriendlyUrl(boxtname));

            if (zoneid <= 0)
            {
                return;
            }
            var info = ZoneDB.GetInfo(zoneid);

            if (info == null)
            {
                return;
            }

            lnkOther.NavigateUrl = UrlFilter.BuildUrlByZoneID(info.Zone_ParentID);

            string lang = AppEnv.GetLanguageFrontEnd();

            var zoneClassRegister = ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneClassRegister + lang));

            lnkRegister.NavigateUrl = UrlFilter.BuildUrlByZoneID(zoneClassRegister);

            var dtData = DistributionDB.GetContentByZoneIDselfAndNumberRecord(zoneid, 10);

            if (dtData.Rows.Count <= 0)
            {
                return;
            }

            rptData.DataSource = dtData;
            rptData.DataBind();
        }
        public void TestRegularDomainRule_WithoutException()
        {
            var parser = new AbpFormatRuleParser();

            Filter filter = parser.ParseAbpFormattedRule("||testsite.com", 1);

            // Needs to be a URL filter.
            if (!(filter is UrlFilter))
            {
                Assert.Fail();
            }

            UrlFilter urlFilter = filter as UrlFilter;

            // is not exception to rule.
            Assert.IsFalse(urlFilter.IsException);

            // all subdomains should match as well.
            Assert.IsTrue(urlFilter.IsMatch(new Uri("https://subdomain.testsite.com"), null));

            Assert.IsTrue(urlFilter.IsMatch(new Uri("https://testsite.com"), null));

            Assert.IsTrue(urlFilter.IsMatch(new Uri("http://testsite.com"), null));

            Assert.IsFalse(urlFilter.IsMatch(new Uri("http://does-not-match.com"), null));
        }
Example #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zoneCurrent = ZoneUtility.GetZoneCurrent();

            lnkZone.Text        = ZoneDB.GetZoneNameByID(_zoneCurrent);
            lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(_zoneCurrent);

            var source = DistributionDB.GetNewContentByZoneIDNoPage(_zoneCurrent, true, _excludeSpecial);

            if (source.Rows.Count > 0)
            {
                CollectionPager1.DataSource    = source.DefaultView;
                CollectionPager1.BindToControl = rptData;

                if (AppEnv.GetLanguageFrontEnd() == "vi-VN")
                {
                    CollectionPager1.LabelText = "Trang:&nbsp;";
                }
                else
                {
                    CollectionPager1.LabelText = "Page:&nbsp;";
                }

                CollectionPager1.BackText              = "<<";
                CollectionPager1.PageNumbersSeparator  = "&nbsp;&nbsp;&nbsp;";
                CollectionPager1.BackNextLinkSeparator = "&nbsp;&nbsp;&nbsp;";

                rptData.DataSource = CollectionPager1.DataSourcePaged;
                rptData.DataBind();
            }
            else
            {
                rptData.Visible = false;
            }
        }
Example #8
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var curData = (DataRowView)e.Item.DataItem;

                var lnkName   = (HyperLink)e.Item.FindControl("lnkName");
                var litTeaser = (Literal)e.Item.FindControl("litTeaser");
                //var lnkAvatar = (HyperLink)e.Item.FindControl("lnkAvatar");
                var imgAvatar = (Image)e.Item.FindControl("imgAvatar");

                lnkName.Text        = curData["Content_Name"].ToString();
                lnkName.NavigateUrl = UrlFilter.BuildUrlByItemID(ConvertUtility.ToInt32(curData["Distribution_ID"]));

                litTeaser.Text = curData["Content_Teaser"].ToString().Replace("\n", "<br />");

                var coverInfo = ImageDB.GetCover(ConvertUtility.ToInt32(curData["Content_ID"]));
                if (coverInfo != null)
                {
                    string avatar = coverInfo.Image_File;
                    if (avatar.Length > 0)
                    {
                        imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(avatar, 120, 0);
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
                else
                {
                    imgAvatar.Visible = false;
                }
            }
        }
Example #9
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                DataRowView curData = (DataRowView)e.Item.DataItem;
                HyperLink   lnkZone = (HyperLink)e.Item.FindControl("lnkZone");

                if (curData["Zone_ID"].ToString() == zoneCurrent.ToString())
                {
                    lnkZone.CssClass = "selected";
                }

                if (zoneCurrent == 0)
                {
                    if (curData["Zone_ID"].ToString() == zoneHome.ToString())
                    {
                        lnkZone.CssClass = "selected";
                    }
                }

                if (curData["Zone_RealUrl"].ToString().Length > 0)
                {
                    lnkZone.NavigateUrl = curData["Zone_RealUrl"].ToString();
                }
                else
                {
                    lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(ConvertUtility.ToInt32(curData["Zone_ID"]));
                }

                lnkZone.Text = curData["Zone_Name"].ToString();
            }
        }
Example #10
0
 public void HugeList()
 {
     filter = new UrlFilter(HUGE_LIST);
     timer.Start();
     filter.Check(naughtyUrl);
     timer.End();
     Assert.That(timer.ElapsedTime, Is.LessThan(10.0));
 }
Example #11
0
        protected void butSearch_Click(object sender, EventArgs e)
        {
            var dotuoi = dropFilterDoTuoi.SelectedValue;
            var monhoc = dropFilterMonHoc.SelectedValue;
            var coso   = dropFilterCoso.SelectedValue;

            Response.Redirect(UrlFilter.BuildUrlByZoneID(ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneClassRegister + AppEnv.GetLanguageFrontEnd()))) + "&dt=" + dotuoi + "&mh=" + monhoc + "&cs=" + coso, true);
        }
Example #12
0
 public void SmallList()
 {
     filter = new UrlFilter(SMALL_LIST);
     timer.Start();
     filter.Check(naughtyUrl);
     timer.End();
     Assert.That(timer.ElapsedTime, Is.LessThan(1.0));
 }
Example #13
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var curData = (DataRowView)e.Item.DataItem;

                var lnkName     = (HyperLink)e.Item.FindControl("lnkName");
                var litTeaser   = (Literal)e.Item.FindControl("litTeaser");
                var litDatetime = (Literal)e.Item.FindControl("litDatetime");
                //var lnkAvatar = (HyperLink)e.Item.FindControl("lnkAvatar");
                var imgAvatar   = (Image)e.Item.FindControl("imgAvatar");
                var divRight    = (HtmlGenericControl)e.Item.FindControl("divRight");
                var lnkRegister = (HyperLink)e.Item.FindControl("lnkRegister");

                lnkName.Text        = curData["Content_Name"].ToString();
                lnkName.NavigateUrl = UrlFilter.BuildUrlByItemID(ConvertUtility.ToInt32(curData["Distribution_ID"]));

                litTeaser.Text = curData["Content_Teaser"].ToString();

                var khInfo = KhoahocDB.GetInfo(ConvertUtility.ToInt32(curData["Content_ID"]));

                if (khInfo != null)
                {
                    litDatetime.Text        = khInfo.Khoahoc_KhaiGiang;
                    lnkRegister.NavigateUrl =
                        UrlFilter.BuildUrlByZoneID(
                            ConvertUtility.ToInt32(
                                SettingDB.GetValue(AppEnv.CMS_ZoneClassRegister + AppEnv.GetLanguageFrontEnd()))) +
                        "&khoahocid=" + khInfo.Khoahoc_ID;
                }


                //var newstime = ConvertUtility.ToDateTime(curData["Distribution_CreateDate"]);
                //litDatetime.Text = newstime.Day + " tháng " + newstime.Month + " năm" + newstime.Year;

                var coverInfo = ImageDB.GetCover(ConvertUtility.ToInt32(curData["Content_ID"]));
                if (coverInfo != null)
                {
                    string avatar = coverInfo.Image_File;
                    if (avatar.Length > 0)
                    {
                        imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(avatar, 120, 0);
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                        divRight.Attributes.Add("style", "width: 100%;");
                    }
                }
                else
                {
                    imgAvatar.Visible = false;
                    divRight.Attributes.Add("style", "width: 100%");
                }
            }
        }
Example #14
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData = (DataRowView)e.Item.DataItem;
                var lnkName = (HyperLink)e.Item.FindControl("lnkName");

                lnkName.Text        = curData["Content_Name"].ToString();
                lnkName.NavigateUrl = UrlFilter.BuildUrlByItemID(ConvertUtility.ToInt32(DistributionDB.GetOriginalDistID(ConvertUtility.ToInt32(curData["Distribution_ContentID"]))));
            }
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zonecurrent = ZoneUtility.GetZoneCurrent();

            var zoneKhoahoc =
                ConvertUtility.ToInt32(SettingDB.GetValue(AppEnv.CMS_ZoneKhoaHoc + AppEnv.GetLanguageFrontEnd()));

            lnkZoneName.NavigateUrl = UrlFilter.BuildUrlByZoneID(zoneKhoahoc);

            rptData.DataSource = ZoneDB.GetByParentID(zoneKhoahoc);
            rptData.DataBind();
        }
Example #16
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData = (DataRowView)e.Item.DataItem;
                //HyperLink lnkZone = (HyperLink)e.Item.FindControl("lnkZone");
                var litZone        = (Literal)e.Item.FindControl("litZone");
                var imgAvatar      = (Image)e.Item.FindControl("imgAvatar");
                var litDescription = (Literal)e.Item.FindControl("litDescription");
                var rptSub2        = (Repeater)e.Item.FindControl("rptSub2");

                //if (curData["Zone_ID"].ToString() == zoneCurrent.ToString()) lnkZone.CssClass = "selected";

                //if (zoneCurrent == 0)
                //{
                //    if (curData["Zone_ID"].ToString() == zoneHome.ToString()) lnkZone.CssClass = "selected";
                //}

                //if (curData["Zone_RealUrl"].ToString().Length > 0)
                //    lnkZone.NavigateUrl = curData["Zone_RealUrl"].ToString();
                //else
                //    lnkZone.NavigateUrl = ZoneUtility.BuildUrlByZoneCurrent(ConvertUtility.ToInt32(curData["Zone_ID"]));

                litDescription.Text = curData["Zone_Description"].ToString();
                litZone.Text        = curData["Zone_Name"].ToString();
                var avatar = curData["Zone_Avatar"].ToString().Trim();
                if (avatar.Length > 0)
                {
                    imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(avatar, 35, 0);
                }
                else
                {
                    imgAvatar.Visible = false;
                }

                var dtSub = ZoneDB.GetByParentID(ConvertUtility.ToInt32(curData["Zone_ID"]));

                if (dtSub.Rows.Count == 0)
                {
                    rptSub2.Visible = false;
                }
                else
                {
                    rptSub2.DataSource     = dtSub;
                    rptSub2.ItemDataBound += new RepeaterItemEventHandler(rptSub2_ItemDataBound);
                    rptSub2.DataBind();
                }
            }
        }
            public void ValidDomain()
            {
                UrlFilter filter = new UrlFilter
                {
                    Enabled = true,
                    Whitelist = new List<string>
                    {
                        @"http://www.dws.com.au",
                        @"http://www.google.com"
                    }
                };

                bool result = filter.Test(@"http://www.google.com/Foobar");
                Assert.IsTrue(result);
            }
Example #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zoneCurrent = ZoneUtility.GetZoneCurrent();

            _itemid = ConvertUtility.ToInt32(Request.QueryString["itemid"]);

            _distInfo = DistributionDB.GetInfo(_itemid);
            if (_distInfo == null)
            {
                Visible = false;
                return;
            }

            DistributionDB.UpdateView(_distInfo.Distribution_ID, 1);

            _contentId = _distInfo.Distribution_ContentID;

            var contentInfo = ContentDB.GetInfo(_contentId);

            lnkName.Text        = contentInfo.Content_Name;
            lnkName.NavigateUrl = UrlFilter.BuildUrlByItemID(_itemid);



            lnkZone.Text        = ZoneDB.GetZoneNameByID(_zoneCurrent);
            lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(_zoneCurrent);

            var strSQL = "SELECT CMS_ContentVideo.*, CMS_Videos.* FROM CMS_ContentVideo ";

            strSQL += " INNER JOIN CMS_Videos ON CMS_ContentVideo.Video_ID = CMS_Videos.Video_ID ";
            strSQL += " WHERE 1=1 ";

            strSQL += " AND CMS_ContentVideo.Content_ID=" + _contentId + " ";
            strSQL += " AND CMS_Videos.Video_Visible=1 ";
            strSQL += " ORDER BY CMS_ContentVideo.Priority ASC ";

            var source = DataHelper.GetDataFromTable(strSQL);

            if (source.Rows.Count > 0)
            {
                rptData.DataSource = source;
                rptData.DataBind();
            }
            else
            {
                rptData.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            _zonecurrent = ZoneUtility.GetZoneCurrent();

            var zoneInfo = ZoneDB.GetInfo(_zonecurrent);

            if (zoneInfo != null)
            {
                lnkZone.Text        = zoneInfo.Zone_Name;
                lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(_zonecurrent);
            }
            else
            {
                Response.Redirect("/");
            }
        }
Example #20
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData   = (DataRowView)e.Item.DataItem;
                var lnkZone   = (HyperLink)e.Item.FindControl("lnkZone");
                var imgAvatar = (Image)e.Item.FindControl("imgAvatar");

                if (curData["Zone_ID"].ToString() == _zoneCurrent.ToString() || curData["Zone_ID"].ToString() == ZoneDB.GetParentID(_zoneCurrent).ToString() || curData["Zone_ID"].ToString() == ZoneDB.GetParentID(ZoneDB.GetParentID(_zoneCurrent)).ToString())
                {
                    lnkZone.CssClass = "selected";
                    imgAvatar.Attributes.Add("style", "position: relative; z-index: 100;");
                }

                if (_zoneCurrent == 0)
                {
                    if (curData["Zone_ID"].ToString() == _zoneHome.ToString())
                    {
                        lnkZone.CssClass = "selected";
                        imgAvatar.Attributes.Add("style", "position: relative; z-index: 100;");
                    }
                }

                if (curData["Zone_RealUrl"].ToString().Length > 0)
                {
                    lnkZone.NavigateUrl = curData["Zone_RealUrl"].ToString();
                }
                else
                {
                    lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(ConvertUtility.ToInt32(curData["Zone_ID"]));
                }

                //lnkZone.Text = curData["Zone_Name"].ToString();

                var avatar = curData["Zone_Avatar"].ToString().Trim();
                if (avatar.Length > 0)
                {
                    imgAvatar.ImageUrl = avatar;
                }
                else
                {
                    imgAvatar.Visible = false;
                    lnkZone.Text      = curData["Zone_Name"].ToString();
                }
            }
        }
Example #21
0
 public static void Initialize()
 {
     ranker         = new Ranker.Ranker();
     indexer        = new Indexer.Indexer();
     urlFilter      = new UrlFilter();
     urlFrontier    = new UrlFrontier();
     indexCreator   = new IndexCreator();
     pageRetriever  = new PageRetriever();
     termContructor = new TermConstructor();
     tokenizer      = new Tokenizer();
     webCrawler     = new WebCrawler.WebCrawler();
     pageDB         = new PageDB();
     DPC            = new DuplicatePageChecker();
     DUC            = new DuplicateURLChecker();
     pageFetcher    = new PageFetcher();
     pageParser     = new PageParser();
 }
Example #22
0
        protected void rptSub2_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                DataRowView curData = (DataRowView)e.Item.DataItem;
                HyperLink   lnkSub2 = (HyperLink)e.Item.FindControl("lnkSub2");
                //Repeater rptSub3 = (Repeater)e.Item.FindControl("rptSub3");

                if (curData["Zone_ID"].ToString() == zoneCurrent.ToString())
                {
                    lnkSub2.CssClass = "selected";
                }

                if (zoneCurrent == 0)
                {
                    if (curData["Zone_ID"].ToString() == zoneHome.ToString())
                    {
                        lnkSub2.CssClass = "selected";
                    }
                }

                lnkSub2.Text = curData["Zone_Name"].ToString();

                if (curData["Zone_RealUrl"].ToString().Length > 0)
                {
                    lnkSub2.NavigateUrl = curData["Zone_RealUrl"].ToString();
                }
                else
                {
                    lnkSub2.NavigateUrl = UrlFilter.BuildUrlByZoneID(ConvertUtility.ToInt32(curData["Zone_ID"]));
                }

                //DataTable dtSub = ZoneDB.GetByParentID(ConvertUtility.ToInt32(curData["Zone_ID"]));

                //if (dtSub.Rows.Count == 0)
                //{
                //    rptSub3.Visible = false;
                //}
                //else
                //{
                //    rptSub3.DataSource = dtSub;
                //    rptSub3.ItemDataBound += new RepeaterItemEventHandler(rptSub3_ItemDataBound);
                //    rptSub3.DataBind();
                //}
            }
        }
Example #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string boxtname = "homebottomright";
            var          zoneid   = ConvertUtility.ToInt32(ZoneDB.GetIDByFriendlyUrl(boxtname));

            if (zoneid <= 0)
            {
                return;
            }
            var info = ZoneDB.GetInfo(zoneid);

            if (info == null)
            {
                return;
            }

            var realUrl = (info.Zone_RealUrl);

            if (realUrl.Length > 0)
            {
                lnkOther.NavigateUrl = realUrl;
            }
            else
            {
                lnkOther.NavigateUrl = UrlFilter.BuildUrlByZoneID(info.Zone_ParentID);
            }

            var dtSpecial = DistributionDB.GetContentByZoneIDAndRank(zoneid, 1, (int)AppEnv.CMSContentRank.Special);

            if (dtSpecial.Rows.Count > 0)
            {
                rptSpecial.DataSource = dtSpecial;
                rptSpecial.DataBind();
            }

            var dtData = DistributionDB.GetContentByZoneIDAndRank(zoneid, 3, (int)AppEnv.CMSContentRank.Default);

            if (dtData.Rows.Count <= 0)
            {
                return;
            }

            rptData.DataSource = dtData;
            rptData.DataBind();
        }
        public void TestRegularDomainRule_WithException()
        {
            var parser = new AbpFormatRuleParser();

            Filter filter = parser.ParseAbpFormattedRule("@@||testsite.com", 1);

            // Needs to be a URL filter.
            if (!(filter is UrlFilter))
            {
                Assert.Fail();
            }

            UrlFilter urlFilter = filter as UrlFilter;

            // is exception to rule.
            Assert.IsTrue(urlFilter.IsException);

            // no need to test matching again for this one.
        }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _zonecurrent        = ZoneUtility.GetZoneCurrent();
            lnkZone.Text        = ZoneDB.GetZoneNameByID(_zonecurrent);
            lnkZone.NavigateUrl = UrlFilter.BuildUrlByZoneID(_zonecurrent);

            var source = ZoneDB.GetByParentID(_zonecurrent);

            if (source.Rows.Count > 0)
            {
                Subcategory_Full_2level1.Visible   = true;
                KhoaHoc_List1.Visible              = false;
                Subcategory_2level_Center1.Visible = true;
            }
            else
            {
                Subcategory_Full_2level1.Visible   = false;
                KhoaHoc_List1.Visible              = true;
                Subcategory_2level_Center1.Visible = false;
            }
        }
        public void TestUrlRule()
        {
            var parser = new AbpFormatRuleParser();

            Filter filter = parser.ParseAbpFormattedRule("||reddit.com^r^nsfw", 1);

            // Needs to be a URL filter.
            if (!(filter is UrlFilter))
            {
                Assert.Fail();
            }

            UrlFilter urlFilter = filter as UrlFilter;

            // is exception to rule.
            Assert.IsFalse(urlFilter.IsException);

            Assert.IsTrue(urlFilter.IsMatch(new Uri("https://reddit.com/r/nsfw/posthere"), null));

            Assert.IsFalse(urlFilter.IsMatch(new Uri("https://reddit.com/r/good"), null));
        }
Example #27
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData   = (DataRowView)e.Item.DataItem;
                var lnkName   = (HyperLink)e.Item.FindControl("lnkName");
                var lnkAvatar = (HyperLink)e.Item.FindControl("lnkAvatar");
                var imgAvatar = (Image)e.Item.FindControl("imgAvatar");
                var litTeaser = (Literal)e.Item.FindControl("litTeaser");

                var distid = ConvertUtility.ToInt32(curData["Distribution_ID"]);

                lnkName.Text        = curData["Content_Name"].ToString();
                lnkName.NavigateUrl = lnkAvatar.NavigateUrl = UrlFilter.BuildUrlByItemID(distid);

                litTeaser.Text = curData["Content_Teaser"].ToString();

                var coverInfo = ImageDB.GetCover(ConvertUtility.ToInt32(curData["Content_ID"]));
                if (coverInfo != null)
                {
                    string avatar = coverInfo.Image_File;
                    if (avatar.Length > 0)
                    {
                        imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(MultimediaUtility.GetOriginalImage(avatar), 224, 0);
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
                else
                {
                    imgAvatar.Visible = false;
                }

                SessionUtility.Remove("excludeid");

                SessionUtility.SetValue("excludeid", distid.ToString());
            }
        }
Example #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string boxtname = "homebottomcenter";
            var          zoneid   = ConvertUtility.ToInt32(ZoneDB.GetIDByFriendlyUrl(boxtname));

            if (zoneid <= 0)
            {
                return;
            }
            var info = ZoneDB.GetInfo(zoneid);

            if (info == null)
            {
                return;
            }

            var avatar = info.Zone_Avatar;

            if (avatar.Length > 0)
            {
                imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(avatar, 235, 0);
            }
            else
            {
                imgAvatar.Visible = false;
            }

            lnkName.Text = info.Zone_Name;

            var realUrl = info.Zone_RealUrl;

            if (realUrl.Length > 0)
            {
                lnkOther.NavigateUrl = lnkName.NavigateUrl = realUrl;
            }
            else
            {
                lnkOther.NavigateUrl = lnkName.NavigateUrl = UrlFilter.BuildUrlByZoneID(info.Zone_ParentID);
            }
        }
        private void AddFilteredPageElement(PageData page, IList <XElement> xmlElements)
        {
            if (PageFilter.ShouldExcludePage(page))
            {
                return;
            }

            string url = this._urlResolver.GetUrl(page.ContentLink, page.LanguageBranch);

            // Make 100% sure we remove the language part in the URL if the sitemap host is mapped to the page's LanguageBranch.
            if (this._hostLanguageBranch != null && page.LanguageBranch.Equals(this._hostLanguageBranch, StringComparison.InvariantCultureIgnoreCase))
            {
                url = url.Replace(string.Format("/{0}/", this._hostLanguageBranch), "/");
            }

            Uri absoluteUri;

            // if the URL is relative we add the base site URL (protocol and hostname)
            if (!IsAbsoluteUrl(url, out absoluteUri))
            {
                url = UriSupport.Combine(this._sitemapData.SiteUrl, url);
            }
            // Force the SiteUrl
            else
            {
                url = UriSupport.Combine(this._sitemapData.SiteUrl, absoluteUri.AbsolutePath);
            }

            var fullPageUrl = new Uri(url);

            if (this._urlSet.Contains(fullPageUrl.ToString()) || UrlFilter.IsUrlFiltered(fullPageUrl.AbsolutePath, this._sitemapData))
            {
                return;
            }

            XElement pageElement = this.GenerateSiteElement(page, fullPageUrl.ToString());

            xmlElements.Add(pageElement);
            this._urlSet.Add(fullPageUrl.ToString());
        }
Example #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            const string boxtname = "homebottomleft";
            var          zoneid   = ConvertUtility.ToInt32(ZoneDB.GetIDByFriendlyUrl(boxtname));

            if (zoneid <= 0)
            {
                return;
            }
            var info = ZoneDB.GetInfo(zoneid);

            if (info == null)
            {
                return;
            }

            lnkZoneName.Text = info.Zone_Name;

            var realUrl = (info.Zone_RealUrl);

            if (realUrl.Length > 0)
            {
                lnkMore.NavigateUrl = lnkZoneName.NavigateUrl = realUrl;
            }
            else
            {
                lnkMore.NavigateUrl = lnkZoneName.NavigateUrl = UrlFilter.BuildUrlByZoneID(info.Zone_ParentID);
            }

            var dtData = DistributionDB.GetContentByZoneIDselfAndNumberRecord(zoneid, 2);

            if (dtData.Rows.Count <= 0)
            {
                return;
            }

            rptData.DataSource = dtData;
            rptData.DataBind();
        }
Example #31
0
        protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
            {
                var curData        = (DataRowView)e.Item.DataItem;
                var lnkName        = (HyperLink)e.Item.FindControl("lnkName");
                var litDescription = (Literal)e.Item.FindControl("litDescription");
                var imgAvatar      = (Image)e.Item.FindControl("imgAvatar");

                if (curData["Zone_ID"].ToString() == _zonecurrent.ToString())
                {
                    lnkName.Font.Underline = true;
                }

                litDescription.Text = curData["Zone_Description"].ToString();

                var avatar = curData["Zone_Avatar"].ToString();
                if (avatar.Length > 0)
                {
                    imgAvatar.ImageUrl = UrlFilter.BuildImageUrl(avatar, 120, 0);
                }
                else
                {
                    imgAvatar.Visible = false;
                }

                lnkName.Text = curData["Zone_Name"].ToString();
                if (curData["Zone_RealUrl"].ToString().Length > 0)
                {
                    lnkName.NavigateUrl = curData["Zone_RealUrl"].ToString();
                }
                else
                {
                    lnkName.NavigateUrl = UrlFilter.BuildUrlByZoneID(ConvertUtility.ToInt32(curData["Zone_ID"]));
                }
            }
        }
 public void FilterDisabled()
 {
     UrlFilter filter = new UrlFilter { Enabled = false };
     bool result = filter.Test(@"http://www.dws.com.au/Foobar");
     Assert.IsTrue(result);
 }