示例#1
0
        private void CheckPermission()
        {
            int permissionType;
            ContentPermissionInfo contentPermissionInfoById = PermissionContent.GetContentPermissionInfoById(this.m_GeneralId);

            if (contentPermissionInfoById == null)
            {
                permissionType = 0;
            }
            else
            {
                permissionType = contentPermissionInfoById.PermissionType;
            }
            switch (permissionType)
            {
            case 0:
                switch (this.m_NodeInfo.PurviewType)
                {
                case 1:
                    this.CheckIsAuthenticated();
                    return;

                case 2:
                    this.CheckIsAuthenticated();
                    if (UserPermissions.AccessCheck(OperateCode.NodeContentPreview, this.m_NodeInfo.NodeId))
                    {
                        break;
                    }
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                    return;
                }
                return;

            case 1:
                this.CheckIsAuthenticated();
                return;

            case 2:
                this.CheckIsAuthenticated();
                if (!StringHelper.FoundCharInArr(contentPermissionInfoById.ArrGroupId, PEContext.Current.User.GroupId.ToString()))
                {
                    TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系", "Default.aspx");
                }
                break;

            default:
                return;
            }
        }
示例#2
0
        private string GetTemplateFile(int modelId)
        {
            string    str            = "";
            ModelInfo cacheModelById = ModelManager.GetCacheModelById(modelId);

            if (!cacheModelById.IsNull)
            {
                if (!string.IsNullOrEmpty(cacheModelById.SearchTemplate))
                {
                    return(cacheModelById.SearchTemplate);
                }
                TemplatePage.WriteErrMsg("指定的模型未设置模板!");
                return(str);
            }
            TemplatePage.WriteErrMsg("找不到指定的模型!");
            return(str);
        }
 public override void OnInitTemplatePage(EventArgs e)
 {
     this.m_GeneralId = BasePage.RequestInt32("id");
     if (this.m_GeneralId <= 0)
     {
         TemplatePage.WriteErrMsg("您访问的内容信息不存在", "Default.aspx");
     }
     this.m_ItemInfo = ContentManage.GetCommonModelInfoById(this.m_GeneralId);
     if (this.m_ItemInfo == null)
     {
         TemplatePage.WriteErrMsg("您访问的内容信息不存在", "Default.aspx");
     }
     this.m_NodeInfo  = Nodes.GetCacheNodeById(this.m_ItemInfo.NodeId);
     this.m_ModelInfo = ModelManager.GetModelInfoById(this.m_ItemInfo.ModelId);
     if (this.m_ModelInfo.IsNull || string.IsNullOrEmpty(this.m_ModelInfo.PrintTemplate))
     {
         TemplatePage.WriteErrMsg("没有指定模型打印页模板", "Default.aspx");
     }
     this.CheckPermission();
 }
示例#4
0
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath));

            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList       = base.Request.QueryString;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的作者列表页未设置模板!", "Default.aspx");
            }
        }
示例#5
0
 public override void OnInitTemplatePage(EventArgs e)
 {
     this.m_GeneralId = BasePage.RequestInt32("id");
     if (this.m_GeneralId <= 0)
     {
         TemplatePage.WriteErrMsg("您访问的内容信息不存在", base.BasePath + "Default.aspx");
     }
     this.m_ItemInfo = ContentManage.GetCommonModelInfoById(this.m_GeneralId);
     if (this.m_ItemInfo.IsNull)
     {
         TemplatePage.WriteErrMsg("您访问的内容信息不存在", base.BasePath + "Default.aspx");
     }
     else
     {
         this.m_ModelInfo = ModelManager.GetModelInfoById(this.m_ItemInfo.ModelId);
         if (!this.m_ModelInfo.IsEshop && (this.m_ItemInfo.Status != 0x63))
         {
             TemplatePage.WriteErrMsg("您访问的内容信息需要经过审核才能浏览", base.BasePath + "Default.aspx");
         }
     }
     this.m_NodeInfo = Nodes.GetCacheNodeById(this.m_ItemInfo.NodeId);
 }
        public override void OnInitTemplatePage(EventArgs e)
        {
            this.m_Page = BasePage.RequestInt32("page", 0);
            int nodeId = BasePage.RequestInt32("id");

            if (nodeId <= 0)
            {
                TemplatePage.WriteErrMsg("您访问的栏目不存在");
            }
            else
            {
                this.nodeInfo = Nodes.GetCacheNodeById(nodeId);
                if (this.nodeInfo.IsNull)
                {
                    TemplatePage.WriteErrMsg("您访问的栏目不存在!");
                }
                else
                {
                    switch (this.nodeInfo.PurviewType)
                    {
                    case 2:
                        this.CheckIsAuthenticated();
                        if (!UserPermissions.AccessCheck(OperateCode.NodeContentPreview, nodeId))
                        {
                            TemplatePage.WriteErrMsg("您没有查看该页的权限,请与网站管理员联系");
                        }
                        break;
                    }
                    if ((this.m_Page == 0) || (this.m_Page == 1))
                    {
                        base.IsCache   = true;
                        base.CacheKey  = "CK_Page_Category_" + base.Request.QueryString["id"];
                        base.CacheTime = 12 * this.nodeInfo.Settings.CacheTime;
                    }
                }
            }
        }
示例#7
0
        private string GetSpecialTemplate(int specialid, int specialcategoryid)
        {
            string str = "";

            if (specialcategoryid > 0)
            {
                SpecialCategoryInfo specialCategoryInfoById = Special.GetSpecialCategoryInfoById(specialcategoryid);
                if (!specialCategoryInfoById.IsNull)
                {
                    if (!string.IsNullOrEmpty(specialCategoryInfoById.SearchTemplatePath))
                    {
                        return(specialCategoryInfoById.SearchTemplatePath);
                    }
                    TemplatePage.WriteErrMsg("没有设置专题类别模板!", "Special.aspx");
                    return(str);
                }
                TemplatePage.WriteErrMsg("找不到指定的专题类别!", "Special.aspx");
                return(str);
            }
            if (specialid > 0)
            {
                SpecialInfo specialInfoById = Special.GetSpecialInfoById(specialid);
                if (!specialInfoById.IsNull)
                {
                    if (!string.IsNullOrEmpty(specialInfoById.SearchTemplatePath))
                    {
                        return(specialInfoById.SearchTemplatePath);
                    }
                    TemplatePage.WriteErrMsg("没有设置专题模板!", "Special.aspx");
                    return(str);
                }
                TemplatePage.WriteErrMsg("找不到指定的专题!", "Special.aspx");
                return(str);
            }
            TemplatePage.WriteErrMsg("没有设置任何专题模板!", "Special.aspx");
            return(str);
        }
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string   str      = BasePage.RequestString("updatetime");
            DateTime?nullable = null;

            if (!string.IsNullOrEmpty(str))
            {
                nullable = new DateTime?(DataConverter.CDate(str));
            }
            string dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(Path.GetFileNameWithoutExtension(this.Page.Request.FilePath));
            NameValueCollection values       = new NameValueCollection();

            values.Add("authorname", DataSecurity.FilterBadChar(BasePage.RequestString("authorname")));
            if (!nullable.HasValue)
            {
                values.Add("updatetime", string.Empty);
            }
            else
            {
                values.Add("updatetime", nullable.Value.ToString("yyyy-MM-dd"));
            }
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList       = values;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的作者未设置模板!", SiteConfig.SiteInfo.VirtualPath + "Default.aspx");
            }
        }
        public override void OnInitTemplateInfo(EventArgs e)
        {
            string str = BasePage.RequestStringToLower("action");
            string dynamicConfigTemplatePath = "";
            string str4 = str;

            if (str4 != null)
            {
                if (!(str4 == "special"))
                {
                    if (str4 == "specialcategory")
                    {
                        if (this.specialCategoryInfo.IsNull)
                        {
                            TemplatePage.WriteErrMsg("您查看的专题类别不存在!", base.BasePath + "Default.aspx");
                        }
                        dynamicConfigTemplatePath = this.specialCategoryInfo.SpecialTemplatePath;
                        goto Label_00AF;
                    }
                }
                else
                {
                    if (this.specialInfo.IsNull)
                    {
                        TemplatePage.WriteErrMsg("您查看的专题不存在!", base.BasePath + "Default.aspx");
                    }
                    dynamicConfigTemplatePath = this.specialInfo.SpecialTemplatePath;
                    goto Label_00AF;
                }
            }
            string fileName = "Special";

            dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath(fileName);
Label_00AF:
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                TemplateInfo info = new TemplateInfo();
                info.QueryList = base.Request.QueryString;
                NameValueCollection queryString = base.Request.QueryString;
                StringBuilder       builder     = new StringBuilder();
                if (queryString.Count > 3)
                {
                    for (int i = 2; i < queryString.Count; i++)
                    {
                        builder.Append(queryString[i]);
                        builder.Append("&");
                    }
                }
                info.PageName = "index_{$pageid/}.aspx";
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    info.PageName = info.PageName + "?" + builder.ToString();
                }
                info.PageType        = 1;
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.IsDynamicPage   = true;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("您查看的专题未设置模板!", base.BasePath + "Default.aspx");
            }
        }
示例#10
0
        public override void OnInitTemplateInfo(EventArgs e)
        {
            TemplateInfo        info    = new TemplateInfo();
            int                 num     = BasePage.RequestInt32("searchtype");
            string              str     = DataSecurity.FilterBadChar(base.Request.QueryString["keyword"]);
            int                 modelId = BasePage.RequestInt32("ModelId");
            string              dynamicConfigTemplatePath = "";
            NameValueCollection queryString = new NameValueCollection();

            switch (num)
            {
            case 0:
                if (!string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = TemplatePage.GetDynamicConfigTemplatePath("Search");
                break;

            case 1:
                if ((DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]) == "keyword") && !string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = this.GetTemplateFile(modelId);
                break;

            case 2:
                if (BasePage.RequestInt32("showtype") != 1)
                {
                    dynamicConfigTemplatePath = this.GetAdvanceTemplateForm(modelId);
                    break;
                }
                queryString = base.Request.QueryString;
                dynamicConfigTemplatePath = this.GetAdvanceTemplateFile(modelId);
                break;

            case 3:
            {
                string[] strArray          = DataSecurity.FilterBadChar(base.Request.QueryString["specialid"]).Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                int      specialid         = DataConverter.CLng(strArray[1]);
                int      specialcategoryid = DataConverter.CLng(strArray[0]);
                queryString.Add("specialid", specialid.ToString());
                queryString.Add("specialcategoryid", specialcategoryid.ToString());
                string str5 = DataSecurity.FilterBadChar(base.Request.QueryString["fieldoption"]);
                queryString.Add("fieldoption", str5);
                if ((str5 == "keyword") && !string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                queryString.Add("keyword", str);
                dynamicConfigTemplatePath = this.GetSpecialTemplate(specialid, specialcategoryid);
                break;
            }

            default:
                queryString = base.Request.QueryString;
                if (!string.IsNullOrEmpty(str))
                {
                    this.SaveKeyword(str);
                }
                dynamicConfigTemplatePath = this.GetTemplatePath("Search");
                break;
            }
            if (!string.IsNullOrEmpty(dynamicConfigTemplatePath))
            {
                info.QueryList       = queryString;
                info.PageName        = TemplatePage.RebuildPageName(base.Request.Url.LocalPath, base.Request.QueryString);
                info.TemplateContent = Template.GetTemplateContent(dynamicConfigTemplatePath);
                info.RootPath        = HttpContext.Current.Request.PhysicalApplicationPath;
                info.CurrentPage     = DataConverter.CLng(base.Request.QueryString["page"], 1);
                info.IsDynamicPage   = true;
                info.PageType        = 1;
                base.TemplateInfo    = info;
            }
            else
            {
                TemplatePage.WriteErrMsg("全站搜索结果页未设置模板!", "Default.aspx");
            }
        }