From 0ea8c6fb72d4ad07b26fb1e76a7c7e466c68071c Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Fri, 8 Jun 2018 15:16:16 +0000 Subject: [PATCH] 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. --- source/dbtools/Application.php | 9 +++++---- source/defs/Emailer/PHPMail.php | 9 +++++---- source/defs/RenderEngine/Render.php | 3 ++- source/defs/Virtualmin/Virtualmin.php | 7 ++++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/source/dbtools/Application.php b/source/dbtools/Application.php index 226a9c6..4ecb7d4 100644 --- a/source/dbtools/Application.php +++ b/source/dbtools/Application.php @@ -9,11 +9,12 @@ class Application public function __construct() { $config = new Config(); + $cConfigArray = $config->getConfig(); - $this->database['username'] = $config['core']['database']['username']; - $this->database['password'] = $config['core']['database']['password']; - $this->database['hostname'] = $config['core']['database']['hostname']; - $this->database['dbname'] = $config['core']['database']['dbname']; + $this->database['username'] = $cConfigArray['core']['database']['username']; + $this->database['password'] = $cConfigArray['core']['database']['password']; + $this->database['hostname'] = $cConfigArray['core']['database']['hostname']; + $this->database['dbname'] = $cConfigArray['core']['database']['dbname']; $this->db = instDB(); diff --git a/source/defs/Emailer/PHPMail.php b/source/defs/Emailer/PHPMail.php index 2ed1a74..2e78202 100644 --- a/source/defs/Emailer/PHPMail.php +++ b/source/defs/Emailer/PHPMail.php @@ -48,11 +48,12 @@ class Emailer private function prepareMailerEnvelope() { $config = new Config(); + $cConfigArray = $config->getConfig(); - $username = $Config['mailer']['username']; - $password = $Config['mailer']['password']; - $hostname = $Config['mailer']['hostname']; - $port = $Config['mailer']['port']; + $username = $cConfigArray['mailer']['username']; + $password = $cConfigArray['mailer']['password']; + $hostname = $cConfigArray['mailer']['hostname']; + $port = $cConfigArray['mailer']['port']; $connStr = 'tls://' . $username . ":" . $password . "@" . $hostname . ":" . $port; diff --git a/source/defs/RenderEngine/Render.php b/source/defs/RenderEngine/Render.php index 13bea3b..8abce33 100644 --- a/source/defs/RenderEngine/Render.php +++ b/source/defs/RenderEngine/Render.php @@ -22,8 +22,9 @@ class EmailRenderer public function __construct() { $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); } diff --git a/source/defs/Virtualmin/Virtualmin.php b/source/defs/Virtualmin/Virtualmin.php index d27f270..50d7284 100644 --- a/source/defs/Virtualmin/Virtualmin.php +++ b/source/defs/Virtualmin/Virtualmin.php @@ -11,10 +11,11 @@ class VirtualminHandler public function __construct() { $Config = new Config(); + $cConfigArray = $Config->getConfig(); - $url = $Config['vmin-url']; - $username = $Config['username']; - $password = $Config['password']; + $url = $cConfigArray['vmin-url']; + $username = $cConfigArray['username']; + $password = $cConfigArray['password']; $this->virtualmin = new Virtualmin\VirtualServersClient($url, $username, $password); }