public ActionResult GeneralCommon(string selectedTab) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); //set page timeout to 5 minutes this.Server.ScriptTimeout = 300; var model = new GeneralCommonSettingsModel(); var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); model.ActiveStoreScopeConfiguration = storeScope; //store information var storeInformationSettings = _settingService.LoadSetting<StoreInformationSettings>(storeScope); model.StoreInformationSettings.StoreClosed = storeInformationSettings.StoreClosed; model.StoreInformationSettings.StoreClosedAllowForAdmins = storeInformationSettings.StoreClosedAllowForAdmins; //desktop themes model.StoreInformationSettings.DefaultStoreThemeForDesktops = storeInformationSettings.DefaultStoreThemeForDesktops; model.StoreInformationSettings.AvailableStoreThemesForDesktops = _themeProvider .GetThemeConfigurations() .Where(x => !x.MobileTheme) .Select(x => { return new SelectListItem() { Text = x.ThemeTitle, Value = x.ThemeName, Selected = x.ThemeName.Equals(storeInformationSettings.DefaultStoreThemeForDesktops, StringComparison.InvariantCultureIgnoreCase) }; }) .ToList(); model.StoreInformationSettings.AllowCustomerToSelectTheme = storeInformationSettings.AllowCustomerToSelectTheme; model.StoreInformationSettings.MobileDevicesSupported = storeInformationSettings.MobileDevicesSupported; //mobile device themes model.StoreInformationSettings.DefaultStoreThemeForMobileDevices = storeInformationSettings.DefaultStoreThemeForMobileDevices; model.StoreInformationSettings.AvailableStoreThemesForMobileDevices = _themeProvider .GetThemeConfigurations() .Where(x => x.MobileTheme) .Select(x => { return new SelectListItem() { Text = x.ThemeTitle, Value = x.ThemeName, Selected = x.ThemeName.Equals(storeInformationSettings.DefaultStoreThemeForMobileDevices, StringComparison.InvariantCultureIgnoreCase) }; }) .ToList(); //EU Cookie law model.StoreInformationSettings.DisplayEuCookieLawWarning = storeInformationSettings.DisplayEuCookieLawWarning; //override settings if (storeScope > 0) { model.StoreInformationSettings.MobileDevicesSupported_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.MobileDevicesSupported, storeScope); model.StoreInformationSettings.StoreClosed_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.StoreClosed, storeScope); model.StoreInformationSettings.StoreClosedAllowForAdmins_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.StoreClosedAllowForAdmins, storeScope); model.StoreInformationSettings.DefaultStoreThemeForDesktops_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.DefaultStoreThemeForDesktops, storeScope); model.StoreInformationSettings.DefaultStoreThemeForMobileDevices_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.DefaultStoreThemeForMobileDevices, storeScope); model.StoreInformationSettings.AllowCustomerToSelectTheme_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.AllowCustomerToSelectTheme, storeScope); model.StoreInformationSettings.DisplayEuCookieLawWarning_OverrideForStore = _settingService.SettingExists(storeInformationSettings, x => x.DisplayEuCookieLawWarning, storeScope); } //seo settings var seoSettings = _settingService.LoadSetting<SeoSettings>(storeScope); model.SeoSettings.PageTitleSeparator = seoSettings.PageTitleSeparator; model.SeoSettings.PageTitleSeoAdjustment = (int)seoSettings.PageTitleSeoAdjustment; model.SeoSettings.PageTitleSeoAdjustmentValues = seoSettings.PageTitleSeoAdjustment.ToSelectList(); model.SeoSettings.DefaultTitle = seoSettings.DefaultTitle; model.SeoSettings.DefaultMetaKeywords = seoSettings.DefaultMetaKeywords; model.SeoSettings.DefaultMetaDescription = seoSettings.DefaultMetaDescription; model.SeoSettings.ConvertNonWesternChars = seoSettings.ConvertNonWesternChars; model.SeoSettings.CanonicalUrlsEnabled = seoSettings.CanonicalUrlsEnabled; //override settings if (storeScope > 0) { model.SeoSettings.PageTitleSeparator_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.PageTitleSeparator, storeScope); model.SeoSettings.PageTitleSeoAdjustment_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.PageTitleSeoAdjustment, storeScope); model.SeoSettings.DefaultTitle_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.DefaultTitle, storeScope); model.SeoSettings.DefaultMetaKeywords_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.DefaultMetaKeywords, storeScope); model.SeoSettings.DefaultMetaDescription_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.DefaultMetaDescription, storeScope); model.SeoSettings.ConvertNonWesternChars_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.ConvertNonWesternChars, storeScope); model.SeoSettings.CanonicalUrlsEnabled_OverrideForStore = _settingService.SettingExists(seoSettings, x => x.CanonicalUrlsEnabled, storeScope); } //security settings var securitySettings = _settingService.LoadSetting<SecuritySettings>(storeScope); var captchaSettings = _settingService.LoadSetting<CaptchaSettings>(storeScope); model.SecuritySettings.EncryptionKey = securitySettings.EncryptionKey; if (securitySettings.AdminAreaAllowedIpAddresses != null) for (int i = 0; i < securitySettings.AdminAreaAllowedIpAddresses.Count; i++) { model.SecuritySettings.AdminAreaAllowedIpAddresses += securitySettings.AdminAreaAllowedIpAddresses[i]; if (i != securitySettings.AdminAreaAllowedIpAddresses.Count - 1) model.SecuritySettings.AdminAreaAllowedIpAddresses += ","; } model.SecuritySettings.HideAdminMenuItemsBasedOnPermissions = securitySettings.HideAdminMenuItemsBasedOnPermissions; model.SecuritySettings.CaptchaEnabled = captchaSettings.Enabled; model.SecuritySettings.CaptchaShowOnLoginPage = captchaSettings.ShowOnLoginPage; model.SecuritySettings.CaptchaShowOnRegistrationPage = captchaSettings.ShowOnRegistrationPage; model.SecuritySettings.CaptchaShowOnContactUsPage = captchaSettings.ShowOnContactUsPage; model.SecuritySettings.CaptchaShowOnEmailWishlistToFriendPage = captchaSettings.ShowOnEmailWishlistToFriendPage; model.SecuritySettings.CaptchaShowOnEmailProductToFriendPage = captchaSettings.ShowOnEmailProductToFriendPage; model.SecuritySettings.CaptchaShowOnBlogCommentPage = captchaSettings.ShowOnBlogCommentPage; model.SecuritySettings.CaptchaShowOnNewsCommentPage = captchaSettings.ShowOnNewsCommentPage; model.SecuritySettings.CaptchaShowOnProductReviewPage = captchaSettings.ShowOnProductReviewPage; model.SecuritySettings.ReCaptchaPublicKey = captchaSettings.ReCaptchaPublicKey; model.SecuritySettings.ReCaptchaPrivateKey = captchaSettings.ReCaptchaPrivateKey; //PDF settings var pdfSettings = _settingService.LoadSetting<PdfSettings>(storeScope); model.PdfSettings.Enabled = pdfSettings.Enabled; model.PdfSettings.LetterPageSizeEnabled = pdfSettings.LetterPageSizeEnabled; model.PdfSettings.LogoPictureId = pdfSettings.LogoPictureId; //override settings if (storeScope > 0) { model.PdfSettings.Enabled_OverrideForStore = _settingService.SettingExists(pdfSettings, x => x.Enabled, storeScope); model.PdfSettings.LetterPageSizeEnabled_OverrideForStore = _settingService.SettingExists(pdfSettings, x => x.LetterPageSizeEnabled, storeScope); model.PdfSettings.LogoPictureId_OverrideForStore = _settingService.SettingExists(pdfSettings, x => x.LogoPictureId, storeScope); } //localization var localizationSettings = _settingService.LoadSetting<LocalizationSettings>(storeScope); model.LocalizationSettings.UseImagesForLanguageSelection = localizationSettings.UseImagesForLanguageSelection; model.LocalizationSettings.SeoFriendlyUrlsForLanguagesEnabled = localizationSettings.SeoFriendlyUrlsForLanguagesEnabled; model.LocalizationSettings.LoadAllLocaleRecordsOnStartup = localizationSettings.LoadAllLocaleRecordsOnStartup; //full-text support var commonSettings = _settingService.LoadSetting<CommonSettings>(storeScope); model.FullTextSettings.Supported = _fulltextService.IsFullTextSupported(); model.FullTextSettings.Enabled = commonSettings.UseFullTextSearch; model.FullTextSettings.SearchMode = (int)commonSettings.FullTextMode; model.FullTextSettings.SearchModeValues = commonSettings.FullTextMode.ToSelectList(); ViewData["selectedTab"] = selectedTab; return View(model); }
public ActionResult ToggleFullText(GeneralCommonSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var commonSettings = _settingService.LoadSetting<CommonSettings>(storeScope); try { if (! _fulltextService.IsFullTextSupported()) throw new NasException(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.FullTextSettings.NotSupported")); if (commonSettings.UseFullTextSearch) { _fulltextService.DisableFullText(); commonSettings.UseFullTextSearch = false; _settingService.SaveSetting(commonSettings); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.FullTextSettings.Disabled")); } else { _fulltextService.EnableFullText(); commonSettings.UseFullTextSearch = true; _settingService.SaveSetting(commonSettings); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.FullTextSettings.Enabled")); } } catch (Exception exc) { ErrorNotification(exc); } return RedirectToAction("GeneralCommon", new { selectedTab = "fulltext" }); }
public ActionResult ChangeEncryptionKey(GeneralCommonSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); //set page timeout to 5 minutes this.Server.ScriptTimeout = 300; var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); var securitySettings = _settingService.LoadSetting<SecuritySettings>(storeScope); try { if (model.SecuritySettings.EncryptionKey == null) model.SecuritySettings.EncryptionKey = ""; model.SecuritySettings.EncryptionKey = model.SecuritySettings.EncryptionKey.Trim(); var newEncryptionPrivateKey = model.SecuritySettings.EncryptionKey; if (String.IsNullOrEmpty(newEncryptionPrivateKey) || newEncryptionPrivateKey.Length != 16) throw new NasException(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.EncryptionKey.TooShort")); string oldEncryptionPrivateKey = securitySettings.EncryptionKey; if (oldEncryptionPrivateKey == newEncryptionPrivateKey) throw new NasException(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.EncryptionKey.TheSame")); //update encrypted order info var orders = _orderService.SearchOrders(0, 0, 0, null, null, null, null, null, null, null, 0, int.MaxValue); foreach (var order in orders) { string decryptedCardType = _encryptionService.DecryptText(order.CardType, oldEncryptionPrivateKey); string decryptedCardName = _encryptionService.DecryptText(order.CardName, oldEncryptionPrivateKey); string decryptedCardNumber = _encryptionService.DecryptText(order.CardNumber, oldEncryptionPrivateKey); string decryptedMaskedCreditCardNumber = _encryptionService.DecryptText(order.MaskedCreditCardNumber, oldEncryptionPrivateKey); string decryptedCardCvv2 = _encryptionService.DecryptText(order.CardCvv2, oldEncryptionPrivateKey); string decryptedCardExpirationMonth = _encryptionService.DecryptText(order.CardExpirationMonth, oldEncryptionPrivateKey); string decryptedCardExpirationYear = _encryptionService.DecryptText(order.CardExpirationYear, oldEncryptionPrivateKey); string encryptedCardType = _encryptionService.EncryptText(decryptedCardType, newEncryptionPrivateKey); string encryptedCardName = _encryptionService.EncryptText(decryptedCardName, newEncryptionPrivateKey); string encryptedCardNumber = _encryptionService.EncryptText(decryptedCardNumber, newEncryptionPrivateKey); string encryptedMaskedCreditCardNumber = _encryptionService.EncryptText(decryptedMaskedCreditCardNumber, newEncryptionPrivateKey); string encryptedCardCvv2 = _encryptionService.EncryptText(decryptedCardCvv2, newEncryptionPrivateKey); string encryptedCardExpirationMonth = _encryptionService.EncryptText(decryptedCardExpirationMonth, newEncryptionPrivateKey); string encryptedCardExpirationYear = _encryptionService.EncryptText(decryptedCardExpirationYear, newEncryptionPrivateKey); order.CardType = encryptedCardType; order.CardName = encryptedCardName; order.CardNumber = encryptedCardNumber; order.MaskedCreditCardNumber = encryptedMaskedCreditCardNumber; order.CardCvv2 = encryptedCardCvv2; order.CardExpirationMonth = encryptedCardExpirationMonth; order.CardExpirationYear = encryptedCardExpirationYear; _orderService.UpdateOrder(order); } //update user information //optimization - load only users with PasswordFormat.Encrypted var customers = _customerService.GetAllCustomersByPasswordFormat(PasswordFormat.Encrypted); foreach (var customer in customers) { string decryptedPassword = _encryptionService.DecryptText(customer.Password, oldEncryptionPrivateKey); string encryptedPassword = _encryptionService.EncryptText(decryptedPassword, newEncryptionPrivateKey); customer.Password = encryptedPassword; _customerService.UpdateCustomer(customer); } securitySettings.EncryptionKey = newEncryptionPrivateKey; _settingService.SaveSetting(securitySettings); SuccessNotification(_localizationService.GetResource("Admin.Configuration.Settings.GeneralCommon.EncryptionKey.Changed")); } catch (Exception exc) { ErrorNotification(exc); } return RedirectToAction("GeneralCommon", new { selectedTab = "security" }); }
public ActionResult GeneralCommon(GeneralCommonSettingsModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings)) return AccessDeniedView(); //load settings for a chosen store scope var storeScope = this.GetActiveStoreScopeConfiguration(_storeService, _workContext); //store information settings var storeInformationSettings = _settingService.LoadSetting<StoreInformationSettings>(storeScope); storeInformationSettings.StoreClosed = model.StoreInformationSettings.StoreClosed; storeInformationSettings.StoreClosedAllowForAdmins = model.StoreInformationSettings.StoreClosedAllowForAdmins; storeInformationSettings.DefaultStoreThemeForDesktops = model.StoreInformationSettings.DefaultStoreThemeForDesktops; storeInformationSettings.AllowCustomerToSelectTheme = model.StoreInformationSettings.AllowCustomerToSelectTheme; //store whether MobileDevicesSupported setting has been changed (requires application restart) bool mobileDevicesSupportedChanged = storeInformationSettings.MobileDevicesSupported != model.StoreInformationSettings.MobileDevicesSupported; storeInformationSettings.MobileDevicesSupported = model.StoreInformationSettings.MobileDevicesSupported; storeInformationSettings.DefaultStoreThemeForMobileDevices = model.StoreInformationSettings.DefaultStoreThemeForMobileDevices; //EU Cookie law storeInformationSettings.DisplayEuCookieLawWarning = model.StoreInformationSettings.DisplayEuCookieLawWarning; /* We do not clear cache after each setting update. * This behavior can increase performance because cached settings will not be cleared * and loaded from database after each update */ if (model.StoreInformationSettings.MobileDevicesSupported_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.MobileDevicesSupported, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.MobileDevicesSupported, storeScope); if (model.StoreInformationSettings.StoreClosed_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.StoreClosed, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.StoreClosed, storeScope); if (model.StoreInformationSettings.StoreClosedAllowForAdmins_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.StoreClosedAllowForAdmins, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.StoreClosedAllowForAdmins, storeScope); if (model.StoreInformationSettings.DefaultStoreThemeForDesktops_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.DefaultStoreThemeForDesktops, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.DefaultStoreThemeForDesktops, storeScope); if (model.StoreInformationSettings.DefaultStoreThemeForMobileDevices_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.DefaultStoreThemeForMobileDevices, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.DefaultStoreThemeForMobileDevices, storeScope); if (model.StoreInformationSettings.AllowCustomerToSelectTheme_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.AllowCustomerToSelectTheme, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.AllowCustomerToSelectTheme, storeScope); if (model.StoreInformationSettings.DisplayEuCookieLawWarning_OverrideForStore || storeScope == 0) _settingService.SaveSetting(storeInformationSettings, x => x.DisplayEuCookieLawWarning, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(storeInformationSettings, x => x.DisplayEuCookieLawWarning, storeScope); //now clear settings cache _settingService.ClearCache(); //seo settings var seoSettings = _settingService.LoadSetting<SeoSettings>(storeScope); seoSettings.PageTitleSeparator = model.SeoSettings.PageTitleSeparator; seoSettings.PageTitleSeoAdjustment = (PageTitleSeoAdjustment)model.SeoSettings.PageTitleSeoAdjustment; seoSettings.DefaultTitle = model.SeoSettings.DefaultTitle; seoSettings.DefaultMetaKeywords = model.SeoSettings.DefaultMetaKeywords; seoSettings.DefaultMetaDescription = model.SeoSettings.DefaultMetaDescription; seoSettings.ConvertNonWesternChars = model.SeoSettings.ConvertNonWesternChars; seoSettings.CanonicalUrlsEnabled = model.SeoSettings.CanonicalUrlsEnabled; /* We do not clear cache after each setting update. * This behavior can increase performance because cached settings will not be cleared * and loaded from database after each update */ if (model.SeoSettings.PageTitleSeparator_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.PageTitleSeparator, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.PageTitleSeparator, storeScope); if (model.SeoSettings.PageTitleSeoAdjustment_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.PageTitleSeoAdjustment, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.PageTitleSeoAdjustment, storeScope); if (model.SeoSettings.DefaultTitle_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.DefaultTitle, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.DefaultTitle, storeScope); if (model.SeoSettings.DefaultMetaKeywords_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.DefaultMetaKeywords, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.DefaultMetaKeywords, storeScope); if (model.SeoSettings.DefaultMetaDescription_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.DefaultMetaDescription, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.DefaultMetaDescription, storeScope); if (model.SeoSettings.ConvertNonWesternChars_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.ConvertNonWesternChars, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.ConvertNonWesternChars, storeScope); if (model.SeoSettings.CanonicalUrlsEnabled_OverrideForStore || storeScope == 0) _settingService.SaveSetting(seoSettings, x => x.CanonicalUrlsEnabled, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(seoSettings, x => x.CanonicalUrlsEnabled, storeScope); //now clear settings cache _settingService.ClearCache(); //security settings var securitySettings = _settingService.LoadSetting<SecuritySettings>(storeScope); var captchaSettings = _settingService.LoadSetting<CaptchaSettings>(storeScope); if (securitySettings.AdminAreaAllowedIpAddresses == null) securitySettings.AdminAreaAllowedIpAddresses = new List<string>(); securitySettings.AdminAreaAllowedIpAddresses.Clear(); if (!String.IsNullOrEmpty(model.SecuritySettings.AdminAreaAllowedIpAddresses)) foreach (string s in model.SecuritySettings.AdminAreaAllowedIpAddresses.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) if (!String.IsNullOrWhiteSpace(s)) securitySettings.AdminAreaAllowedIpAddresses.Add(s.Trim()); securitySettings.HideAdminMenuItemsBasedOnPermissions = model.SecuritySettings.HideAdminMenuItemsBasedOnPermissions; _settingService.SaveSetting(securitySettings); captchaSettings.Enabled = model.SecuritySettings.CaptchaEnabled; captchaSettings.ShowOnLoginPage = model.SecuritySettings.CaptchaShowOnLoginPage; captchaSettings.ShowOnRegistrationPage = model.SecuritySettings.CaptchaShowOnRegistrationPage; captchaSettings.ShowOnContactUsPage = model.SecuritySettings.CaptchaShowOnContactUsPage; captchaSettings.ShowOnEmailWishlistToFriendPage = model.SecuritySettings.CaptchaShowOnEmailWishlistToFriendPage; captchaSettings.ShowOnEmailProductToFriendPage = model.SecuritySettings.CaptchaShowOnEmailProductToFriendPage; captchaSettings.ShowOnBlogCommentPage = model.SecuritySettings.CaptchaShowOnBlogCommentPage; captchaSettings.ShowOnNewsCommentPage = model.SecuritySettings.CaptchaShowOnNewsCommentPage; captchaSettings.ShowOnProductReviewPage = model.SecuritySettings.CaptchaShowOnProductReviewPage; captchaSettings.ReCaptchaPublicKey = model.SecuritySettings.ReCaptchaPublicKey; captchaSettings.ReCaptchaPrivateKey = model.SecuritySettings.ReCaptchaPrivateKey; _settingService.SaveSetting(captchaSettings); if (captchaSettings.Enabled && (String.IsNullOrWhiteSpace(captchaSettings.ReCaptchaPublicKey) || String.IsNullOrWhiteSpace(captchaSettings.ReCaptchaPrivateKey))) { //captcha is enabled but the keys are not entered ErrorNotification("Captcha is enabled but the appropriate keys are not entered"); } //PDF settings var pdfSettings = _settingService.LoadSetting<PdfSettings>(storeScope); pdfSettings.Enabled = model.PdfSettings.Enabled; pdfSettings.LetterPageSizeEnabled = model.PdfSettings.LetterPageSizeEnabled; pdfSettings.LogoPictureId = model.PdfSettings.LogoPictureId; /* We do not clear cache after each setting update. * This behavior can increase performance because cached settings will not be cleared * and loaded from database after each update */ if (model.PdfSettings.Enabled_OverrideForStore || storeScope == 0) _settingService.SaveSetting(pdfSettings, x => x.Enabled, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(pdfSettings, x => x.Enabled, storeScope); if (model.PdfSettings.LetterPageSizeEnabled_OverrideForStore || storeScope == 0) _settingService.SaveSetting(pdfSettings, x => x.LetterPageSizeEnabled, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(pdfSettings, x => x.LetterPageSizeEnabled, storeScope); if (model.PdfSettings.LogoPictureId_OverrideForStore || storeScope == 0) _settingService.SaveSetting(pdfSettings, x => x.LogoPictureId, storeScope, false); else if (storeScope > 0) _settingService.DeleteSetting(pdfSettings, x => x.LogoPictureId, storeScope); //now clear settings cache _settingService.ClearCache(); //localization settings var localizationSettings = _settingService.LoadSetting<LocalizationSettings>(storeScope); localizationSettings.UseImagesForLanguageSelection = model.LocalizationSettings.UseImagesForLanguageSelection; if (localizationSettings.SeoFriendlyUrlsForLanguagesEnabled != model.LocalizationSettings.SeoFriendlyUrlsForLanguagesEnabled) { localizationSettings.SeoFriendlyUrlsForLanguagesEnabled = model.LocalizationSettings.SeoFriendlyUrlsForLanguagesEnabled; //clear cached values of routes System.Web.Routing.RouteTable.Routes.ClearSeoFriendlyUrlsCachedValueForRoutes(); } localizationSettings.LoadAllLocaleRecordsOnStartup = model.LocalizationSettings.LoadAllLocaleRecordsOnStartup; _settingService.SaveSetting(localizationSettings); //full-text var commonSettings = _settingService.LoadSetting<CommonSettings>(storeScope); commonSettings.FullTextMode = (FulltextSearchMode)model.FullTextSettings.SearchMode; _settingService.SaveSetting(commonSettings); //activity log _customerActivityService.InsertActivity("EditSettings", _localizationService.GetResource("ActivityLog.EditSettings")); if (mobileDevicesSupportedChanged) { //MobileDevicesSupported setting has been changed //restart application _webHelper.RestartAppDomain(); } SuccessNotification(_localizationService.GetResource("Admin.Configuration.Updated")); return RedirectToAction("GeneralCommon"); }