protected override void OnLoad(EventArgs e) { base.OnLoad(e); _securityValidator.EnsureValidUser(); Response.Expires = -1; Response.ContentType = "application/json"; if (!Request.ContentType.Contains("json")) { Response.Write("Request does not contain JSON data."); Response.End(); return; } var streamReader = new StreamReader(Request.InputStream, Encoding.UTF8); var jsonString = streamReader.ReadToEnd(); var jObject = JObject.Parse(jsonString); var targetFile = (string)jObject["targetFilename"]; var patternFile = (string)jObject["patternFilename"]; _securityValidator.EnsureValid(_languageLocationService.PathTo(targetFile)); _securityValidator.EnsureValid(_languageLocationService.PathTo(patternFile)); _languageFileUpdater.NewContent = (JObject)jObject["xmlContent"]; _languageFileUpdater.ExecuteApplyFor(targetFile, patternFile); Response.Write("{\"Status\":\"200 OK\"}"); Response.End(); }
protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); _securityValidator.EnsureValidUser(); Page.MasterPageFile = EPiServer.Configuration.Settings.Instance.UIUrl + "MasterPages/EPiServerUI.Master"; SystemMessageContainer.Heading = "Language File Editor v.1.1 (EPi7)"; SystemMessageContainer.Description = "This tool allows for updating texts on the website that are retrieved from language files; a normal administrator should not need to use the backup and restore features, they exist to prevent data loss during deploys."; _langPath = _languageLocationService.LanguagePath; }