public function getConnector() { if (!empty($this->connector)) { return $this->connector; } if ($this->useDefaultAdapter) { $this->connector = WSAL_Connector_ConnectorFactory::GetDefaultConnector(); } else { $this->connector = WSAL_Connector_ConnectorFactory::GetConnector(); } return $this->connector; }
protected function Save() { check_admin_referer('wsal-settings'); $this->_plugin->settings->SetPruningDateEnabled($_REQUEST['PruneBy'] == 'date'); $this->_plugin->settings->SetPruningDate($_REQUEST['PruningDate']); $this->_plugin->settings->SetPruningLimitEnabled($_REQUEST['PruneBy'] == 'limit'); $this->_plugin->settings->SetPruningLimit($_REQUEST['PruningLimit']); $this->_plugin->settings->SetWidgetsEnabled($_REQUEST['EnableDashboardWidgets']); $this->_plugin->settings->SetAllowedPluginViewers(isset($_REQUEST['Viewers']) ? $_REQUEST['Viewers'] : array()); $this->_plugin->settings->SetAllowedPluginEditors(isset($_REQUEST['Editors']) ? $_REQUEST['Editors'] : array()); $this->_plugin->settings->SetExcludedMonitoringUsers(isset($_REQUEST['ExUsers']) ? $_REQUEST['ExUsers'] : array()); $this->_plugin->settings->SetExcludedMonitoringRoles(isset($_REQUEST['ExRoles']) ? $_REQUEST['ExRoles'] : array()); $this->_plugin->settings->SetExcludedMonitoringCustom(isset($_REQUEST['Customs']) ? $_REQUEST['Customs'] : array()); $this->_plugin->settings->SetExcludedMonitoringIP(isset($_REQUEST['IpAddrs']) ? $_REQUEST['IpAddrs'] : array()); $this->_plugin->settings->SetRestrictAdmins(isset($_REQUEST['RestrictAdmins'])); $this->_plugin->settings->SetRefreshAlertsEnabled($_REQUEST['EnableAuditViewRefresh']); $this->_plugin->settings->SetMainIPFromProxy(isset($_REQUEST['EnableProxyIpCapture'])); $this->_plugin->settings->SetInternalIPsFiltering(isset($_REQUEST['EnableIpFiltering'])); $this->_plugin->settings->SetIncognito(isset($_REQUEST['Incognito'])); $this->_plugin->settings->SetDeleteData(isset($_REQUEST['DeleteData'])); $this->_plugin->settings->SetDatetimeFormat($_REQUEST['DatetimeFormat']); $this->_plugin->settings->SetWPBackend(isset($_REQUEST['WPBackend'])); if (!empty($_REQUEST['Columns'])) { $this->_plugin->settings->SetColumns($_REQUEST['Columns']); } $this->_plugin->settings->ClearDevOptions(); if (isset($_REQUEST['DevOptions'])) { foreach ($_REQUEST['DevOptions'] as $opt) { $this->_plugin->settings->SetDevOptionEnabled($opt, true); } } // // Database Adapter Settings // Temporarily not used // /* Check Adapter config */ if (!empty($_REQUEST["AdapterUser"]) && $_REQUEST['AdapterUser'] != '' && $_REQUEST['AdapterName'] != '' && $_REQUEST['AdapterHostname'] != '') { WSAL_Connector_ConnectorFactory::CheckConfig(trim($_REQUEST['AdapterType']), trim($_REQUEST['AdapterUser']), trim($_REQUEST['AdapterPassword']), trim($_REQUEST['AdapterName']), trim($_REQUEST['AdapterHostname']), trim($_REQUEST['AdapterBasePrefix'])); /* Setting Adapter config */ $this->_plugin->settings->SetAdapterConfig('adapter-type', $_REQUEST['AdapterType']); $this->_plugin->settings->SetAdapterConfig('adapter-user', $_REQUEST['AdapterUser']); $this->_plugin->settings->SetAdapterConfig('adapter-password', $_REQUEST['AdapterPassword']); $this->_plugin->settings->SetAdapterConfig('adapter-name', $_REQUEST['AdapterName']); $this->_plugin->settings->SetAdapterConfig('adapter-hostname', $_REQUEST['AdapterHostname']); $this->_plugin->settings->SetAdapterConfig('adapter-base-prefix', $_REQUEST['AdapterBasePrefix']); } }
/** * Returns a connector singleton * @return WSAL_Connector_ConnectorInterface */ public static function GetConnector($config = null) { if (!empty($config)) { $connectionConfig = $config; } else { $connectionConfig = self::GetConfig(); } //TO DO: Load connection config if (self::$connector == null || !empty($config)) { switch (strtolower($connectionConfig['type'])) { //TO DO: Add other connectors case 'mysql': default: //use config self::$connector = new WSAL_Connector_MySQLDB($connectionConfig); } } return self::$connector; }
public static function getConnector($config = null) { require_once 'classes/Connector/ConnectorFactory.php'; return WSAL_Connector_ConnectorFactory::getConnector($config); }