public static bool IsPluginExist(string PlugName, AdminPanelSettings apSettings) { if (apSettings.Plugins[PlugName] != null) { return(true); } return(false); }
protected void SubmitButton_Click(object sender, System.EventArgs e) { bool flag = false; try { AdminPanelSettings apSettings = new AdminPanelSettings().Load(); string licenseKeyFromForm = txtLicenseKey.Value ?? string.Empty; if (string.IsNullOrEmpty(licenseKeyFromForm)) { apSettings.LicenseKey = licenseKeyFromForm; flag = false; } else { try { Pop3.LicenseKey = licenseKeyFromForm.Substring(0, 39); Pop3 pop = new Pop3(); flag = true; } catch (Exception error) { Log.WriteException(error); _errorMessage = "License Key is invalid"; GetLicenseUrl.Visible = true; flag = false; } apSettings.LicenseKey = licenseKeyFromForm; } if (File.Exists(Path.Combine(AdminPanelUtils.GetWebMailDataFolder(), @"settings\settings.xml"))) { WebmailSettings settings = new WebmailSettings().CreateInstance(AdminPanelUtils.GetWebMailDataFolder()); settings.LicenseKey = licenseKeyFromForm; settings.SaveWebmailSettings(AdminPanelUtils.GetWebMailDataFolder()); } apSettings.Save(); _errorMessage = Constants.mailAdmSaveSuccess; if (flag == true) { Session["LicenseKey"] = txtLicenseKey.Value; Response.Redirect("install.aspx?mode=db", true); } else { _errorMessage = "Please specify valid license key."; } } catch (Exception error) { Log.WriteException(error); _errorMessage = Constants.mailAdmSaveUnsuccess; } }
public AdminPanelSettings CreateInstance() { if (_instance == null) { _instance = new AdminPanelSettings(); _instance.Load(); } return(_instance); }
public static bool IsSuperAdmin(HttpSessionState session, AdminPanelSettings apSettings) { object Admin = LoadState("Admin", session); if (Admin != null && Admin.ToString() == apSettings.User) { return(true); } return(false); }
protected void Page_Load(object sender, EventArgs e) { install _page = Page as install; _web_step = _page._web_step; _max_step = _page._max_step; if (Page.IsPostBack) { AdminPanelUtils.SaveState("AUTH", true, Page.Session); AdminPanelSettings apSettings = new AdminPanelSettings().Load(); AdminPanelUtils.SaveState("Admin", apSettings.User, Page.Session); Response.Redirect("default.aspx", true); } }
protected void Page_Load(object sender, EventArgs e) { apSettings = (Page as DefaultPage).Settings; _isServerExist = Plugin.IsPluginExist(AdminPanelConstants.PluginName.Server, apSettings); _isWebMailExist = Plugin.IsPluginExist(AdminPanelConstants.PluginName.WebMail, apSettings); UserName = apSettings.User; txtSecurityPassword.Attributes.Add("value", AdminPanelConstants.DummyPassword); txtSecurityPasswordConfirm.Attributes.Add("value", AdminPanelConstants.DummyPassword); txtHost.Value = apSettings.Host; txtPort.Value = apSettings.Port; if (!_isServerExist) { trHost.Visible = false; trPort.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { install _page = Page as install; _web_step = _page._web_step; _max_step = _page._max_step; AdminPanelSettings apSettings = new AdminPanelSettings().Load(); if (Session["LicenseKey"] != null) { txtLicenseKey.Value = Session["LicenseKey"].ToString(); } else { txtLicenseKey.Value = apSettings.LicenseKey; } _EmptyKey = Session["EmptyKey"]; }
protected void Page_Load(object sender, EventArgs e) { AdminPanelSettings apSettings = (Page as DefaultPage).Settings; _isServerExist = Plugin.IsPluginExist(AdminPanelConstants.PluginName.Server, (Page as DefaultPage).Settings); _isWebMailExist = Plugin.IsPluginExist(AdminPanelConstants.PluginName.WebMail, (Page as DefaultPage).Settings); ClientPrefix = ClientID; if (!apSettings.AdvancedOptions) { divDomainTabs.Visible = false; } if (Session["pluginID"] != null) { pluginID = Session["pluginID"].ToString(); } if (!string.IsNullOrEmpty(Request.QueryString["type"])) { _domainType = Request.QueryString["type"]; } if (Request.QueryString["mode"] != null) { switch (Request.QueryString["mode"]) { case "edit": _isUpdate = true; break; case "new": _isNew = true; break; default: _isNew = true; break; } } InitDomain(); }
public static Plugin GetPlugin(string plugin, string rootFolder, AdminPanelSettings apSettings) { Plugin result = null; try { result = apSettings.Plugins[plugin]; if (result != null) { if (!Directory.Exists(Path.Combine(rootFolder, "plugins/" + result.FolderName))) { result = null; } } } catch (Exception error) { Log.WriteException(error); throw; } return(result); }
protected void Enter_OnClick(object sender, EventArgs e) { AdminPanelSettings apSettings = (Page as DefaultPage).Settings; if ((apSettings.User != LoginID.Value) || (apSettings.Pass != PasswordID.Value)) { try { Subadmin adm = Subadmin.GetSubadmin(LoginID.Value); if (adm != null) { if (PasswordID.Value != adm.Password) { _errorMessage = "Wrong login and/or password. Authentication failed."; _errorClass = "wm_login_error"; return; } else { AdminPanelUtils.SaveState("AUTH", true, Page.Session); AdminPanelUtils.SaveState("Admin", LoginID.Value, Page.Session); AdminPanelUtils.SaveState("AdminID", adm.ID, Page.Session); Response.Redirect("default.aspx", false); } } } catch { } _errorMessage = "Wrong login and/or password. Authentication failed."; _errorClass = "wm_login_error"; } else { AdminPanelUtils.SaveState("AUTH", true, Page.Session); AdminPanelUtils.SaveState("Admin", LoginID.Value, Page.Session); Response.Redirect("default.aspx", false); } }
public void Save(string dataFolder) { try { string filename = Path.Combine(dataFolder, @"adminpanel.xml"); XmlDocument result = new XmlDocument(); result.PreserveWhitespace = false; XmlDeclaration xmlDecl = result.CreateXmlDeclaration("1.0", "utf-8", ""); result.AppendChild(xmlDecl); XmlElement settingsElem = result.CreateElement("settings"); result.AppendChild(settingsElem); XmlElement subElemPlugins = result.CreateElement("plugins"); settingsElem.AppendChild(subElemPlugins); XmlElement subElemLogin = result.CreateElement("login"); settingsElem.AppendChild(subElemLogin); XmlElement subElem = result.CreateElement("user"); subElem.AppendChild(result.CreateTextNode(User)); subElemLogin.AppendChild(subElem); subElem = result.CreateElement("password"); subElem.AppendChild(result.CreateTextNode(Pass)); subElemLogin.AppendChild(subElem); subElem = result.CreateElement("host"); subElem.AppendChild(result.CreateTextNode(Host)); subElemLogin.AppendChild(subElem); subElem = result.CreateElement("port"); subElem.AppendChild(result.CreateTextNode(Port)); subElemLogin.AppendChild(subElem); foreach (Plugin pl in Plugins) { subElem = result.CreateElement("plugin"); subElem.SetAttribute("caption", pl.Caption); subElem.SetAttribute("folderName", pl.FolderName); if (!string.IsNullOrEmpty(pl.Target)) { subElem.SetAttribute("target", pl.Target); } subElemPlugins.AppendChild(subElem); } XmlElement subElemLicenseKey = result.CreateElement("licensekey"); subElemLicenseKey.AppendChild(result.CreateTextNode(LicenseKey)); settingsElem.AppendChild(subElemLicenseKey); XmlElement subElemAdvancedOptions = result.CreateElement("advancedoptions"); subElemAdvancedOptions.AppendChild(result.CreateTextNode(AdvancedOptions ? "1" : "0")); settingsElem.AppendChild(subElemAdvancedOptions); result.Save(filename); _instance = null; } catch (Exception error) { Log.WriteException(error); } }
public static XMailAdminProxy.XMLayer CreateXMLayer() { AdminPanelSettings apSettings = new AdminPanelSettings().Load(); return(CreateXMLayer(apSettings.User, apSettings.Pass, apSettings.Host, apSettings.Port)); }
public static PluginCollection GetPlugins(string rootFolder, HttpSessionState session, AdminPanelSettings apSettings) { PluginCollection result = new PluginCollection(); try { foreach (Plugin pl in apSettings.Plugins) { if (Directory.Exists(Path.Combine(rootFolder, @"plugins\" + pl.FolderName))) { result.Add(pl); } } } catch (Exception error) { Log.WriteException(error); throw; } return(result); }
public DefaultPage() { _settings = new AdminPanelSettings().Load(); }