Changes how different classes use the Config class.

They were trying to use it as an array instead of using it's helper method that actually returned a usable array.
Fixes #4.
This commit is contained in:
Miguel Nogueira 2018-06-08 15:16:16 +00:00
parent 536b9ac0c3
commit 0ea8c6fb72
4 changed files with 16 additions and 12 deletions

View File

@ -9,11 +9,12 @@ class Application
public function __construct() public function __construct()
{ {
$config = new Config(); $config = new Config();
$cConfigArray = $config->getConfig();
$this->database['username'] = $config['core']['database']['username']; $this->database['username'] = $cConfigArray['core']['database']['username'];
$this->database['password'] = $config['core']['database']['password']; $this->database['password'] = $cConfigArray['core']['database']['password'];
$this->database['hostname'] = $config['core']['database']['hostname']; $this->database['hostname'] = $cConfigArray['core']['database']['hostname'];
$this->database['dbname'] = $config['core']['database']['dbname']; $this->database['dbname'] = $cConfigArray['core']['database']['dbname'];
$this->db = instDB(); $this->db = instDB();

View File

@ -48,11 +48,12 @@ class Emailer
private function prepareMailerEnvelope() private function prepareMailerEnvelope()
{ {
$config = new Config(); $config = new Config();
$cConfigArray = $config->getConfig();
$username = $Config['mailer']['username']; $username = $cConfigArray['mailer']['username'];
$password = $Config['mailer']['password']; $password = $cConfigArray['mailer']['password'];
$hostname = $Config['mailer']['hostname']; $hostname = $cConfigArray['mailer']['hostname'];
$port = $Config['mailer']['port']; $port = $cConfigArray['mailer']['port'];
$connStr = 'tls://' . $username . ":" . $password . "@" . $hostname . ":" . $port; $connStr = 'tls://' . $username . ":" . $password . "@" . $hostname . ":" . $port;

View File

@ -22,8 +22,9 @@ class EmailRenderer
public function __construct() public function __construct()
{ {
$config = new Config(); $config = new Config();
$cConfigArray = $config->getConfig();
$loader = new Twig_Loader_Filesystem($config['templates']['templatesDirectory']); $loader = new Twig_Loader_Filesystem($cConfigArray['templates']['templatesDirectory']);
$this->twig = new Twig_Environment($loader); $this->twig = new Twig_Environment($loader);
} }

View File

@ -11,10 +11,11 @@ class VirtualminHandler
public function __construct() public function __construct()
{ {
$Config = new Config(); $Config = new Config();
$cConfigArray = $Config->getConfig();
$url = $Config['vmin-url']; $url = $cConfigArray['vmin-url'];
$username = $Config['username']; $username = $cConfigArray['username'];
$password = $Config['password']; $password = $cConfigArray['password'];
$this->virtualmin = new Virtualmin\VirtualServersClient($url, $username, $password); $this->virtualmin = new Virtualmin\VirtualServersClient($url, $username, $password);
} }