/** * Construct a new database object. * @param $settings */ public function __construct($settings) { $this->database = DatabaseManager::connect($settings["host"], $settings["port"], $settings["user"], $settings["pass"], $settings["name"], isset($settings["utf8"]) ? $settings["utf8"] : true); // Debug global $settings; R::debug($settings["development"]); }
/** * Constructor function to initiate the object of this class. * @param Array $config */ public function __construct($config) { $this->dbConfig = $config; //store the config file. //Make a connection to the DB. DB Credentials are provided inside the configuration file. DatabaseManager::connect(new DatabaseConfig($config['ADAPTER'], $config['DBNAME'], $config['USERNAME'], $config['PASSWORD'])); //create a new Db handler. }
<?php namespace phpsec; /** * Required Files */ require_once __DIR__ . "/../../libs/db/dbmanager.php"; try { $config = (include __DIR__ . "/../../libs/config.php"); $dbname = $config['DBNAME']; $username = $config['DBUSER']; $password = $config['DBPASS']; DatabaseManager::connect(new DatabaseConfig('pdo_mysql', $dbname, $username, $password, "127.0.0.1")); //create a new Db handler. } catch (\Exception $e) { echo $e->getMessage(); }
function sanitize_output($buffer) { $search = array('/\\>[^\\S ]+/s', '/[^\\S ]+\\</s', '/(\\s)+/s'); $replace = array('>', '<', '\\1'); $buffer = preg_replace($search, $replace, $buffer); return $buffer; } /** $Init the initiator class */ $Init = new Initiator(); /** Starts the init itself */ $Init::startInit(); /** $FOGFTP the FOGFTP class */ $FOGFTP = new FOGFTP(); /** $FOGCore the FOGCore class */ $FOGCore = new FOGCore(); /** $DatabaseManager the DatabaseManager class */ $DatabaseManager = new DatabaseManager(); /** $DB set's the DB class from the DatabaseManager */ $DB = $FOGCore->DB = $DatabaseManager->connect()->DB; /** Loads any Session variables */ $FOGCore->setSessionEnv(); /** $TimeZone the timezone setter */ $TimeZone = $FOGCore->TimeZone = $_SESSION['TimeZone']; /** $EventManager initiates the EventManager class */ $FOGCore->EventManager = $EventManager = $FOGCore->getClass('EventManager'); /** $HookManager initiates the HookManager class */ $FOGCore->HookManager = $HookManager = $FOGCore->getClass('HookManager'); $HookManager->load(); $EventManager->load(); /** $HookManager initiates the FOGURLRequest class */ $FOGCore->FOGURLRequests = $FOGURLRequests = $FOGCore->getClass('FOGURLRequests');