diff options
Diffstat (limited to 'public/admin/controller/mail')
-rw-r--r-- | public/admin/controller/mail/affiliate.php | 114 | ||||
-rw-r--r-- | public/admin/controller/mail/customer.php | 114 | ||||
-rw-r--r-- | public/admin/controller/mail/forgotten.php | 26 | ||||
-rw-r--r-- | public/admin/controller/mail/return.php | 58 | ||||
-rw-r--r-- | public/admin/controller/mail/reward.php | 65 | ||||
-rw-r--r-- | public/admin/controller/mail/transaction.php | 64 |
6 files changed, 441 insertions, 0 deletions
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 @@ +<?php +class ControllerMailAffiliate extends Controller { + public function approve(&$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_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 @@ +<?php +class ControllerMailCustomer extends Controller { + public function approve(&$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_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 @@ +<?php +class ControllerMailForgotten extends Controller { + public function index(&$route, &$args, &$output) { + $this->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 @@ +<?php +class ControllerMailReturn extends Controller { + public function index($route, $args, $output) { + if (isset($args[0])) { + $return_id = $args[0]; + } else { + $return_id = ''; + } + + if (isset($args[1])) { + $return_status_id = $args[1]; + } else { + $return_status_id = ''; + } + + if (isset($args[2])) { + $comment = $args[2]; + } else { + $comment = ''; + } + + if (isset($args[3])) { + $notify = $args[3]; + } else { + $notify = ''; + } + + if ($notify) { + $this->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 @@ +<?php +class ControllerMailReward extends Controller { + public function index($route, $args, $output) { + if (isset($args[0])) { + $customer_id = $args[0]; + } else { + $customer_id = ''; + } + + if (isset($args[1])) { + $description = $args[1]; + } else { + $description = ''; + } + + if (isset($args[2])) { + $points = $args[2]; + } else { + $points = ''; + } + + if (isset($args[3])) { + $order_id = $args[3]; + } else { + $order_id = 0; + } + + $this->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 @@ +<?php +class ControllerMailTransaction extends Controller { + public function index($route, $args, $output) { + if (isset($args[0])) { + $customer_id = $args[0]; + } else { + $customer_id = ''; + } + + if (isset($args[1])) { + $description = $args[1]; + } else { + $description = ''; + } + + if (isset($args[2])) { + $amount = $args[2]; + } else { + $amount = ''; + } + + if (isset($args[3])) { + $order_id = $args[3]; + } else { + $order_id = ''; + } + + $this->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(); + } + } +} |