diff --git a/app/Controllers/Config.php b/app/Controllers/Config.php index 13e8d407b..5fdaa99c5 100644 --- a/app/Controllers/Config.php +++ b/app/Controllers/Config.php @@ -283,8 +283,25 @@ class Config extends Secure_Controller { $encrypter = Services::encrypter(); - $data['mailchimp']['api_key'] = $encrypter->decrypt($this->config['mailchimp_api_key'] ?? ''); - $data['mailchimp']['list_id'] = $encrypter->decrypt($this->config['mailchimp_list_id'] ?? ''); + $mailchimp_api_key = $this->config['mailchimp_api_key']; + if(!empty($mailchimp_api_key)) + { + $data['mailchimp']['api_key'] = $encrypter->decrypt($mailchimp_api_key); + } + else + { + $data['mailchimp']['api_key'] = ''; + } + + $mailchimp_list_id = $this->config['mailchimp_list_id']; + if(!empty($mailchimp_list_id)) + { + $data['mailchimp']['list_id'] = $encrypter->decrypt($mailchimp_list_id); + } + else + { + $data['mailchimp']['list_id'] = ''; + } } else { diff --git a/app/Controllers/Customers.php b/app/Controllers/Customers.php index b23712897..c5ad9dc05 100644 --- a/app/Controllers/Customers.php +++ b/app/Controllers/Customers.php @@ -42,7 +42,16 @@ class Customers extends Persons $encrypter = Services::encrypter(); - $this->_list_id = $encrypter->decrypt($this->config['mailchimp_list_id']); + $mailchimp_list_id = $this->config['mailchimp_list_id']; + + if(!empty($mailchimp_list_id)) + { + $this->_list_id = $encrypter->decrypt($this->config['mailchimp_list_id']); + } + else + { + $this->_list_id = ""; + } } public function getIndex(): void diff --git a/app/Libraries/Email_lib.php b/app/Libraries/Email_lib.php index 2abece36b..5ef0f6d21 100644 --- a/app/Libraries/Email_lib.php +++ b/app/Libraries/Email_lib.php @@ -25,8 +25,14 @@ class Email_lib { $this->email = new Email(); $this->config = config('OSPOS')->settings; + $encrypter = Services::encrypter(); + $smtp_pass = $this->config['smtp_pass']; + if(!empty($smtp_pass)) + { + $smtp_pass = $encrypter->decrypt($smtp_pass); + } $email_config = [ 'mailtype' => 'html', @@ -36,7 +42,7 @@ class Email_lib 'mailpath' => $this->config['mailpath'], 'smtp_host' => $this->config['smtp_host'], 'smtp_user' => $this->config['smtp_user'], - 'smtp_pass' => $encrypter->decrypt($this->config['smtp_pass']), + 'smtp_pass' => $smtp_pass, 'smtp_port' => $this->config['smtp_port'], 'smtp_timeout' => $this->config['smtp_timeout'], 'smtp_crypto' => $this->config['smtp_crypto'] diff --git a/app/Libraries/Mailchimp_lib.php b/app/Libraries/Mailchimp_lib.php index a36efe0df..cfd3c666d 100644 --- a/app/Libraries/Mailchimp_lib.php +++ b/app/Libraries/Mailchimp_lib.php @@ -41,9 +41,14 @@ class MailchimpConnector $encrypter = Services::encrypter(); - $this->_api_key = empty($api_key) - ? $encrypter->decrypt($config['mailchimp_api_key']) //TODO: Hungarian notation - : $api_key; //TODO: Hungarian notation + $mailchimp_api_key = $config['mailchimp_api_key']; + + if(!empty($mailchimp_api_key)) + { + $this->_api_key = empty($api_key) + ? $encrypter->decrypt($mailchimp_api_key) //TODO: Hungarian notation + : $api_key; //TODO: Hungarian notation + } if(!empty($this->_api_key)) //TODO: Hungarian notation { diff --git a/app/Libraries/Sms_lib.php b/app/Libraries/Sms_lib.php index adfabc6ab..01503d3c8 100644 --- a/app/Libraries/Sms_lib.php +++ b/app/Libraries/Sms_lib.php @@ -26,10 +26,16 @@ class Sms_lib public function sendSMS(int $phone, string $message): bool { $config = config('OSPOS')->settings; + $encrypter = Services::encrypter(); + $password = $config['msg_pwd']; + if(!empty($password)) + { + $password = $encrypter->decrypt($password); + } + $username = $config['msg_uid']; - $password = $encrypter->decrypt($config['msg_pwd']); $originator = $config['msg_src']; $response = FALSE;