Example #1
0
 public function addCustomer($data)
 {
     if (isset($data['customer_group_id']) && is_array($this->config->get('config_customer_group_display')) && in_array($data['customer_group_id'], $this->config->get('config_customer_group_display'))) {
         $customer_group_id = $data['customer_group_id'];
     } else {
         $customer_group_id = $this->config->get('config_customer_group_id');
     }
     $this->load->model('account/customer_group');
     $customer_group_info = $this->model_account_customer_group->getCustomerGroup($customer_group_id);
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', newsletter = '" . (isset($data['newsletter']) ? (int) $data['newsletter'] : 0) . "', customer_group_id = '" . (int) $customer_group_id . "', ip = '" . $this->db->escape($this->request->server['REMOTE_ADDR']) . "', status = '1', approved = '" . (int) (!$customer_group_info['approval']) . "', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "'");
     $address_id = $this->db->getLastId();
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
     $this->load->language('mail/customer');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     if (!$customer_group_info['approval']) {
         $message .= $this->language->get('text_login') . "\n";
     } else {
         $message .= $this->language->get('text_approval') . "\n";
     }
     $message .= $this->url->link('account/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail($this->config->get('config_mail'));
     $mail->setTo($data['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_account_mail')) {
         $message = $this->language->get('text_signup') . "\n\n";
         $message .= $this->language->get('text_website') . ' ' . $this->config->get('config_name') . "\n";
         $message .= $this->language->get('text_firstname') . ' ' . $data['firstname'] . "\n";
         $message .= $this->language->get('text_lastname') . ' ' . $data['lastname'] . "\n";
         $message .= $this->language->get('text_customer_group') . ' ' . $customer_group_info['name'] . "\n";
         if ($data['company']) {
             $message .= $this->language->get('text_company') . ' ' . $data['company'] . "\n";
         }
         $message .= $this->language->get('text_email') . ' ' . $data['email'] . "\n";
         $message .= $this->language->get('text_telephone') . ' ' . $data['telephone'] . "\n";
         $mail->setTo($this->config->get('config_email'));
         $mail->setSubject(html_entity_decode($this->language->get('text_new_customer'), ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails if new account email is enabled
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if (utf8_strlen($email) > 0 && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     return $customer_id;
 }
 public function validate()
 {
     $this->language->load('module/ULTIMATUMcontactform');
     $json = array();
     if (strlen($this->request->post['ULTIMATUMcontactform_email']) > 96 || !preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $this->request->post['ULTIMATUMcontactform_email'])) {
         $json['error']['warning'] = $this->language->get('error_email');
     } elseif (strlen($this->request->post['ULTIMATUMcontactform_message']) < 3) {
         $json['error']['warning'] = $this->language->get('error_message');
     }
     if ($this->config->get('ULTIMATUMcontactform_captcha')) {
         if ($this->request->post['captcha'] != $this->session->data['captcha']) {
             $json['error']['warning'] = $this->language->get('error_captcha');
         }
     }
     if (!$json) {
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->request->post['ULTIMATUMcontactform_email']);
         $mail->setSender($this->request->post['ULTIMATUMcontactform_email']);
         $mail->setSubject(html_entity_decode($this->language->get('email_subject'), ENT_QUOTES, 'UTF-8'));
         $mail->setText(strip_tags(html_entity_decode($this->request->post['ULTIMATUMcontactform_message'], ENT_QUOTES, 'UTF-8')));
         $mail->send();
         $json['success'] = $this->language->get('success');
     }
     $this->response->setOutput(json_encode($json));
 }
Example #3
0
 public function subscribes($data)
 {
     $res = $this->db->query("select * from " . DB_PREFIX . "newsletter where news_email='" . $data['email'] . "'");
     if ($res->num_rows == 1) {
         return "Email Already Exist";
     } else {
         if ($this->db->query("INSERT INTO " . DB_PREFIX . "newsletter(news_email) values ('" . $data['email'] . "')")) {
             //$this->response->redirect($this->url->link('common/home', '', 'SSL'));
             $this->load->language('module/newsletter');
             $mail = new Mail();
             $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($data['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('email_subject')));
             $mail->setText(sprintf($this->language->get('email_content')));
             $mail->send();
             return "Subscription Successfull";
         } else {
             //$this->response->redirect($this->url->link('common/home', '', 'SSL'));
             return "Subscription Fail";
         }
     }
 }
Example #4
0
 public function addComment($blog_id, $data)
 {
     $this->event->trigger('pre.comment.add', $data);
     $this->db->query("INSERT INTO " . DB_PREFIX . "comment SET commenter = '" . $this->db->escape($data['commenter']) . "', customer_id = '" . (int) $this->customer->getId() . "', blog_id = '" . (int) $blog_id . "', text = '" . $this->db->escape($data['text']) . "', date_added = NOW()");
     $comment_id = $this->db->getLastId();
     if ($this->config->get('config_blog_comment_mail')) {
         $this->load->language('mail/comment');
         $this->load->model('blog/blog');
         $blog_info = $this->model_blog_blog->getblog($blog_id);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_blog'), $this->db->escape(strip_tags($blog_info['name']))) . "\n";
         $message .= sprintf($this->language->get('text_commenter'), $this->db->escape(strip_tags($data['commenter']))) . "\n";
         $message .= $this->language->get('text_comment') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(array($this->config->get('config_email')));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->event->trigger('post.comment.add', $comment_id);
 }
Example #5
0
 public function addAskquestion($product_id, $data)
 {
     $this->load->model('catalog/product');
     $product_info = $this->model_catalog_product->getProduct($product_id);
     $subject = sprintf($this->language->get('text_subject_e_ask'), html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8'));
     $message = sprintf($this->language->get('text_product_e_ask'), html_entity_decode($product_info['name'], ENT_QUOTES, 'UTF-8')) . "\n";
     $message .= sprintf($this->language->get('text_url_e_ask'), html_entity_decode($this->url->link('product/product', '&product_id=' . $this->db->escape(html_entity_decode($product_info['product_id']))))) . "\n\n";
     $message .= sprintf($this->language->get('text_name_e_ask'), html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8')) . "\n";
     $message .= sprintf($this->language->get('text_email_e_ask'), html_entity_decode($data['email1'], ENT_QUOTES, 'UTF-8')) . "\n\n\n";
     $message .= $this->language->get('text_question_e_ask') . "\n\n";
     $message .= html_entity_decode($data['text1'], ENT_QUOTES, 'UTF-8') . "\n\n";
     $mail = new Mail();
     $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($this->config->get('config_email'));
     $mail->setFrom(html_entity_decode($data['email1']));
     $mail->setSender(html_entity_decode($data['name1'], ENT_QUOTES, 'UTF-8'));
     $mail->setSubject($subject);
     $mail->setText($message);
     $mail->send();
     $emails = explode(',', $this->config->get('config_mail_alert'));
     foreach ($emails as $email) {
         if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
             $mail->setTo($email);
             $mail->send();
         }
     }
 }
Example #6
0
 public function editOrder($order_id, $data)
 {
     $this->db->query("UPDATE `" . DB_PREFIX . "order` SET order_status_id = '" . (int) $data['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int) $order_id . "'");
     $this->db->query("INSERT INTO " . DB_PREFIX . "order_history SET order_id = '" . (int) $order_id . "', order_status_id = '" . (int) $data['order_status_id'] . "', notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', date_added = NOW()");
     if (isset($data['notify'])) {
         $query = $this->db->query("SELECT *, os.name AS status, l.code AS language FROM `" . DB_PREFIX . "order` o LEFT JOIN " . DB_PREFIX . "order_status os ON (o.order_status_id = os.order_status_id AND os.language_id = o.language_id) LEFT JOIN " . DB_PREFIX . "language l ON (o.language_id = l.language_id) WHERE o.order_id = '" . (int) $order_id . "'");
         if ($query->num_rows) {
             $language = new Language($query->row['language']);
             $language->load('customer/order');
             $subject = sprintf($language->get('mail_subject'), html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'), $order_id);
             $message = $language->get('mail_order') . ' ' . $order_id . "\n";
             $message .= $language->get('mail_date_added') . ' ' . date($language->get('date_format_short'), strtotime($query->row['date_added'])) . "\n\n";
             $message .= $language->get('mail_order_status') . "\n\n";
             $message .= $query->row['status'] . "\n\n";
             $message .= $language->get('mail_invoice') . "\n";
             $message .= html_entity_decode(HTTP_CATALOG . 'index.php?route=account/invoice&order_id=' . $order_id, ENT_QUOTES, 'UTF-8') . "\n\n";
             if (isset($data['comment'])) {
                 $message .= $language->get('mail_comment') . "\n\n";
                 $message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
             }
             $message .= $language->get('mail_footer');
             $mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password'), ENT_QUOTES, 'UTF-8'), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
             $mail->setTo($query->row['email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender(html_entity_decode($this->config->get('config_store'), ENT_QUOTES, 'UTF-8'));
             $mail->setSubject($subject);
             $mail->setText($message);
             $mail->send();
         }
     }
 }
Example #7
0
 public function index()
 {
     $data['email'] = isset($this->request->post['email']) ? $this->request->post['email'] : ($this->auth->isLogged() ? $this->auth->getEmail() : false);
     $data['subject'] = isset($this->request->post['subject']) ? $this->request->post['subject'] : false;
     $data['message'] = isset($this->request->post['message']) ? $this->request->post['message'] : false;
     if ('POST' == $this->request->getRequestMethod() && $this->_validatePost()) {
         $mail = new Mail();
         $mail->setTo(MAIL_INFO);
         $mail->setFrom(MAIL_FROM);
         $mail->setReplyTo($this->request->post['email']);
         $mail->setSender(MAIL_SENDER);
         $mail->setSubject($this->request->post['subject']);
         $mail->setText($this->request->post['message']);
         $mail->send();
         $this->session->setUserMessage(array('success' => tt('Your message was sent successfully!')));
         $data['subject'] = false;
         $data['message'] = false;
     }
     $this->document->setTitle(tt('Contact Us'));
     $data['module_breadcrumbs'] = $this->load->controller('module/breadcrumbs', array(array('name' => tt('Home'), 'href' => $this->url->link('common/home'), 'active' => false), array('name' => tt('Contact Us'), 'href' => $this->url->link('common/contact', '', 'SSL'), 'active' => true)));
     $data['error'] = $this->_error;
     $data['href_common_information_licenses'] = $this->url->link('common/information/licenses');
     $data['href_common_information_terms'] = $this->url->link('common/information/terms');
     $data['href_common_information_faq'] = $this->url->link('common/information/faq');
     $data['action'] = $this->url->link('common/contact', '', 'SSL');
     $data['alert_success'] = $this->load->controller('common/alert/success');
     $data['footer'] = $this->load->controller('common/footer');
     $data['header'] = $this->load->controller('common/header');
     $this->response->setOutput($this->load->view('common/contact.tpl', $data));
 }
Example #8
0
 public function addAffiliate($data)
 {
     $this->getDb()->query("\r\n\t\t\tINSERT INTO affiliate \r\n\t\t\t(firstname, lastname, email, telephone, fax, password, company, address_1, address_2, city, postcode, country_id, \r\n\t\t\tzone_id, code, commission, tax, payment, cheque, paypal, bank_name, bank_branch_number, bank_swift_code, bank_account_name,\r\n\t\t\tbank_account_number, status, approved, date_added)\r\n\t\t\tVALUES (\r\n\t\t\t\t:firstName, :lastName, :email, :phone, :fax, :password, :company, :address1, :address2, :city, :zip, \r\n\t\t\t\t:countryId, :zoneId, :code, :commission, :tax, :payment, :cheque, :paypal, :bankName, :bankBranchNumber, \r\n\t\t\t\t:bankSwiftCode, :bankAccountName, :bankAccountNumber, 1, 1, NOW()\r\n\t\t\t)\r\n\t\t\t", [":firstName" => $data['firstname'], ":lastName" => $data['lastname'], ":email" => $data['email'], ":phone" => $data['telephone'], ":fax" => $data['fax'], ":password" => md5($data['password']), ":company" => $data['company'], ":address1" => $data['address_1'], ":address2" => $data['address_2'], ":city" => $data['city'], ":zip" => $data['postcode'], ":countryId" => $data['country_id'], ":zoneId" => $data['zone_id'], ":code" => uniqid(), ":commission" => $this->config->get('config_commission'), ":tax" => $data['tax'], ":payment" => $data['payment'], ":cheque" => $data['cheque'], ":paypal" => $data['paypal'], ":bankName" => $data['bank_name'], ":bankBranchNumber" => $data['bank_branch_number'], ":bankSwiftCode" => $data['bank_swift_code'], ":bankAccountName" => $data['bank_account_name'], ":bankAccountNumber" => $data['bank_account_number']]);
     $this->language->load('mail/affiliate');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     $message .= $this->language->get('text_approval') . "\n";
     $message .= $this->url->link('affiliate/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText($message);
     $mail->send();
 }
Example #9
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->redirect($this->url->link('account/account', '', 'SSL'));
     }
     $this->language->load('account/forgotten');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->language->load('mail/forgotten');
         $password = substr(sha1(uniqid(mt_rand(), true)), 0, 10);
         // $password = substr(md5(uniqid(mt_rand(), true)), 0, 10);
         // $password = "******";
         $this->model_account_customer->editPasswordOs($this->request->post['email'], $password);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = sprintf($this->language->get('text_greeting'), $this->config->get('config_name')) . "\n\n";
         $message .= $this->language->get('text_password') . "\n\n";
         $message .= $password;
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->url->link('account/forgotten', '', 'SSL'));
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_forgotten'), 'href' => $this->url->link('account/forgotten', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_your_email'] = $this->language->get('text_your_email');
     $this->data['text_email'] = $this->language->get('text_email');
     $this->data['entry_email'] = $this->language->get('entry_email');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['button_back'] = $this->language->get('button_back');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['action'] = $this->url->link('account/forgotten', '', 'SSL');
     $this->data['back'] = $this->url->link('account/login', '', 'SSL');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/forgotten.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/account/forgotten.tpl';
     } else {
         $this->template = 'default/template/account/forgotten.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
Example #10
0
 public function addReturnHistory($return_id, $data)
 {
     $this->db->query("UPDATE `" . DB_PREFIX . "return` SET return_status_id = '" . (int) $data['return_status_id'] . "', date_modified = NOW() WHERE return_id = '" . (int) $return_id . "'");
     $this->db->query("INSERT INTO " . DB_PREFIX . "return_history SET return_id = '" . (int) $return_id . "', return_status_id = '" . (int) $data['return_status_id'] . "', notify = '" . (isset($data['notify']) ? (int) $data['notify'] : 0) . "', comment = '" . $this->db->escape(strip_tags($data['comment'])) . "', date_added = NOW()");
     if ($data['notify']) {
         $return_query = $this->db->query("SELECT *, rs.name AS status FROM `" . DB_PREFIX . "return` r LEFT JOIN " . DB_PREFIX . "return_status rs ON (r.return_status_id = rs.return_status_id) WHERE r.return_id = '" . (int) $return_id . "' AND rs.language_id = '" . (int) $this->config->get('config_language_id') . "'");
         if ($return_query->num_rows) {
             $this->load->language('mail/return');
             $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'), $return_id);
             $message = $this->language->get('text_return_id') . ' ' . $return_id . "\n";
             $message .= $this->language->get('text_date_added') . ' ' . date($this->language->get('date_format_short'), strtotime($return_query->row['date_added'])) . "\n\n";
             $message .= $this->language->get('text_return_status') . "\n";
             $message .= $return_query->row['status'] . "\n\n";
             if ($data['comment']) {
                 $message .= $this->language->get('text_comment') . "\n\n";
                 $message .= strip_tags(html_entity_decode($data['comment'], ENT_QUOTES, 'UTF-8')) . "\n\n";
             }
             $message .= $this->language->get('text_footer');
             $mail = new Mail();
             $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_host');
             $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_query->row['email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($this->config->get('config_name'));
             $mail->setSubject($subject);
             $mail->setText($message);
             $mail->send();
         }
     }
 }
 public function sendNotification()
 {
     $this->language->load('mail/email_notification');
     $this->language->load('sale/contstatctrl');
     $this->load->model('sale/contstatctrl');
     if (isset($this->request->post['selected'])) {
         foreach ($this->request->post['selected'] as $signup_fee_id) {
             $vendor_data = $this->model_sale_contstatctrl->getVendorData($this->request->post['user_id' . "{$signup_fee_id}"]);
             $subject = sprintf($this->language->get('text_subject_expire'), $this->request->post['remaining_days' . "{$signup_fee_id}"]);
             $text = sprintf($this->language->get('text_to'), $vendor_data['firstname'] . ' ' . $vendor_data['lastname']) . "<br><br>";
             $text .= sprintf($this->language->get('text_message_expire'), $this->request->post['remaining_days' . "{$signup_fee_id}"]) . "<br><br>";
             $text .= $this->language->get('text_thanks') . "<br>";
             $text .= $this->config->get('config_name') . "<br><br>";
             $text .= $this->language->get('text_system');
             $mail = new Mail();
             $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($vendor_data['email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($this->config->get('config_name'));
             $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
             $mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
             $mail->setHtml(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
             $mail->send();
         }
         $this->session->data['success'] = $this->language->get('text_email_success');
     }
     $this->getList();
 }
Example #12
0
 public function addReview($product_id, $data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', product_id = '" . (int) $product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "', date_added = NOW()");
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_review_mail')) {
         $this->load->language('mail/review');
         $this->load->model('catalog/product');
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n";
         $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n";
         $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n";
         $message .= $this->language->get('text_review') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(array($this->config->get('config_email')));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
 }
Example #13
0
 public function addAffiliate($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "affiliate SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "', code = '" . $this->db->escape(uniqid()) . "', commission = '" . (double) $this->config->get('config_commission') . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', status = '1', date_added = NOW()");
     $this->language->load('mail/affiliate');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     $message .= $this->language->get('text_approval') . "\n";
     $message .= $this->url->link('affiliate/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #14
0
 public function index()
 {
     if ($this->user->isLogged()) {
         $this->redirect($this->url->link('common/home', '', 'SSL'));
     }
     $this->language->load('common/forgotten');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('user/user');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->language->load('mail/forgotten');
         $code = md5(mt_rand());
         $this->model_user_user->editCode($this->request->post['email'], $code);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = sprintf($this->language->get('text_greeting'), $this->config->get('config_name')) . "\n\n";
         $message .= sprintf($this->language->get('text_change'), $this->config->get('config_name')) . "\n\n";
         $message .= $this->url->link('common/reset', 'code=' . $code, 'SSL') . "\n\n";
         $message .= sprintf($this->language->get('text_ip'), $this->request->server['REMOTE_ADDR']) . "\n\n";
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_forgotten'), 'href' => $this->url->link('common/forgotten', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_your_email'] = $this->language->get('text_your_email');
     $this->data['text_email'] = $this->language->get('text_email');
     $this->data['entry_email'] = $this->language->get('entry_email');
     $this->data['button_reset'] = $this->language->get('button_reset');
     $this->data['button_cancel'] = $this->language->get('button_cancel');
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     $this->data['action'] = $this->url->link('common/forgotten', '', 'SSL');
     $this->data['cancel'] = $this->url->link('common/login', '', 'SSL');
     if (isset($this->request->post['email'])) {
         $this->data['email'] = $this->request->post['email'];
     } else {
         $this->data['email'] = '';
     }
     $this->template = 'common/forgotten.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Example #15
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->response->redirect($this->url->link('studio/login/welcome', '', 'SSL'));
     }
     $this->language->load('studio/forgotten');
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->language->load('mail/forgotten');
         $password = substr(md5(rand()), 0, 7);
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = sprintf($this->language->get('text_greeting'), $this->config->get('config_name')) . "\n\n";
         $message .= $this->language->get('text_password') . "\n\n";
         $message .= $password;
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect($this->url->link('studio/login', '', 'SSL'));
     }
     $data['text_your_email'] = $this->language->get('text_your_email');
     $data['text_email'] = $this->language->get('text_email');
     $data['entry_email'] = $this->language->get('entry_email');
     $data['button_continue'] = $this->language->get('button_continue');
     $data['button_back'] = $this->language->get('button_back');
     if (isset($this->request->post['email'])) {
         $data['email'] = $this->request->post['email'];
     } else {
         $data['email'] = '';
     }
     if (isset($this->error['warning'])) {
         $data['error_warning'] = $this->error['warning'];
     } else {
         $data['error_warning'] = '';
     }
     $data['action'] = $this->url->link('studio/forgotten', '', 'SSL');
     $data['back'] = $this->url->link('studio/login', '', 'SSL');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/studio/forgotten.tpl')) {
         $template = $this->config->get('config_template') . '/template/studio/forgotten.tpl';
     } else {
         $template = 'default/template/studio/forgotten.tpl';
     }
     $this->response->setOutput($this->load->view($template, $data));
 }
Example #16
0
 public function index()
 {
     if ($this->user->isLogged()) {
         $this->response->redirect($this->url->link('common/dashboard', '', 'SSL'));
     }
     if (!$this->config->get('config_password')) {
         $this->response->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->load->language('common/forgotten');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('user/user');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->language('mail/forgotten');
         $code = sha1(uniqid(mt_rand(), true));
         $this->model_user_user->editCode($this->request->post['email'], $code);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = sprintf($this->language->get('text_greeting'), $this->config->get('config_name')) . "\n\n";
         $message .= $this->language->get('text_change') . "\n\n";
         $message .= $this->url->link('common/reset', 'code=' . $code, 'SSL') . "\n\n";
         $message .= sprintf($this->language->get('text_ip'), $this->request->server['REMOTE_ADDR']) . "\n\n";
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->session->data['success'] = $this->language->get('text_success');
         $this->response->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $data['breadcrumbs'] = array();
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/dashboard'));
     $data['breadcrumbs'][] = array('text' => $this->language->get('text_forgotten'), 'href' => $this->url->link('common/forgotten', '', 'SSL'));
     $data['heading_title'] = $this->language->get('heading_title');
     $data['text_your_email'] = $this->language->get('text_your_email');
     $data['text_email'] = $this->language->get('text_email');
     $data['entry_email'] = $this->language->get('entry_email');
     $data['button_reset'] = $this->language->get('button_reset');
     $data['button_cancel'] = $this->language->get('button_cancel');
     if (isset($this->error['warning'])) {
         $data['error_warning'] = $this->error['warning'];
     } else {
         $data['error_warning'] = '';
     }
     $data['action'] = $this->url->link('common/forgotten', '', 'SSL');
     $data['cancel'] = $this->url->link('common/login', '', 'SSL');
     if (isset($this->request->post['email'])) {
         $data['email'] = $this->request->post['email'];
     } else {
         $data['email'] = '';
     }
     $data['header'] = $this->load->controller('common/header');
     $data['footer'] = $this->load->controller('common/footer');
     $this->response->setOutput($this->load->view('common/forgotten.tpl', $data));
 }
 public function index()
 {
     if ($this->config->get('config_remember_billet')) {
         $this->load->model('cron/remember_billet');
         $orders = $this->model_cron_remember_billet->getOrdersWaitingPaymentBillet();
         if ($orders) {
             foreach ($orders as $order) {
                 $subject = 'Seus produtos estão ansiosos para ir para casa!';
                 $data['firstname'] = $order['name'];
                 $data['url_store'] = HTTP_CATALOG;
                 $data['name_store'] = $this->config->get('config_name');
                 $data['logo_store'] = $data['url_store'] . 'image/' . $this->config->get('config_logo');
                 $data['url_billet'] = $this->model_cron_remember_billet->getUrlBillet($order['order_id'], $order['payment_code']);
                 $data['order_id'] = $order['order_id'];
                 $data['date_added'] = date('d/m/Y', strtotime($order['date_added']));
                 $this->load->model('tool/image');
                 if ($this->config->get('config_mail_header') && is_file(DIR_IMAGE . $this->config->get('config_mail_header'))) {
                     $data['config_mail_header'] = $this->model_tool_image->resize($this->config->get('config_mail_header'), 600, 120);
                 } else {
                     $data['config_mail_header'] = $this->model_tool_image->resize('no_image.png', 600, 120);
                 }
                 if ($this->config->get('config_mail_footer') && is_file(DIR_IMAGE . $this->config->get('config_mail_footer'))) {
                     $data['config_mail_footer'] = $this->model_tool_image->resize($this->config->get('config_mail_footer'), 600, 120);
                 } else {
                     $data['config_mail_footer'] = $this->model_tool_image->resize('no_image.png', 600, 120);
                 }
                 if (file_exists(DIR_TEMPLATE . 'mail/remember_billet.tpl')) {
                     $html = $this->load->view('mail/remember_billet.tpl', $data);
                 } else {
                     $html = $this->load->view('mail/remember_billet.tpl', $data);
                 }
                 if (!empty($data['url_billet']) && !empty($order['email'])) {
                     $mail = new Mail($this->config->get('config_mail'));
                     $mail->setTo($order['email']);
                     $mail->setFrom($this->config->get('config_email'));
                     $mail->setSender($this->config->get('config_name'));
                     $mail->setSubject($subject);
                     $mail->setHtml($html);
                     $mail->setText(html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8'));
                     $mail->send();
                     echo 'E-mail enviado';
                 }
                 $emails = explode(',', $this->config->get('config_mail_alert'));
                 if ($emails) {
                     foreach ($emails as $email) {
                         if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                             $mail->setTo($email);
                             $mail->send();
                         }
                     }
                 }
             }
         }
     }
 }
Example #18
0
 public function addAffiliate($data, $customer_id, $code)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "affiliate SET customer_id='" . (int) $customer_id . "' ,firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "',code = '" . $this->db->escape(uniqid()) . "', commission = '" . (double) $this->config->get('config_commission') . "', tax = '" . $this->db->escape($data['tax']) . "', payment = '" . $this->db->escape($data['payment']) . "', cheque = '" . $this->db->escape($data['cheque']) . "', paypal = '" . $this->db->escape($data['paypal']) . "', bank_name = '" . $this->db->escape($data['bank_name']) . "', bank_branch_number = '" . $this->db->escape($data['bank_branch_number']) . "', bank_swift_code = '" . $this->db->escape($data['bank_swift_code']) . "', bank_account_name = '" . $this->db->escape($data['bank_account_name']) . "', bank_account_number = '" . $this->db->escape($data['bank_account_number']) . "', status = '1', date_added = NOW()");
     // my code
     // $query = $this->db->query("SELECT max(affiliate_id) FROM `" . DB_PREFIX . "affiliate`");
     // $aff_id = $query->row['max(affiliate_id)'];
     // 	 $aff_id = $this->getAffiliate($aff_id);
     // $this->db->query("INSERT INTO " . DB_PREFIX . "affiliate_level SET aff_id='".(int)$aff_id['affiliate_id']."', level='".(int)$aff['parent']."'");
     // my code
     // my code
     $levels = $this->config->get('affiliate_level_commission');
     if (isset($this->request->cookie['tracking']) & $levels) {
         $query = $this->db->query("SELECT affiliate_id FROM `" . DB_PREFIX . "affiliate` WHERE code = '" . $this->request->cookie['tracking'] . "'");
         if ($query->num_rows) {
             $affiliate_parent = $query->row['affiliate_id'];
             $count_affiliate = $levels[1]['level_affiliate'];
             if ($count_affiliate != 0) {
                 $query = $this->db->query("SELECT count(*) as total FROM `" . DB_PREFIX . "affiliate` WHERE parent = '" . $affiliate_parent . "'");
                 $count_affiliate_sql = $query->row['total'];
                 if ($count_affiliate_sql < $count_affiliate) {
                     $count_affiliate = 0;
                 }
             }
             if ($count_affiliate == 0) {
                 $query_id = $this->db->query("SELECT affiliate_id FROM `" . DB_PREFIX . "affiliate` WHERE email = '" . $this->db->escape($data['email']) . "'");
                 $affiliate_id = $query_id->row['affiliate_id'];
                 $this->db->query("UPDATE `" . DB_PREFIX . "affiliate` SET parent = '" . $affiliate_parent . "' WHERE affiliate_id = '" . (int) $affiliate_id . "'");
             }
         }
     }
     // если это не использовать то при при регистрации через вк не добавится либо покупатель либо партнер...notice ошибка c mail
     return true;
     $this->language->load('mail/affiliate');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     $message .= $this->language->get('text_approval') . "\n";
     $message .= $this->url->link('affiliate/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #19
0
 public function stockCheck($products, $summary)
 {
     $this->ebay->log('Inside the stock check method');
     //items not linked to a store item
     //total ebay items
     //% linked
     //total not matching stock
     //% items not matching
     $template = new Template();
     $template->data = array_merge($template->data, $this->load->language('ebay/stock_report'));
     $template->data['summary'] = $summary;
     $liveArray = $this->ebay->getLiveProducts();
     $template->data['storelinked_products'] = count($liveArray);
     $template->data['store_products'] = $this->countStoreProducts();
     $template->data['ebay_products'] = count($products);
     $template->data['product_errors'] = 0;
     foreach ($products as $id => $product) {
         $this->ebay->log('Product: ' . $id);
         $eQty = (int) $product['qty'];
         if (array_key_exists((int) $id, $liveArray)) {
             $sQty = (int) $liveArray[$id]['qty'];
             if ($eQty == $sQty) {
                 $status = 'OK';
             } else {
                 $status = 'Stock error';
                 $template->data['product_errors']++;
             }
             $template->data['products'][] = array('name' => (string) $product['name'], 'eQty' => $eQty, 'sQty' => $sQty, 'status' => $status, 'type' => (string) $product['type'], 'id' => $id);
             unset($liveArray[$id]);
         } else {
             $template->data['products'][] = array('name' => (string) $product['name'], 'eQty' => $eQty, 'sQty' => '-', 'status' => 'Not linked', 'type' => (string) $product['type'], 'id' => $id);
         }
     }
     $template->data['error_links'] = count($liveArray);
     $template->data['storelinked_products'] = $template->data['storelinked_products'] - $template->data['error_links'];
     $template->data['storelinked_percent'] = number_format(100 / $template->data['store_products'] * $template->data['storelinked_products'], 2);
     $template->data['errorlinked_percent'] = number_format(100 / $template->data['ebay_products'] * $template->data['product_errors'], 2);
     $html = $template->fetch('default/template/mail/ebay_stockreport.tpl');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->config->get('config_email'));
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender('OpenBay Pro robot');
     $mail->setSubject(html_entity_decode('Your OpenBay Pro stock link report', ENT_QUOTES, 'UTF-8'));
     $mail->setHtml($html);
     $mail->setText(html_entity_decode('', ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #20
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->redirect($this->url->https('account/forgotten'));
     }
     $this->language->load('account/forgotten');
     $this->document->title = $this->language->get('heading_title');
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $password = substr(md5(rand()), 0, 7);
         $subject = sprintf($this->language->get('mail_subject'), $this->config->get('config_store'));
         $message = sprintf($this->language->get('mail_greeting'), $this->config->get('config_store')) . "\n\n";
         $message .= $this->language->get('mail_password') . "\n\n";
         $message .= $password;
         $mail = new Mail($this->config->get('config_mail_protocol'), $this->config->get('config_smtp_host'), $this->config->get('config_smtp_username'), html_entity_decode($this->config->get('config_smtp_password')), $this->config->get('config_smtp_port'), $this->config->get('config_smtp_timeout'));
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_store'));
         $mail->setSubject($subject);
         $mail->setText($message);
         $mail->send();
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect($this->url->https('account/login'));
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => $this->url->http('common/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE);
     $this->document->breadcrumbs[] = array('href' => $this->url->http('account/account'), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => $this->url->http('account/forgotten'), 'text' => $this->language->get('text_forgotten'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_your_email'] = $this->language->get('text_your_email');
     $this->data['text_email'] = $this->language->get('text_email');
     $this->data['entry_email'] = $this->language->get('entry_email');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['button_back'] = $this->language->get('button_back');
     if (isset($this->error['message'])) {
         $this->data['error'] = $this->error['message'];
     } else {
         $this->data['error'] = '';
     }
     $this->data['action'] = $this->url->https('account/forgotten');
     $this->data['back'] = $this->url->https('account/account');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/forgotten.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/account/forgotten.tpl';
     } else {
         $this->template = 'default/template/account/forgotten.tpl';
     }
     $this->children = array('common/header', 'common/footer', 'common/column_left', 'common/column_right');
     $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
 }
Example #21
0
 public function addCustomer($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET store_id = '" . (int) $this->config->get('config_store_id') . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', password = '******'password'])) . "', newsletter = '" . (isset($data['newsletter']) ? (int) $data['newsletter'] : 0) . "', customer_group_id = '" . (int) $this->config->get('config_customer_group_id') . "', status = '1', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', company = '" . $this->db->escape($data['company']) . "', address_1 = '" . $this->db->escape($data['address_1']) . "', address_2 = '" . $this->db->escape($data['address_2']) . "', city = '" . $this->db->escape($data['city']) . "', postcode = '" . $this->db->escape($data['postcode']) . "', country_id = '" . (int) $data['country_id'] . "', zone_id = '" . (int) $data['zone_id'] . "'");
     $address_id = $this->db->getLastId();
     $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . (int) $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
     if (!$this->config->get('config_customer_approval')) {
         $this->db->query("UPDATE " . DB_PREFIX . "customer SET approved = '1' WHERE customer_id = '" . (int) $customer_id . "'");
     }
     $this->language->load('mail/customer');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     if (!$this->config->get('config_customer_approval')) {
         $message .= $this->language->get('text_login') . "\n";
     } else {
         $message .= $this->language->get('text_approval') . "\n";
     }
     $message .= $this->url->link('account/login', '', 'SSL') . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->config->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($this->request->post['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText($message);
     $mail->send();
     // Send to main admin email if new account email is enabled
     if ($this->config->get('config_account_mail')) {
         $mail->setTo($this->config->get('config_email'));
         $mail->send();
         // Send to additional alert emails if new account email is enabled
         $emails = explode(',', $this->config->get('config_alert_emails'));
         foreach ($emails as $email) {
             if (strlen($email) > 0 && preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
 }
Example #22
0
 public function index()
 {
     $output = '';
     $this->language->load('account/forgotten');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->language('mail/forgotten');
         $password = substr(sha1(uniqid(mt_rand(), true)), 0, 10);
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $subject = sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $message = sprintf($this->language->get('text_greeting'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8')) . "\n\n";
         $message .= $this->language->get('text_password') . "\n\n";
         $message .= $password;
         $mail = new Mail();
         $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($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $mail->setSubject($subject);
         $mail->setText($message);
         $mail->send();
         $this->session->data['success'] = $this->language->get('text_success');
         // Add to activity log
         $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
         if ($customer_info) {
             $this->load->model('account/activity');
             $activity_data = array('customer_id' => $customer_info['customer_id'], 'name' => $customer_info['firstname'] . ' ' . $customer_info['lastname']);
             $this->model_account_activity->addActivity('forgotten', $activity_data);
         }
         $output = 'ok';
     } else {
         $output = 'not correct';
     }
     if (isset($this->request->server['HTTP_ORIGIN'])) {
         $this->response->addHeader('Access-Control-Allow-Origin: ' . $this->request->server['HTTP_ORIGIN']);
         $this->response->addHeader('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
         $this->response->addHeader('Access-Control-Max-Age: 1000');
         $this->response->addHeader('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
     }
     $this->response->addHeader('Content-Type: text/html; charset=utf-8');
     $this->response->setOutput($output);
 }
Example #23
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->response->redirect($this->url->link('account/account', '', 'SSL'));
     }
     $this->data = $this->load->language('account/forgotten');
     $this->document->setTitle($this->data['heading_title']);
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->language('mail/forgotten');
         $password = substr(sha1(uniqid(mt_rand(), true)), 0, 10);
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $subject = sprintf($this->data['text_subject'], $this->config->get('config_name'));
         $message = sprintf($this->data['text_greeting'], $this->config->get('config_name')) . "\n\n";
         $message .= $this->data['text_password'] . "\n\n";
         $message .= $password;
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo($this->request->post['email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->session->data['success'] = $this->data['text_success'];
         // Add to activity log
         $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
         if ($customer_info) {
             $this->load->model('account/activity');
             $activity_data = array('customer_id' => $customer_info['customer_id'], 'name' => $customer_info['firstname'] . ' ' . $customer_info['lastname']);
             $this->model_account_activity->addActivity('forgotten', $activity_data);
         }
         $this->response->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->data['breadcrumbs'] = $this->config->breadcrums(array($this->data['text_home'], $this->url->link('common/home'), $this->data['text_account'], $this->url->link('account/account', '', 'SSL'), $this->data['text_forgotten'], $this->url->link('account/forgotten', '', 'SSL')));
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     $this->data['action'] = $this->url->link('account/forgotten', '', 'SSL');
     $this->data['back'] = $this->url->link('account/login', '', 'SSL');
     $this->data['column_left'] = $this->load->controller('common/column_left');
     $this->data['column_right'] = $this->load->controller('common/column_right');
     $this->data['content_top'] = $this->load->controller('common/content_top');
     $this->data['content_bottom'] = $this->load->controller('common/content_bottom');
     $this->data['footer'] = $this->load->controller('common/footer');
     $this->data['header'] = $this->load->controller('common/header');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/forgotten.tpl')) {
         $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/account/forgotten.tpl', $this->data));
     } else {
         $this->response->setOutput($this->load->view('default/template/account/forgotten.tpl', $this->data));
     }
 }
 public function send($data, $type, $language_id = false)
 {
     if (!$language_id) {
         $language_id = $this->config->get('config_language_id');
     }
     $template_info = $this->getEmailTemplateByType($type);
     if ($template_info) {
         $variables = explode(',', $template_info['variables']);
         $search = array();
         $replace = array();
         foreach ($variables as $variable) {
             $variable = trim($variable);
             if ($variable && isset($data[$variable])) {
                 $search[] = '{' . $variable . '}';
                 $replace[] = $data[$variable];
             }
         }
         $subject = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['subject'], ENT_QUOTES));
         $message = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['html'], ENT_QUOTES));
         $template_data = array();
         $template_data['name'] = $this->config->get('config_name');
         $template_data['subject'] = $subject;
         $template_data['message'] = $message;
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_theme') . '/template/mail/general.tpl')) {
             $html = $this->load->view($this->config->get('config_theme') . '/template/mail/general.tpl', $template_data);
         } else {
             $html = $this->load->view('default/template/mail/general.tpl', $template_data);
         }
         $text = str_replace($search, $replace, html_entity_decode($template_info['description'][$language_id]['text'], ENT_QUOTES));
         if ($subject && isset($data['to_email'])) {
             $mail = new Mail($this->config->get('config_mail'));
             $mail->setTo($data['to_email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($this->config->get('config_name'));
             $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
             $mail->setText(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
             $mail->setHtml($html);
             $mail->send();
             if ($template_info['email']) {
                 $emails = explode(',', $template_info['email']);
                 foreach ($emails as $email) {
                     $mail->setTo(trim($email));
                     $mail->send();
                 }
             }
         }
     }
 }
Example #25
0
function sendMail($data)
{
    $mail = new Mail();
    $mail->protocol = Constant::config_mail_protocol;
    $mail->parameter = Constant::config_mail_parameter;
    $mail->hostname = Constant::config_smtp_host;
    $mail->username = Constant::config_smtp_username;
    $mail->password = Constant::config_smtp_password;
    $mail->port = Constant::config_smtp_port;
    $mail->timeout = Constant::config_smtp_timeout;
    $mail->setTo($data['to']);
    $mail->setFrom(Constant::config_email);
    $mail->setSender(Constant::config_name);
    $mail->setSubject(html_entity_decode($data['subject'], ENT_QUOTES, 'UTF-8'));
    $mail->setText(html_entity_decode($data[''], ENT_QUOTES, 'UTF-8'));
    $mail->send();
}
 public function index()
 {
     if (!$this->config->get('contact_form_status')) {
         return new Action('error/not_found');
     }
     $this->data = $this->load->language('module/contact_form/contact_form');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'));
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('module/contact_form/contact_form', '', 'SSL'));
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setFrom($this->request->post['email']);
         $mail->setSender($this->request->post['name']);
         $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_enquiry'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
         $mail->setText(html_entity_decode($this->request->post['message'], ENT_QUOTES, 'UTF-8'));
         $emails = explode(',', $this->config->get('contact_form_receiving_email'));
         foreach ($emails as $email) {
             if (trim($email)) {
                 $mail->setTo(trim($email));
                 $mail->send();
             }
         }
         $this->response->redirect($this->url->link('module/contact_form/contact_form/success'));
     }
     $this->data['action'] = $this->url->link('module/contact_form/contact_form');
     $description = $this->config->get('contact_form_description');
     $this->data['description'] = html_entity_decode($description[$this->config->get('config_language_id')], ENT_QUOTES, 'UTF-8');
     $this->data['error_name'] = $this->build->data('name', $this->error);
     $this->data['error_email'] = $this->build->data('email', $this->error);
     $this->data['error_message'] = $this->build->data('message', $this->error);
     $this->data['error_captcha'] = $this->build->data('captcha', $this->error);
     $this->data['name'] = $this->build->data('name', $this->request->post);
     $this->data['email'] = $this->build->data('email', $this->request->post);
     $this->data['message'] = $this->build->data('message', $this->request->post);
     $this->data['captcha'] = $this->build->data('captcha', $this->request->post);
     $this->data['captcha_image'] = $this->url->link('tool/captcha');
     $this->data['header'] = $this->load->controller('common/header');
     $this->data['footer'] = $this->load->controller('common/footer');
     if (file_exists(DIR_EXTENSION . 'module/contact_form/view/theme/' . $this->config->get('config_theme') . '/template/contact_form.tpl')) {
         $this->response->setOutput($this->render('module/contact_form/' . $this->config->get('config_theme') . '/template/contact_form.tpl'));
     } else {
         $this->response->setOutput($this->render('module/contact_form/default/template/contact_form.tpl'));
     }
 }
Example #27
0
 public function addReview($data)
 {
     $this->event->trigger('pre.store_review.add', $data);
     $this->db->query("INSERT INTO " . DB_PREFIX . "review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', product_id = '0', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "', date_added = NOW()");
     $review_id = $this->db->getLastId();
     if ($this->config->get('config_review_mail')) {
         $this->load->language('review/review_mail');
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n";
         if ($data['rating']) {
             $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n";
         }
         $message .= $this->language->get('text_review') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         if (VERSION == '2.0.2.0' || VERSION == '2.0.3.1') {
             $mail = new Mail();
             $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_host');
             $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');
         } else {
             $mail = new Mail($this->config->get('config_mail'));
         }
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText($message);
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->event->trigger('post.store_review.add', $review_id);
 }
Example #28
0
 public function send()
 {
     $this->language->load('information/contact');
     $errors = array();
     try {
         if ($this->request->server['REQUEST_METHOD'] != 'POST') {
             throw new Exception('Error');
         }
         if (utf8_strlen($this->request->post['name']) < 3 || utf8_strlen($this->request->post['name']) > 32) {
             $errors['name'] = $this->language->get('error_name');
         }
         if (!preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $this->request->post['email'])) {
             $errors['email'] = $this->language->get('error_email');
         }
         if (utf8_strlen($this->request->post['enquiry']) < 10 || utf8_strlen($this->request->post['enquiry']) > 3000) {
             $errors['enquiry'] = $this->language->get('error_enquiry');
         }
         if (!empty($errors)) {
             throw new Exception('field');
         }
         // Send
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $mail->parameter = $this->config->get('config_mail_parameter');
         $mail->hostname = $this->config->get('config_smtp_host');
         $mail->username = $this->config->get('config_smtp_username');
         $mail->password = $this->config->get('config_smtp_password');
         $mail->port = $this->config->get('config_smtp_port');
         $mail->timeout = $this->config->get('config_smtp_timeout');
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->request->post['email']);
         $mail->setSender($this->request->post['name']);
         $mail->setSubject(html_entity_decode(sprintf($this->language->get('email_subject'), $this->request->post['name']), ENT_QUOTES, 'UTF-8'));
         $mail->setText(strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8')));
         $mail->send();
         $results = array('status' => 1, 'message' => $this->language->get('text_success'));
     } catch (Exception $e) {
         $results = array('status' => 0, 'message' => '');
         if ($e->getMessage() == 'field') {
             $results['fields'] = $errors;
         }
     }
     $this->response->setOutput(json_encode($results));
 }
Example #29
0
 public function addReview($product_id, $data)
 {
     $this->event->trigger('pre.review.add', $data);
     $this->db->query("INSERT INTO " . DB_PREFIX . "review SET order_id = '" . (int) $data['order_id'] . "', author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', order_product_id = '" . (int) $data['order_product_id'] . "', product_id = '" . (int) $product_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "', status = '1', date_added = NOW()");
     $review_id = $this->db->getLastId();
     $this->db->query("INSERT INTO " . DB_PREFIX . "store_review SET store_id = '" . (int) $data['store_id'] . "', order_id = '" . (int) $data['order_id'] . "', customer_id = '" . (int) $this->customer->getId() . "', product_id = '" . (int) $product_id . "', rating_product = '" . (int) $data['rating_product'] . "', rating_quality = '" . (int) $data['rating_quality'] . "', rating_service = '" . (int) $data['rating_service'] . "', rating_deliver = '" . (int) $data['rating_deliver'] . "', status = 1, date_added = NOW()");
     if ($this->config->get('config_review_mail')) {
         $this->load->language('mail/review');
         $this->load->model('catalog/product');
         $product_info = $this->model_catalog_product->getProduct($product_id);
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_product'), $this->db->escape(strip_tags($product_info['name']))) . "\n";
         $message .= sprintf($this->language->get('text_reviewer'), $this->db->escape(strip_tags($data['name']))) . "\n";
         $message .= sprintf($this->language->get('text_rating'), $this->db->escape(strip_tags($data['rating']))) . "\n";
         $message .= $this->language->get('text_review') . "\n";
         $message .= $this->db->escape(strip_tags($data['text'])) . "\n\n";
         $mail = new Mail();
         $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_host');
         $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($this->config->get('config_email'));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setText($message);
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->event->trigger('post.review.add', $review_id);
 }
Example #30
0
 public function addReview($article_id, $data)
 {
     $this->event->trigger('pre.review.add', $data);
     $this->db->query("INSERT INTO " . DB_PREFIX . "news_review SET author = '" . $this->db->escape($data['name']) . "', customer_id = '" . (int) $this->customer->getId() . "', article_id = '" . (int) $article_id . "', text = '" . $this->db->escape($data['text']) . "', rating = '" . (int) $data['rating'] . "'");
     $review_id = $this->db->getLastId();
     if ($this->config->get('config_review_mail')) {
         $this->load->language('mail/review');
         $this->load->model('catalog/article');
         $article_info = $this->model_news_articles->getArticle($article_id);
         $subject = sprintf($this->language->get('text_subject'), html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $message = $this->language->get('text_waiting') . "\n";
         $message .= sprintf($this->language->get('text_article'), html_entity_decode($article_info['name'], ENT_QUOTES, 'UTF-8')) . "\n";
         $message .= sprintf($this->language->get('text_reviewer'), html_entity_decode($data['name'], ENT_QUOTES, 'UTF-8')) . "\n";
         $message .= sprintf($this->language->get('text_rating'), $data['rating']) . "\n";
         $message .= $this->language->get('text_review') . "\n";
         $message .= html_entity_decode($data['text'], ENT_QUOTES, 'UTF-8') . "\n\n";
         $mail = new Mail();
         $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($this->config->get('config_email'));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $mail->setSubject($subject);
         $mail->setText($message);
         $mail->send();
         // Send to additional alert emails
         $emails = explode(',', $this->config->get('config_mail_alert'));
         foreach ($emails as $email) {
             if ($email && preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $email)) {
                 $mail->setTo($email);
                 $mail->send();
             }
         }
     }
     $this->event->trigger('post.review.add', $review_id);
 }