/// <summary> /// cmdUpdate_Click runs when the Update LinkButton is clicked. /// It saves the current Search Settings /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/9/2004 Modified /// </history> protected void cmdUpdate_Click(object sender, EventArgs e) { try { if (PortalSettings.ActiveTab.ParentId == PortalSettings.SuperTabId) { HostSettingsController objHostSettings = new HostSettingsController(); objHostSettings.UpdateHostSetting("MaxSearchWordLength", txtMaxWordLength.Text); objHostSettings.UpdateHostSetting("MinSearchWordLength", txtMinWordLength.Text); objHostSettings.UpdateHostSetting("SearchIncludeCommon", Convert.ToString(chkIncludeCommon.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("SearchIncludeNumeric", Convert.ToString(chkIncludeNumeric.Checked ? "Y" : "N")); // clear host settings cache DataCache.ClearHostCache(false); } else { ModuleController objModules = new ModuleController(); objModules.UpdateModuleSetting(ModuleId, "MaxSearchWordLength", txtMaxWordLength.Text); objModules.UpdateModuleSetting(ModuleId, "MinSearchWordLength", txtMinWordLength.Text); objModules.UpdateModuleSetting(ModuleId, "SearchIncludeCommon", Convert.ToString(chkIncludeCommon.Checked ? "Y" : "N")); objModules.UpdateModuleSetting(ModuleId, "SearchIncludeNumeric", Convert.ToString(chkIncludeNumeric.Checked ? "Y" : "N")); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
/// <summary> /// Save the Settings to Database /// </summary> private void SaveChanges() { ModuleController objModules = new ModuleController(); // Setting HashReuse Options objModules.UpdateTabModuleSetting(this.TabModuleId, "HashReuseMode", this.dDLHashReuse.SelectedValue); // Setting UseCustomizeUrl Options objModules.UpdateTabModuleSetting( this.TabModuleId, "UseCustomizeUrl", this.cBUseCustomizeUrl.Checked.ToString()); // Setting UseAnalyticsUrl Options objModules.UpdateTabModuleSetting( this.TabModuleId, "UseAnalyticsUrl", this.UseAnalyticsUrl.Checked.ToString()); // Setting AllowUserEdit Options objModules.UpdateTabModuleSetting( this.TabModuleId, "AllowUserEdit", this.cBAllowUserEdit.Checked.ToString()); // Setting UseErrorLog Options string sPortalKey = string.Format("URLSHORTY#{0}#", this.PortalSettings.PortalId); HostSettingsController hostSettingsCtrl = new HostSettingsController(); hostSettingsCtrl.UpdateHostSetting( string.Format("{0}UseErrorLog", sPortalKey), this.cBUseErrorLog.Checked.ToString()); }
private void FixAllowedExtensions() { bool blnHTML = true; string validExtensions = DotNetNuke.Entities.Host.Host.FileExtensions.ToLowerInvariant(); if (("," + validExtensions + ",").IndexOf(",html,") == -1) { blnHTML = false; } if (blnHTML == false) { validExtensions = (string)AddComma(validExtensions).ToString() + "html"; HostSettingsController ctl = new HostSettingsController(); ctl.UpdateHostSetting("FileExtensions", validExtensions); Config.Touch(); } }
/// <summary> /// cmdUpdate_Click runs when the Upgrade button is clicked /// </summary> /// <history> /// [cnurse] 9/27/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> protected void cmdUpdate_Click(object sender, EventArgs e) { try { HostSettingsController objHostSettings = new HostSettingsController(); objHostSettings.UpdateHostSetting("CheckUpgrade", Convert.ToString(chkUpgrade.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("HostPortalId", cboHostPortal.SelectedItem.Value); objHostSettings.UpdateHostSetting("HostTitle", txtHostTitle.Text); objHostSettings.UpdateHostSetting("HostURL", txtHostURL.Text); objHostSettings.UpdateHostSetting("HostEmail", txtHostEmail.Text); objHostSettings.UpdateHostSetting("PaymentProcessor", cboProcessor.SelectedItem.Text); objHostSettings.UpdateHostSetting("ProcessorUserId", txtUserId.Text, true); objHostSettings.UpdateHostSetting("ProcessorPassword", txtPassword.Text, true); objHostSettings.UpdateHostSetting("HostFee", txtHostFee.Text); objHostSettings.UpdateHostSetting("HostCurrency", cboHostCurrency.SelectedItem.Value); objHostSettings.UpdateHostSetting("HostSpace", txtHostSpace.Text); objHostSettings.UpdateHostSetting("PageQuota", txtPageQuota.Text); objHostSettings.UpdateHostSetting("UserQuota", txtUserQuota.Text); objHostSettings.UpdateHostSetting("SiteLogStorage", optSiteLogStorage.SelectedItem.Value); objHostSettings.UpdateHostSetting("SiteLogBuffer", txtSiteLogBuffer.Text); objHostSettings.UpdateHostSetting("SiteLogHistory", txtSiteLogHistory.Text); objHostSettings.UpdateHostSetting("DemoPeriod", txtDemoPeriod.Text); objHostSettings.UpdateHostSetting("DemoSignup", Convert.ToString(chkDemoSignup.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("Copyright", Convert.ToString(chkCopyright.Checked ? "Y" : "N")); bool OriginalUsersOnline; OriginalUsersOnline = Convert.ToBoolean(ViewState["SelectedUsersOnlineEnabled"]); if (OriginalUsersOnline != chkUsersOnline.Checked) { ScheduleItem objScheduleItem; objScheduleItem = SchedulingProvider.Instance().GetSchedule("DotNetNuke.Entities.Users.PurgeUsersOnline, DOTNETNUKE", Null.NullString); if (objScheduleItem != null) { if (!chkUsersOnline.Checked) { if (!objScheduleItem.Enabled) { objScheduleItem.Enabled = true; SchedulingProvider.Instance().UpdateSchedule(objScheduleItem); SchedulerMode mode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), cboSchedulerMode.SelectedItem.Value); if (mode == SchedulerMode.TIMER_METHOD) { SchedulingProvider.Instance().ReStart("Host Settings"); } } } else { if (objScheduleItem.Enabled) { objScheduleItem.Enabled = false; SchedulingProvider.Instance().UpdateSchedule(objScheduleItem); SchedulerMode mode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), cboSchedulerMode.SelectedItem.Value); if (mode == SchedulerMode.TIMER_METHOD) { SchedulingProvider.Instance().ReStart("Host Settings"); } } } } } objHostSettings.UpdateHostSetting("DisableUsersOnline", Convert.ToString(chkUsersOnline.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("AutoAccountUnlockDuration", txtAutoAccountUnlock.Text); objHostSettings.UpdateHostSetting("UsersOnlineTime", txtUsersOnlineTime.Text); objHostSettings.UpdateHostSetting("ProxyServer", txtProxyServer.Text); objHostSettings.UpdateHostSetting("ProxyPort", txtProxyPort.Text); objHostSettings.UpdateHostSetting("ProxyUsername", txtProxyUsername.Text, true); objHostSettings.UpdateHostSetting("ProxyPassword", txtProxyPassword.Text, true); objHostSettings.UpdateHostSetting("SMTPServer", txtSMTPServer.Text); objHostSettings.UpdateHostSetting("SMTPAuthentication", optSMTPAuthentication.SelectedItem.Value); objHostSettings.UpdateHostSetting("SMTPUsername", txtSMTPUsername.Text, true); objHostSettings.UpdateHostSetting("SMTPPassword", txtSMTPPassword.Text, true); objHostSettings.UpdateHostSetting("SMTPEnableSSL", Convert.ToString((chkSMTPEnableSSL.Checked ? "Y" : "N"))); objHostSettings.UpdateHostSetting("FileExtensions", txtFileExtensions.Text); objHostSettings.UpdateHostSetting("SkinUpload", optSkinUpload.SelectedItem.Value); objHostSettings.UpdateHostSetting("UseCustomErrorMessages", Convert.ToString(chkUseCustomErrorMessages.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("UseFriendlyUrls", Convert.ToString(chkUseFriendlyUrls.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("ControlPanel", cboControlPanel.SelectedItem.Value); objHostSettings.UpdateHostSetting("SchedulerMode", cboSchedulerMode.SelectedItem.Value); objHostSettings.UpdateHostSetting("PerformanceSetting", cboPerformance.SelectedItem.Value); objHostSettings.UpdateHostSetting("AuthenticatedCacheability", cboCacheability.SelectedItem.Value); objHostSettings.UpdateHostSetting("PageStatePersister", cboPageState.SelectedItem.Value); objHostSettings.UpdateHostSetting("ModuleCaching", cboCacheMethod.SelectedItem.Value); objHostSettings.UpdateHostSetting("HttpCompression", cboCompression.SelectedItem.Value); objHostSettings.UpdateHostSetting("HttpCompressionLevel", cboLevel.SelectedItem.Value); objHostSettings.UpdateHostSetting("WhitespaceFilter", Convert.ToString((chkWhitespace.Checked ? "Y" : "N"))); objHostSettings.UpdateHostSetting("EnableModuleOnLineHelp", Convert.ToString(chkEnableHelp.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("EnableFileAutoSync", Convert.ToString(chkAutoSync.Checked ? "Y" : "N")); objHostSettings.UpdateHostSetting("HelpURL", txtHelpURL.Text); bool originalLogBuffer = Convert.ToBoolean(ViewState["SelectedLogBufferEnabled"]); if (originalLogBuffer != chkLogBuffer.Checked) { ScheduleItem scheduleItem = SchedulingProvider.Instance().GetSchedule("DotNetNuke.Services.Log.EventLog.PurgeLogBuffer, DOTNETNUKE", Null.NullString); if (scheduleItem != null) { if (chkLogBuffer.Checked) { if (!scheduleItem.Enabled) { scheduleItem.Enabled = true; SchedulingProvider.Instance().UpdateSchedule(scheduleItem); SchedulerMode mode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), cboSchedulerMode.SelectedItem.Value); if (mode == SchedulerMode.TIMER_METHOD) { SchedulingProvider.Instance().ReStart("Host Settings"); } } } else { if (scheduleItem.Enabled) { scheduleItem.Enabled = false; SchedulingProvider.Instance().UpdateSchedule(scheduleItem); SchedulerMode mode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), cboSchedulerMode.SelectedItem.Value); if (mode == SchedulerMode.TIMER_METHOD) { SchedulingProvider.Instance().ReStart("Host Settings"); } } } } } objHostSettings.UpdateHostSetting("EventLogBuffer", Convert.ToString(chkLogBuffer.Checked ? "Y" : "N")); //SkinController objSkins = new SkinController(); //bool blnAdminSkinChanged = SkinChanged( SkinInfo.RootSkin, Null.NullInteger, SkinType.Admin, ctlAdminSkin.SkinSrc ) || SkinChanged( SkinInfo.RootContainer, Null.NullInteger, SkinType.Admin, ctlAdminContainer.SkinSrc ); SkinController.SetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Portal, ctlHostSkin.SkinSrc); SkinController.SetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Portal, ctlHostContainer.SkinSrc); SkinController.SetSkin(SkinInfo.RootSkin, Null.NullInteger, SkinType.Admin, ctlAdminSkin.SkinSrc); SkinController.SetSkin(SkinInfo.RootContainer, Null.NullInteger, SkinType.Admin, ctlAdminContainer.SkinSrc); // clear host settings cache DataCache.ClearHostCache(true); if (ViewState["SelectedSchedulerMode"] != null) { SchedulerMode originalSchedulerMode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), (string)ViewState["SelectedSchedulerMode"]); SchedulerMode smode = (SchedulerMode)Enum.Parse(typeof(SchedulerMode), cboSchedulerMode.SelectedItem.Value); if (smode == SchedulerMode.DISABLED) { if (originalSchedulerMode != SchedulerMode.DISABLED) { SchedulingProvider.Instance().Halt("Host Settings"); } } else if (smode == SchedulerMode.TIMER_METHOD) { if (originalSchedulerMode == SchedulerMode.DISABLED || originalSchedulerMode == SchedulerMode.REQUEST_METHOD) { Thread newThread = new Thread(new ThreadStart(SchedulingProvider.Instance().Start)); newThread.IsBackground = true; newThread.Start(); } } else if (smode != SchedulerMode.TIMER_METHOD) { if (originalSchedulerMode == SchedulerMode.TIMER_METHOD) { SchedulingProvider.Instance().Halt("Host Settings"); } } } // this is needed in order to fully flush the cache after changing FriendlyURL Response.Redirect(Request.RawUrl, true); // Redirect to this site to refresh only if admin skin changed //If blnAdminSkinChanged Then Response.Redirect(Request.RawUrl, True) } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
public static void ProcessLegacyLanguages() { string filePath = Common.Globals.ApplicationMapPath + Localization.Localization.SupportedLocalesFile.Substring(1).Replace("/", "\\"); if (File.Exists(filePath)) { XPathDocument doc = new XPathDocument(filePath); HostSettingsController controller = new HostSettingsController(); XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("root/browserDetection"); if (browserNav != null) { controller.UpdateHostSetting("EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true")); } XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("root/languageInUrl"); if (urlNav != null) { controller.UpdateHostSetting("EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true")); } foreach (XPathNavigator nav in doc.CreateNavigator().Select("root/language")) { if (nav.NodeType != XPathNodeType.Comment) { Locale language = new Locale(); language.Text = Util.ReadAttribute(nav, "name"); language.Code = Util.ReadAttribute(nav, "key"); language.Fallback = Util.ReadAttribute(nav, "fallback"); if (language.Code != Localization.Localization.SystemLocale) { PackageInfo package = new PackageInfo(new InstallerInfo()); package.Name = language.Text; package.FriendlyName = language.Text; package.Description = Null.NullString; package.Version = new Version(1, 0, 0); package.PackageType = "CoreLanguagePack"; package.License = Util.PACKAGE_NoLicense; LanguagePackWriter packageWriter = new LanguagePackWriter(language, package); package.Manifest = packageWriter.WriteManifest(true); PackageController.SavePackage(package); Localization.Localization.SaveLanguage(language); LanguagePackInfo languagePack = new LanguagePackInfo(); languagePack.LanguageID = language.LanguageID; languagePack.PackageID = package.PackageID; languagePack.DependentPackageID = -2; LanguagePackController.SaveLanguagePack(languagePack); } } } } foreach (PortalInfo portal in new PortalController().GetPortals()) { int portalID = portal.PortalID; filePath = string.Format(Common.Globals.ApplicationMapPath + Localization.Localization.ApplicationResourceDirectory.Substring(1).Replace("/", "\\") + "\\Locales.Portal-{0}.xml", portalID.ToString()); if (File.Exists(filePath)) { XPathDocument doc = new XPathDocument(filePath); XPathNavigator browserNav = doc.CreateNavigator().SelectSingleNode("locales/browserDetection"); if (browserNav != null) { PortalController.UpdatePortalSetting(portalID, "EnableBrowserLanguage", Util.ReadAttribute(browserNav, "enabled", false, null, Null.NullString, "true")); } XPathNavigator urlNav = doc.CreateNavigator().SelectSingleNode("locales/languageInUrl"); if (urlNav != null) { PortalController.UpdatePortalSetting(portalID, "EnableUrlLanguage", Util.ReadAttribute(urlNav, "enabled", false, null, Null.NullString, "true")); } foreach (Locale installedLanguage in Localization.Localization.GetLocales(Null.NullInteger).Values) { string code = installedLanguage.Code; bool bFound = false; foreach (XPathNavigator inactiveNav in doc.CreateNavigator().Select("locales/inactive/locale")) { if (inactiveNav.Value == code) { bFound = true; break; } } if (!bFound) { Localization.Localization.AddLanguageToPortal(portalID, installedLanguage.LanguageID, false); } } } else { foreach (Locale installedLanguage in Localization.Localization.GetLocales(Null.NullInteger).Values) { Localization.Localization.AddLanguageToPortal(portalID, installedLanguage.LanguageID, false); } } } }