Remove grunt045 from zipped opensourcepos file. Also fix the call to array_walker since the parameters (even if not used) are validated in PHP 8.

This commit is contained in:
Steve Ireland
2023-03-01 08:10:14 -05:00
committed by jekkos
parent 8d80f5a261
commit 13a14ec310
9 changed files with 57 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ module.exports = function(grunt) {
'vendor/**',
'app/**',
'!/tests',
'!/grunt045',
'!grunt045**',
'!/public/images/menubar/png/',
'!/public/dist/bootswatch/',
'/public/dist/bootswatch/*/*.css',

View File

@@ -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
{

View File

@@ -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

View File

@@ -15,9 +15,10 @@ class Home extends Secure_Controller
echo view('home/home');
}
public function getLogout(): void
public function getLogout(): \CodeIgniter\HTTP\RedirectResponse
{
$this->employee->logout();
return redirect()->to('login');
}
/**

View File

@@ -593,14 +593,14 @@ function valid_decimal(string $decimal): bool //TODO: need a better name for $de
function encode_array(array $data): array
{
array_walk($data, function(&$value, &$key) { $value = rawurlencode($value);});
array_walk($data, function(&$value, $key) { $value = rawurlencode($value);});
return $data;
}
function decode_array(array $data): array
{
array_walk($data, function(&$value, &$key) { $value = rawurldecode($value);});
array_walk($data, function(&$value, $key) { $value = rawurldecode($value);});
return $data;
}

View File

@@ -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']

View File

@@ -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
{

View File

@@ -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;

View File

@@ -408,11 +408,9 @@ class Employee extends Person
/**
* Logs out a user by destroying all session data and redirect to log in
*/
public function logout(): RedirectResponse
public function logout()
{
session()->destroy();
return redirect()->to('login');
}
/**