public void GetSettings(Type type)
        {
            this.ValidateSettings = null;

            if (!String.IsNullOrEmpty(this.EncodedSettings))
            {
                string        sXML          = CMSConfigHelper.DecodeBase64(this.EncodedSettings);
                XmlSerializer xmlSerializer = new XmlSerializer(type);
                using (StringReader stringReader = new StringReader(sXML)) {
                    this.ValidateSettings = xmlSerializer.Deserialize(stringReader);
                }

                if (this.ValidateSettings != null && this.ValidateSettings is IFormSettingBase)
                {
                    IFormSettingBase settings = this.ValidateSettings as IFormSettingBase;

                    if (!String.IsNullOrEmpty(settings.ValidateHumanClass))
                    {
                        Type   objType = ReflectionUtilities.GetTypeFromString(settings.ValidateHumanClass);
                        Object obj     = Activator.CreateInstance(objType);
                        this.ValidateHuman = (IValidateHuman)obj;
                        this.ValidateHuman.AltValidationFailText = settings.ValidationFailText;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                gTheID = new Guid(Request.QueryString["id"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["parm"]))
            {
                imageFile = CMSConfigHelper.DecodeBase64(Request.QueryString["parm"].ToString());
            }
            if (imageFile.Contains("../") || imageFile.Contains(@"..\"))
            {
                throw new Exception("Cannot use relative paths.");
            }
            if (imageFile.Contains(":"))
            {
                throw new Exception("Cannot specify drive letters.");
            }
            if (imageFile.Contains("//") || imageFile.Contains(@"\\"))
            {
                throw new Exception("Cannot use UNC paths.");
            }

            litImgName.Text      = imageFile;
            ImageSizer1.ImageUrl = imageFile;
            ImageSizer1.ToolTip  = imageFile;

            if (!IsPostBack)
            {
                LoadForm();
            }
        }
Beispiel #3
0
        public void ReconstructSettings()
        {
            this.Settings = null;

            if (!String.IsNullOrEmpty(this.EncodedSettings))
            {
                string        sXML          = CMSConfigHelper.DecodeBase64(this.EncodedSettings);
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(LogoutInfoSettings));
                using (StringReader stringReader = new StringReader(sXML)) {
                    this.Settings = (LogoutInfoSettings)xmlSerializer.Deserialize(stringReader);
                }
            }

            this.IsLoggedIn = SecurityData.IsAuthenticated;
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.ActivateTab(AdminBaseMasterPage.SectionID.ContentSkinEdit);

            if (!String.IsNullOrEmpty(Request.QueryString["path"]))
            {
                sTemplateFileQS = Request.QueryString["path"].ToString();
                sTemplateFile   = CMSConfigHelper.DecodeBase64(sTemplateFileQS);
                sFullFilePath   = HttpContext.Current.Server.MapPath(sTemplateFile);
                sEditFile       = sFullFilePath;
            }

            if (!String.IsNullOrEmpty(Request.QueryString["alt"]))
            {
                string sAltFileQS = Request.QueryString["alt"].ToString();
                string sAltFile   = CMSConfigHelper.DecodeBase64(sAltFileQS);
                sEditFile = HttpContext.Current.Server.MapPath(sAltFile);
            }

            litSkinFileName.Text = sTemplateFile;

            litEditFileName.Text = sEditFile.Replace(Server.MapPath("~"), @"\");

            if (File.Exists(sEditFile))
            {
                if (!IsPostBack)
                {
                    using (StreamReader sr = new StreamReader(sEditFile)) {
                        txtPageContents.Text = sr.ReadToEnd();
                    }
                }

                litDateMod.Text = File.GetLastWriteTime(sEditFile).ToString();

                if (sFullFilePath.LastIndexOf(@"\") > 0)
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"\"));
                }
                else
                {
                    sDirectory = sFullFilePath.Substring(0, sFullFilePath.LastIndexOf(@"/"));
                }

                SetSourceFiles(sDirectory);
            }
        }
Beispiel #5
0
        public SiteSkinModel(string encodedPath)
            : this()
        {
            this.EncodedPath  = encodedPath;
            this.TemplateFile = CMSConfigHelper.DecodeBase64(encodedPath);
            this.FullFilePath = HttpContext.Current.Server.MapPath(this.TemplateFile);

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                this.Template = cmsHelper.Templates.Where(x => x.TemplatePath.ToLowerInvariant() == this.TemplateFile.ToLowerInvariant()).FirstOrDefault();
            }

            var ifo = new FileInfo(this.TemplateFile);

            this.TemplateFolder = ifo.Directory.FullName;

            this.EditFile = this.TemplateFile;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                gTheID = new Guid(Request.QueryString["id"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["parm"]))
            {
                sImageFile = CMSConfigHelper.DecodeBase64(Request.QueryString["parm"].ToString());
            }

            litImgName.Text      = sImageFile;
            ImageSizer1.ImageUrl = sImageFile;
            ImageSizer1.ToolTip  = sImageFile;

            if (!IsPostBack)
            {
                LoadForm();
            }
        }
Beispiel #7
0
        public SiteSkinModel(string encodedPath, string altPath)
            : this(encodedPath) {
            this.AltPath = CMSConfigHelper.DecodeBase64(altPath);

            this.EditFile = this.AltPath;
        }