Ejemplo n.º 1
0
    //protected override void Render(HtmlTextWriter writer)
    //{
    //    //html minifier & JS at bottom
    //    // not tested
    //    if (this.Request.Headers["X-MicrosoftAjax"] != "Delta=true")
    //    {
    //        System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"<script[^>]*>[\w|\t|\r|\W]*?</script>");
    //        System.Text.StringBuilder sb = new System.Text.StringBuilder();
    //        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
    //        HtmlTextWriter hw = new HtmlTextWriter(sw);
    //        base.Render(hw);
    //        string html = sb.ToString();
    //        System.Text.RegularExpressions.MatchCollection mymatch = reg.Matches(html);
    //        html = reg.Replace(html, string.Empty);
    //        reg = new System.Text.RegularExpressions.Regex(@"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}|(?=[\r])\s{2,}");
    //        html = reg.Replace(html, string.Empty);
    //        reg = new System.Text.RegularExpressions.Regex(@"</body>");
    //        string str = string.Empty;
    //        foreach (System.Text.RegularExpressions.Match match in mymatch)
    //        {
    //            str += match.ToString();
    //        }
    //        html = reg.Replace(html, str + "</body>");
    //        writer.Write(html);
    //    }
    //    else
    //        base.Render(writer);
    //}
    protected void Page_Load(object sender, EventArgs e)
    {
        CMSfunc.checkURL();
        string lang = Request.QueryString["lang"];

        if (!String.IsNullOrEmpty(lang) && lang != "1")
        {
            Session["vlang"] = lang;
        }
        if (Session["vlang"] == null || lang == "1")
        {
            Session["vlang"] = "1";
        }
        string url  = String.IsNullOrEmpty(Request["url"]) ? "Home" : Request["url"].ToString();
        string nUrl = String.IsNullOrEmpty(Request["nUrl"]) ? "" : Request["nUrl"].ToString();

        p  = ModControl.GetP_From_Code(url);
        id = ModControl.GetID_From_Url(p, nUrl);
        string page     = ConvertUtil.Nullcheck(Request.QueryString.Get("page"), "1");
        string pagesize = ConvertUtil.Nullcheck(Request.Form.Get("pagesizechange"), "10");

        LoadHeadTag(p, id);
        ltrMenutop.Text    = LoadMenutop(0);
        ltrMenufooter.Text = GetMnFooter();
        string field = "Mod_ID,Content_Name,Content_Img,Content_Intro,Content_Url";

        string where = " lang=" + Session["vlang"] + " AND Content_Status=1 AND Mod_ID in(SELECT Mod_ID FROM tbl_Mod WHERE Mod_Status=1 AND Modtype_ID=1)";
        string k = ApplicationUtil.FormatSqlString(Request["k"]);

        if (k != "")
        {
            where += " AND Content_Name like N'%" + k + "%'";
        }
        string sqlorder = " ORDER BY Content_ID DESC";

        LoadNews(Convert.ToInt16(page), Convert.ToInt16(pagesize), field, where, sqlorder);
        VisitorCounter();
        lrtPath.Text = CMSfunc.LoadPath(ModControl.GetP_From_Code("tim-kiem"), 0);
    }