fixed get_instance()
This commit is contained in:
+8
-13
@@ -10,10 +10,10 @@ class Down extends BaseCommand
|
||||
protected $group = 'Housekeeping';
|
||||
protected $name = 'down';
|
||||
protected $description = 'Put the application into maintenance mode.';
|
||||
protected $usage = 'down [options]';
|
||||
protected $usage = 'down [--allow IP] [--message "text"]';
|
||||
protected $options = [
|
||||
'--allow' => 'IP address(es) to whitelist (comma-separated or use multiple --allow)',
|
||||
'--message' => 'Custom message for the maintenance page',
|
||||
'allow' => 'IP address(es) to whitelist (comma-separated)',
|
||||
'message' => 'Custom message for the maintenance page',
|
||||
];
|
||||
|
||||
public function run(array $params)
|
||||
@@ -21,19 +21,14 @@ class Down extends BaseCommand
|
||||
$allowedIps = [];
|
||||
|
||||
// Get allowed IPs from command line
|
||||
if (CLI::getOption('allow')) {
|
||||
$allow = CLI::getOption('allow');
|
||||
if (is_array($allow)) {
|
||||
foreach ($allow as $ip) {
|
||||
$allowedIps = array_merge($allowedIps, array_map('trim', explode(',', $ip)));
|
||||
}
|
||||
} else {
|
||||
$allowedIps = array_map('trim', explode(',', $allow));
|
||||
}
|
||||
$allow = CLI::getOption('allow');
|
||||
if ($allow !== null && $allow !== false) {
|
||||
$allowedIps = array_map('trim', explode(',', (string) $allow));
|
||||
}
|
||||
|
||||
// Get custom message
|
||||
$message = CLI::getOption('message') ?: '';
|
||||
$message = CLI::getOption('message');
|
||||
$message = ($message !== null && $message !== false) ? (string) $message : '';
|
||||
|
||||
// Create maintenance data
|
||||
$data = [
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
class RequestPassword {
|
||||
|
||||
private $ci;
|
||||
private $salt;
|
||||
private $user;
|
||||
private $password;
|
||||
@@ -18,12 +17,8 @@ class RequestPassword {
|
||||
|
||||
public function __construct( $user )
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->user = $user;
|
||||
|
||||
$this->ci->load->library( 'email' );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
@@ -87,18 +82,21 @@ class RequestPassword {
|
||||
'password' => $this->password
|
||||
];
|
||||
|
||||
$html = $this->ci->load->view( 'emails/requestpassword_email', ['user'=>$data], true );
|
||||
$html = view('emails/requestpassword_email', ['user' => $data]);
|
||||
|
||||
$this->ci->email->from( 'noreply@dbois.nl', 'DBOIS' );
|
||||
$this->ci->email->to( $this->user->email );
|
||||
$this->ci->email->subject( 'Nieuw wachtwoord DBOIS' );
|
||||
$this->ci->email->message( $html );
|
||||
$this->ci->email->set_mailtype("html");
|
||||
$this->ci->email->set_newline("\r\n");
|
||||
$email = \Config\Services::email();
|
||||
$email->setFrom('noreply@dbois.nl', 'DBOIS');
|
||||
$email->setTo($this->user->email);
|
||||
$email->setSubject('Nieuw wachtwoord DBOIS');
|
||||
$email->setMessage($html);
|
||||
$email->setMailType('html');
|
||||
$email->setNewline("\r\n");
|
||||
|
||||
$this->sendResult = $this->ci->email->send();
|
||||
$this->sendResult = $email->send();
|
||||
|
||||
if( ! $this->sendResult ) log_message( 'error', json_encode($this->ci->email->print_debugger()));
|
||||
if (! $this->sendResult) {
|
||||
log_message('error', $email->printDebugger());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,15 +17,12 @@ class InvoiceSpreadsheet {
|
||||
private $invoiceSheet;
|
||||
private $fullpathname;
|
||||
private $filename;
|
||||
private $ci;
|
||||
|
||||
public function __construct( $invoiceReport )
|
||||
{
|
||||
$this->ci =& get_instance();
|
||||
|
||||
$this->invoiceReport = $invoiceReport;
|
||||
|
||||
$this->ci->load->helper( 'download' );
|
||||
helper('download');
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user