From 2eed7b082f83630301e51f57ca8394de228a8605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 18 Aug 2019 21:14:58 -0500 Subject: first commit --- public/admin/controller/mail/affiliate.php | 114 +++++++++++++++++++++++++++ public/admin/controller/mail/customer.php | 114 +++++++++++++++++++++++++++ public/admin/controller/mail/forgotten.php | 26 ++++++ public/admin/controller/mail/return.php | 58 ++++++++++++++ public/admin/controller/mail/reward.php | 65 +++++++++++++++ public/admin/controller/mail/transaction.php | 64 +++++++++++++++ 6 files changed, 441 insertions(+) create mode 100644 public/admin/controller/mail/affiliate.php create mode 100644 public/admin/controller/mail/customer.php create mode 100644 public/admin/controller/mail/forgotten.php create mode 100644 public/admin/controller/mail/return.php create mode 100644 public/admin/controller/mail/reward.php create mode 100644 public/admin/controller/mail/transaction.php (limited to 'public/admin/controller/mail') diff --git a/public/admin/controller/mail/affiliate.php b/public/admin/controller/mail/affiliate.php new file mode 100644 index 0000000..3a01a51 --- /dev/null +++ b/public/admin/controller/mail/affiliate.php @@ -0,0 +1,114 @@ +load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($args[0]); + + if ($customer_info) { + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8'); + $store_url = $store_info['url'] . 'index.php?route=account/login'; + } else { + $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'); + $store_url = HTTP_CATALOG . 'index.php?route=account/login'; + } + + $this->load->model('localisation/language'); + + $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']); + + if ($language_info) { + $language_code = $language_info['code']; + } else { + $language_code = $this->config->get('config_language'); + } + + $language = new Language($language_code); + $language->load($language_code); + $language->load('mail/affiliate_approve'); + + $subject = sprintf($language->get('text_subject'), $store_name); + + $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name); + + $data['login'] = $store_url . 'index.php?route=account/login'; + $data['store'] = $store_name; + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender($store_name); + $mail->setSubject($subject); + $mail->setText($this->load->view('mail/affiliate_approve', $data)); + $mail->send(); + } + } + + public function deny(&$route, &$args, &$output) { + $this->load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($args[0]); + + if ($customer_info) { + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8'); + $store_url = $store_info['url'] . 'index.php?route=account/login'; + } else { + $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'); + $store_url = HTTP_CATALOG . 'index.php?route=account/login'; + } + + $this->load->model('localisation/language'); + + $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']); + + if ($language_info) { + $language_code = $language_info['code']; + } else { + $language_code = $this->config->get('config_language'); + } + + $language = new Language($language_code); + $language->load($language_code); + $language->load('mail/affiliate_deny'); + + $subject = sprintf($language->get('text_subject'), $store_name); + + $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name); + + $data['contact'] = $store_url . 'index.php?route=information/contact'; + $data['store'] = $store_name; + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender($store_name); + $mail->setSubject($subject); + $mail->setText($this->load->view('mail/affiliate_deny', $data)); + $mail->send(); + } + } +} \ No newline at end of file diff --git a/public/admin/controller/mail/customer.php b/public/admin/controller/mail/customer.php new file mode 100644 index 0000000..990d2d4 --- /dev/null +++ b/public/admin/controller/mail/customer.php @@ -0,0 +1,114 @@ +load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($args[0]); + + if ($customer_info) { + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8'); + $store_url = $store_info['url'] . 'index.php?route=account/login'; + } else { + $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'); + $store_url = HTTP_CATALOG . 'index.php?route=account/login'; + } + + $this->load->model('localisation/language'); + + $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']); + + if ($language_info) { + $language_code = $language_info['code']; + } else { + $language_code = $this->config->get('config_language'); + } + + $language = new Language($language_code); + $language->load($language_code); + $language->load('mail/customer_approve'); + + $subject = sprintf($language->get('text_subject'), $store_name); + + $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name); + + $data['login'] = $store_url . 'index.php?route=account/login'; + $data['store'] = $store_name; + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender($store_name); + $mail->setSubject($subject); + $mail->setText($this->load->view('mail/customer_approve', $data)); + $mail->send(); + } + } + + public function deny(&$route, &$args, &$output) { + $this->load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($args[0]); + + if ($customer_info) { + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = html_entity_decode($store_info['name'], ENT_QUOTES, 'UTF-8'); + $store_url = $store_info['url'] . 'index.php?route=account/login'; + } else { + $store_name = html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'); + $store_url = HTTP_CATALOG . 'index.php?route=account/login'; + } + + $this->load->model('localisation/language'); + + $language_info = $this->model_localisation_language->getLanguage($customer_info['language_id']); + + if ($language_info) { + $language_code = $language_info['code']; + } else { + $language_code = $this->config->get('config_language'); + } + + $language = new Language($language_code); + $language->load($language_code); + $language->load('mail/customer_deny'); + + $subject = sprintf($language->get('text_subject'), $store_name); + + $data['text_welcome'] = sprintf($language->get('text_welcome'), $store_name); + + $data['contact'] = $store_url . 'index.php?route=information/contact'; + $data['store'] = $store_name; + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender($store_name); + $mail->setSubject($subject); + $mail->setText($this->load->view('mail/customer_deny', $data)); + $mail->send(); + } + } +} \ No newline at end of file diff --git a/public/admin/controller/mail/forgotten.php b/public/admin/controller/mail/forgotten.php new file mode 100644 index 0000000..c4f6029 --- /dev/null +++ b/public/admin/controller/mail/forgotten.php @@ -0,0 +1,26 @@ +load->language('mail/forgotten'); + + $data['text_greeting'] = sprintf($this->language->get('text_greeting'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); + + $data['reset'] = str_replace('&', '&', $this->url->link('common/reset', 'code=' . $args[1], true)); + $data['ip'] = $this->request->server['REMOTE_ADDR']; + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($args[0]); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); + $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')), ENT_QUOTES, 'UTF-8')); + $mail->setText($this->load->view('mail/forgotten', $data)); + $mail->send(); + } +} diff --git a/public/admin/controller/mail/return.php b/public/admin/controller/mail/return.php new file mode 100644 index 0000000..a7d8ca4 --- /dev/null +++ b/public/admin/controller/mail/return.php @@ -0,0 +1,58 @@ +load->model('sale/return'); + + $return_info = $this->model_sale_return->getReturn($return_id); + + if ($return_info) { + $this->load->language('mail/return'); + + $data['return_id'] = $return_id; + $data['date_added'] = date($this->language->get('date_format_short'), strtotime($return_info['date_modified'])); + $data['return_status'] = $return_info['return_status']; + $data['comment'] = strip_tags(html_entity_decode($comment, ENT_QUOTES, 'UTF-8')); + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($return_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')); + $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'), $return_id)); + $mail->setText($this->load->view('mail/return', $data)); + $mail->send(); + } + } + } +} \ No newline at end of file diff --git a/public/admin/controller/mail/reward.php b/public/admin/controller/mail/reward.php new file mode 100644 index 0000000..8d72ad7 --- /dev/null +++ b/public/admin/controller/mail/reward.php @@ -0,0 +1,65 @@ +load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($customer_id); + + if ($customer_info) { + $this->load->language('mail/reward'); + + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = $store_info['name']; + } else { + $store_name = $this->config->get('config_name'); + } + + $data['text_received'] = sprintf($this->language->get('text_received'), $points); + $data['text_total'] = sprintf($this->language->get('text_total'), $this->model_customer_customer->getRewardTotal($customer_id)); + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->protocol = $this->config->get('config_mail_protocol'); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8')); + $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($store_name, ENT_QUOTES, 'UTF-8'))); + $mail->setText($this->load->view('mail/reward', $data)); + $mail->send(); + } + } +} diff --git a/public/admin/controller/mail/transaction.php b/public/admin/controller/mail/transaction.php new file mode 100644 index 0000000..5a3078a --- /dev/null +++ b/public/admin/controller/mail/transaction.php @@ -0,0 +1,64 @@ +load->model('customer/customer'); + + $customer_info = $this->model_customer_customer->getCustomer($customer_id); + + if ($customer_info) { + $this->load->language('mail/transaction'); + + $this->load->model('setting/store'); + + $store_info = $this->model_setting_store->getStore($customer_info['store_id']); + + if ($store_info) { + $store_name = $store_info['name']; + } else { + $store_name = $this->config->get('config_name'); + } + + $data['text_received'] = sprintf($this->language->get('text_received'), $this->currency->format($amount, $this->config->get('config_currency'))); + $data['text_total'] = sprintf($this->language->get('text_total'), $this->currency->format($this->model_customer_customer->getTransactionTotal($customer_id), $this->config->get('config_currency'))); + + $mail = new Mail($this->config->get('config_mail_engine')); + $mail->parameter = $this->config->get('config_mail_parameter'); + $mail->smtp_hostname = $this->config->get('config_mail_smtp_hostname'); + $mail->smtp_username = $this->config->get('config_mail_smtp_username'); + $mail->smtp_password = html_entity_decode($this->config->get('config_mail_smtp_password'), ENT_QUOTES, 'UTF-8'); + $mail->smtp_port = $this->config->get('config_mail_smtp_port'); + $mail->smtp_timeout = $this->config->get('config_mail_smtp_timeout'); + + $mail->setTo($customer_info['email']); + $mail->setFrom($this->config->get('config_email')); + $mail->setSender(html_entity_decode($store_name, ENT_QUOTES, 'UTF-8')); + $mail->setSubject(sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'))); + $mail->setText($this->load->view('mail/transaction', $data)); + $mail->send(); + } + } +} -- cgit v1.2.3