public function __construct() { parent::__construct(); // Alias classes for easy access from routes and views class_alias('Unf\\HTTP\\Request', 'Request'); class_alias('Unf\\View', 'View'); // Connect to the database $dbConfig = $this->config['db'][$this->config['environment']]; $GLOBALS['db'] = new PDO($dbConfig['dsn'], $dbConfig['username'], $dbConfig['password']); unset($dbConfig); // Get common functions require __DIR__ . '/common.php'; // Are we in development? if ($this->config['environment'] == 'development') { require "{$this->configDir}/environment/development.php"; } }
public function __construct() { parent::__construct(); $_ENV['environment'] = $this->config['environment']; // Setup Whoops if we're in development if ($_ENV['environment'] == 'development') { $whoops = new \Whoops\Run(); $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler()); $whoops->register(); } // Make the request class a little easier to access. class_alias('Unf\\Request', 'Request'); // Setup database and templating $this->setupDatabaseConnection(); $this->setupViewEngine(); // Set current language // TODO: allow changing of this via the AdminCP and UserCP Language::register('EnglishAu', new EnglishAu()); Language::setCurrent('EnglishAu'); require __DIR__ . '/common.php'; $this->getCurrentUser(); }