return.php (2012B)
1 <?php 2 class ControllerMailReturn extends Controller { 3 public function index($route, $args, $output) { 4 if (isset($args[0])) { 5 $return_id = $args[0]; 6 } else { 7 $return_id = ''; 8 } 9 10 if (isset($args[1])) { 11 $return_status_id = $args[1]; 12 } else { 13 $return_status_id = ''; 14 } 15 16 if (isset($args[2])) { 17 $comment = $args[2]; 18 } else { 19 $comment = ''; 20 } 21 22 if (isset($args[3])) { 23 $notify = $args[3]; 24 } else { 25 $notify = ''; 26 } 27 28 if ($notify) { 29 $this->load->model('sale/return'); 30 31 $return_info = $this->model_sale_return->getReturn($return_id); 32 33 if ($return_info) { 34 $this->load->language('mail/return'); 35 36 $data['return_id'] = $return_id; 37 $data['date_added'] = date($this->language->get('date_format_short'), strtotime($return_info['date_modified'])); 38 $data['return_status'] = $return_info['return_status']; 39 $data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8')); 40 41 $mail = new Mail($this->config->get('config_mail_engine')); 42 $mail->parameter = $this->config->get('config_mail_parameter'); 43 $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); 44 $mail->smtp_username = $this->config->get('config_mail_smtp_username'); 45 $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); 46 $mail->smtp_port = $this->config->get('config_mail_smtp_port'); 47 $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); 48 49 $mail->setTo($return_info['email']); 50 $mail->setFrom($this->config->get('config_email')); 51 $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); 52 $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $return_id)); 53 $mail->setText($this->load->view('mail/return', $data)); 54 $mail->send(); 55 } 56 } 57 } 58 }