Fix incorrect function calls

- Fixed encrypter references
This commit is contained in:
objecttothis
2023-02-10 22:14:47 +04:00
committed by Steve Ireland
parent 9aec0b45ac
commit 271d146e73
4 changed files with 19 additions and 19 deletions

View File

@@ -20,6 +20,7 @@ use App\Models\Tax;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
use CodeIgniter\Files\File;
use Config\Services;
use DirectoryIterator;
use NumberFormatter;
use ReflectionException;
@@ -59,9 +60,6 @@ class Config extends Secure_Controller
$this->rounding_mode = model('Rounding_mode');
$this->stock_location = model('Stock_location');
$this->tax = model('Tax');
$this->encryption = new Encryption();
$this->encrypter = $this->encryption->initialize();
}
/*
@@ -278,8 +276,10 @@ class Config extends Secure_Controller
if($this->_check_encryption()) //TODO: Hungarian notation
{
$data['mailchimp']['api_key'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']);
$data['mailchimp']['list_id'] = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
$encrypter = Services::encrypter();
$data['mailchimp']['api_key'] = $encrypter->decrypt(config('OSPOS')->settings['mailchimp_api_key']);
$data['mailchimp']['list_id'] = $encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
}
else
{
@@ -984,4 +984,4 @@ class Config extends Secure_Controller
return TRUE;
}
}
}

View File

@@ -10,6 +10,7 @@ use App\Models\Tax_code;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
use Config\Services;
use stdClass;
/**
@@ -38,10 +39,9 @@ class Customers extends Persons
$this->customer = model('Customer');
$this->tax_code = model('Tax_code');
$this->encryption = new Encryption();
$this->encrypter = $this->encryption->initialize();
$encrypter = Services::encrypter();
$this->_list_id = $this->encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
$this->_list_id = $encrypter->decrypt(config('OSPOS')->settings['mailchimp_list_id']);
}
public function getIndex(): void
@@ -500,4 +500,4 @@ class Customers extends Persons
}
}
}
}
}

View File

@@ -5,6 +5,7 @@ namespace app\Libraries;
use CodeIgniter\Email\Email;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
use Config\Services;
/**
@@ -22,9 +23,7 @@ class Email_lib
public function __construct()
{
$this->email = new Email();
$this->encryption = new Encryption();
$this->encrypter = $this->encryption->initialize();
$encrypter = Services::encrypter();
$config = [
'mailtype' => 'html',
@@ -34,7 +33,7 @@ class Email_lib
'mailpath' => config('OSPOS')->settings['mailpath'],
'smtp_host' => config('OSPOS')->settings['smtp_host'],
'smtp_user' => config('OSPOS')->settings['smtp_user'],
'smtp_pass' => $this->encrypter->decrypt(config('OSPOS')->settings['smtp_pass']),
'smtp_pass' => $encrypter->decrypt(config('OSPOS')->settings['smtp_pass']),
'smtp_port' => config('OSPOS')->settings['smtp_port'],
'smtp_timeout' => config('OSPOS')->settings['smtp_timeout'],
'smtp_crypto' => config('OSPOS')->settings['smtp_crypto']
@@ -70,4 +69,4 @@ class Email_lib
return $result;
}
}
}

View File

@@ -4,6 +4,7 @@ namespace app\Libraries;
use CodeIgniter\Encryption\Encryption;
use CodeIgniter\Encryption\EncrypterInterface;
use Config\Services;
/**
@@ -20,8 +21,6 @@ class Sms_lib
{
public function __construct()
{
$this->encryption = new Encryption(); //TODO: Is this the correct way to load the encryption service now?
$this->encrypter = $this->encryption->initialize();
}
/*
@@ -30,8 +29,10 @@ class Sms_lib
*/
public function sendSMS(int $phone, string $message): bool
{
$encrypter = Services::encrypter();
$username = config('OSPOS')->settings['msg_uid'];
$password = $this->encrypter->decrypt(config('OSPOS')->settings['msg_pwd']);
$password = $encrypter->decrypt(config('OSPOS')->settings['msg_pwd']);
$originator = config('OSPOS')->settings['msg_src'];
$response = FALSE;
@@ -78,4 +79,4 @@ class Sms_lib
return $response;
}
}
}