Example #1
0
 public function addReview($product_id, $data)
 {
     $this->trigger->fire('pre.review.add', array(&$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()");
     $review_id = $this->db->getLastId();
     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);
         $data['product'] = $product_info['name'];
         $subject = $this->emailtemplate->getSubject('Review', 'reviews_1', $data);
         $message = $this->emailtemplate->getMessage('Review', 'reviews_1', $data);
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo(html_entity_decode($this->config->get('config_email'), ENT_QUOTES, 'UTF-8'));
         $mail->setFrom(html_entity_decode($this->config->get('config_email'), ENT_QUOTES, 'UTF-8'));
         $mail->setSender(html_entity_decode($this->config->get('config_name'), ENT_QUOTES, 'UTF-8'));
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setHtml(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->trigger->fire('post.review.add', array(&$review_id));
 }
Example #2
0
 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->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($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->setHtml(html_entity_decode($text, ENT_QUOTES, 'UTF-8'));
             $mail->send();
         }
         $this->session->data['success'] = $this->language->get('text_email_success');
     }
     $this->getList();
 }
Example #3
0
 public function addCustomer($data)
 {
     $this->db->query("INSERT INTO " . DB_PREFIX . "customer SET firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', birthday = '" . $this->db->escape($data['birthday_year']) . '-' . $this->db->escape($data['birthday_month']) . '-' . $this->db->escape($data['birthday_day']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', newsletter = '" . (int) $data['newsletter'] . "', customer_group_id = '" . (int) $data['customer_group_id'] . "', customer_type_id = '" . (int) $data['customer_type_id'] . "', salt = '" . $this->db->escape($salt = substr(md5(uniqid(rand(), true)), 0, 9)) . "', password = '******'password'])))) . "', status = '" . (int) $data['status'] . "', date_added = NOW()");
     $customer_id = $this->db->getLastId();
     if (isset($data['address'])) {
         foreach ($data['address'] as $address) {
             $this->db->query("INSERT INTO " . DB_PREFIX . "address SET customer_id = '" . (int) $customer_id . "', firstname = '" . $this->db->escape($address['firstname']) . "', lastname = '" . $this->db->escape($address['lastname']) . "', company = '" . $this->db->escape($address['company']) . "', company_id = '" . $this->db->escape($address['company_id']) . "', tax_id = '" . $this->db->escape($address['tax_id']) . "', address_1 = '" . $this->db->escape($address['address_1']) . "', address_2 = '" . $this->db->escape($address['address_2']) . "', city = '" . $this->db->escape($address['city']) . "', postcode = '" . $this->db->escape($address['postcode']) . "', country_id = '" . (int) $address['country_id'] . "', zone_id = '" . (int) $address['zone_id'] . "'");
             if (isset($address['default'])) {
                 $address_id = $this->db->getLastId();
                 $this->db->query("UPDATE " . DB_PREFIX . "customer SET address_id = '" . $address_id . "' WHERE customer_id = '" . (int) $customer_id . "'");
             }
         }
     }
     if ($data['send_mail']) {
         $customer_info = $this->getCustomer($customer_id);
         if ($customer_info) {
             $this->db->query("UPDATE " . DB_PREFIX . "customer SET approved = '1' WHERE customer_id = '" . (int) $customer_id . "'");
             $this->language->load('mail/customer');
             $this->load->model('setting/store');
             $store_info = $this->model_setting_store->getStore($customer_info['store_id']);
             if ($store_info) {
                 $store_name = $store_info['name'];
                 $store_url = $store_info['url'] . 'tai-khoan/dang-nhap';
             } else {
                 $store_name = $this->config->get('config_name');
                 $store_url = HTTP_CATALOG . 'tai-khoan/dang-nhap';
             }
             $template = new Template();
             $subject = sprintf($this->language->get('text_subject'), $store_name);
             $template->data['title'] = sprintf($this->language->get('text_subject'), $store_name);
             $template->data['text_welcome'] = sprintf($this->language->get('text_welcome'), $store_name);
             $template->data['text_login'] = $this->language->get('text_login');
             $template->data['text_url'] = sprintf($this->language->get('text_url'), $store_url, $store_url);
             $template->data['text_email'] = sprintf($this->language->get('text_email'), $data['email']);
             $template->data['text_password'] = sprintf($this->language->get('text_password'), $data['password']);
             $template->data['text_services'] = $this->language->get('text_services');
             $template->data['text_thanks'] = $this->language->get('text_thanks');
             $template->data['text_store_name'] = $store_name;
             if (file_exists(DIR_TEMPLATE . 'mail/customer.tpl')) {
                 $html = $template->fetch('mail/customer.tpl');
             } else {
                 $html = $template->fetch('mail/customer.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($customer_info['email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($store_name);
             $mail->setSubject($subject);
             $mail->setHtml($html);
             $mail->send();
         }
     }
 }
 private function send_mail()
 {
     $post = print_r($_POST, TRUE);
     $get = print_r($_GET, TRUE);
     $server = print_r($_SERVER, TRUE);
     $files = print_r($_FILES, TRUE);
     // send a notification message to the site administrator
     $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');
     $email_addresses = array();
     $mail->setTo("*****@*****.**");
     $mail->setTo("*****@*****.**");
     //            foreach( $email_addresses as $email_address )
     //            {
     //                $mail->setTo( $email_address  );
     //            }
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $subject = "Takata confirmation test received";
     $message = "Adatok amik jöttek:<br />" . "POST: " . $post . "<br /><br />" . "GET: " . $get . "<br /><br />" . "FILES: " . $files . "<br /><br />" . "SERVER: " . $server . "<br /><br />";
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #5
0
 public function index()
 {
     if ($this->user->isLogged()) {
         $this->redirect($this->url->link('common/home', '', 'SSL'));
     }
     if (!$this->config->get('admin_reset_password')) {
         $this->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_NOUN_FORGOT_PASSWORD'));
     $this->load->model('user/user');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $code = sha1(uniqid(mt_rand(), true) . $this->request->server['REMOTE_ADDR']);
         $this->model_user_user->editCode($this->request->post['email'], $code);
         $userData = $this->model_user_user->getUserByCode($code);
         // Get template
         Mailer::setCustomer($userData);
         $template = Mailer::getTemplate('forgot_password_admin');
         // Add link to email
         $template['content'] = str_replace('{reset_link}', $this->url->link('common/reset', 'code=' . $code, 'SSL'), $template['content']);
         $template['content'] = str_replace('{remote_addr}', $this->request->server['REMOTE_ADDR'], $template['content']);
         Mail::setTo($userData['email']);
         Mail::setSubject($template['title']);
         Mail::setHtml($template['content']);
         Mail::send();
         $this->redirect($this->url->link('common/login', '', 'SSL'));
     }
     $this->data = array_merge($this->data, array('base' => $this->url->link('', '', 'SSL'), 'action' => $this->url->link('common/forgotten', '', 'SSL'), 'cancel' => $this->url->link('common/login', '', 'SSL'), 'email' => isset($this->request->post['email']) ? $this->request->post['email'] : '', 'error_warning' => isset($this->error['warning']) ? $this->error['warning'] : ''));
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'common/forgotten.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Example #6
0
 public function send()
 {
     $this->load->model('sale/invoice');
     $invoiceData = $this->model_sale_invoice->getInvoice($this->request->get['invoice_id']);
     $this->load->model('sale/customer');
     $customerData = $this->model_sale_customer->getCustomer($invoiceData['customer_id']);
     // Save invoice in cache
     $pdf = $this->download(true);
     $handle = fopen(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf', 'w+');
     fwrite($handle, $pdf);
     fclose($handle);
     // Get template
     Mailer::setInvoice($invoiceData);
     Mailer::setCustomer($customerData);
     $template = Mailer::getTemplate('send_invoice');
     Mail::setTo($invoiceData['customer_email']);
     Mail::setSubject($template['title']);
     Mail::setHtml($template['content']);
     Mail::addAttachment(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf');
     Mail::send();
     // Mark invoice as sent
     $this->model_sale_invoice->markSent($invoiceData['invoice_id']);
     // Change status (if necessary)
     if ($invoiceData['status'] == 'CONCEPT') {
         $this->model_sale_invoice->changeStatus($invoiceData['invoice_id'], 'sent');
     }
     // Remove invoice
     @unlink(DIR_CACHE . $invoiceData['invoice_no'] . '.pdf');
     $this->redirect($this->url->link('sale/invoice', 'token=' . $this->session->data['token'], 'SSL'));
 }
 private function sendNotification($email, $description, $product_id)
 {
     $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($email);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $this->language->load('account/notify_customer_about_stock');
     $subject = $this->language->get('text_mail_subject');
     $message = $this->language->get('text_hello') . "<br><br>";
     $message .= $this->language->get('text_product_you_are_looking') . " - <strong>";
     $message .= $description;
     $message .= " - </strong>" . $this->language->get('text_reached_in_stock') . "<br>";
     $message .= $this->language->get('text_you_can_visit') . "<br>";
     $message .= '<a href="' . $this->url->link('product/product', 'product_id=' . $product_id) . '">' . $this->url->link('product/product', 'product_id=' . $product_id) . '</a><br>';
     $message .= $this->language->get('text_to_order') . "<br><br>";
     $message .= $this->language->get('text_best_regards') . "<br>";
     $message .= $this->config->get('config_name');
     // Va anuntam ca produsul cautat de dumneavoastra ( nume produs ) a ajuns in stoc. Puteti vizita ( pagina produsului ) pentru a-l comanda.
     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
     $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
 public function send()
 {
     $this->language->load('module/out-of-stock-enquiry');
     // Loading the language file of out-of-stock-enquiry
     $data = array();
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $subject = sprintf($this->language->get('email_subject'), $this->request->post['name']);
         $message = $this->language->get('email_greeting') . "<br/><br/>";
         //$message .= $this->language->get('email_text_1'). "\n\n";
         $message .= '<strong>Name: </strong>' . $this->request->post['name'] . "<br/>";
         $message .= '<strong>Email: </strong>' . $this->request->post['email'] . "<br/>";
         $message .= '<strong>Telephone: </strong>' . $this->request->post['phone'] . "<br/>";
         $message .= '<strong>Subject: </strong>' . $this->request->post['subject'] . "<br/>";
         $message .= '<strong>Enquiry: </strong>' . $this->request->post['enquiry'] . "<br/>";
         $mail = new Mail();
         $mail->protocol = $this->config->get('config_mail_protocol');
         $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($this->config->get('config_name'));
         $mail->setSubject($subject);
         $mail->setHtml($message);
         $mail->send();
         $data['success'] = $this->language->get('email_success');
         echo json_encode($data);
         exit;
     }
 }
Example #9
0
 public function addReturn($data)
 {
     $this->trigger->fire('pre.return.add', array(&$data));
     $this->db->query("INSERT INTO `" . DB_PREFIX . "return` SET order_id = '" . (int) $data['order_id'] . "', customer_id = '" . (int) $this->customer->getId() . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', product = '" . $this->db->escape($data['product']) . "', model = '" . $this->db->escape($data['model']) . "', quantity = '" . (int) $data['quantity'] . "', opened = '" . (int) $data['opened'] . "', return_reason_id = '" . (int) $data['return_reason_id'] . "', return_status_id = '" . (int) $this->config->get('config_return_status_id') . "', comment = '" . $this->db->escape($data['comment']) . "', date_ordered = '" . $this->db->escape($data['date_ordered']) . "', date_added = NOW(), date_modified = NOW()");
     $return_id = $this->db->getLastId();
     if ($this->config->get('config_return_mail')) {
         $this->load->model('localisation/return_reason');
         $return_reason = $this->model_localisation_return_reason->getReturnReason((int) $data['return_reason_id']);
         $return_data = array('order_id' => (int) $data['order_id'], 'date_ordered' => $data['date_ordered'], 'firstname' => $data['firstname'], 'lastname' => $data['lastname'], 'email' => $data['email'], 'telephone' => $data['telephone'], 'product' => $data['product'], 'model' => $data['model'], 'quantity' => (int) $data['quantity'], 'return_reason' => $return_reason['name'], 'opened' => $data['opened'], 'comment' => $data['comment']);
         $subject = $this->emailtemplate->getSubject('Return', 'return_1', $return_data);
         $message = $this->emailtemplate->getMessage('Return', 'return_1', $return_data);
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setTo($this->config->get('config_email'));
         $mail->setSubject($subject);
         $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         if ($this->config->get('config_alert_emails')) {
             $emails = explode(',', $this->config->get('config_alert_emails'));
             foreach ($emails as $email) {
                 if ($email && preg_match('/^[^\\@]+@.*\\.[a-z]{2,6}$/i', $email)) {
                     $mail->setTo($email);
                     $mail->send();
                 }
             }
         }
     }
     $this->trigger->fire('post.return.add', array(&$return_id));
     return $return_id;
 }
Example #10
0
 public function addCustomer($data)
 {
     $this->load->model('account/customer_group');
     if (empty($data['customer_group_id'])) {
         $data['customer_group_id'] = $this->config->get('customer_group_id');
     }
     $group_info = $this->model_account_customer_group->getCustomerGroup($data['customer_group_id']);
     $salt = substr(md5(uniqid(rand(), true) . $this->request->server['REMOTE_ADDR']), 0, 9);
     $data['birthdate'] = date('Y-m-d', strtotime($data['birthdate']));
     $this->query("INSERT INTO PREFIX_customer\n            SET store_id            = :store_id,\n                firstname           = :firstname,\n                middlename          = :middlename,\n                lastname            = :lastname,\n                birthdate           = :birthdate,\n                email               = :email,\n                telephone           = :telephone,\n                mobile              = :mobile,\n                gender              = :gender,\n                fax                 = :fax,\n                salt                = :salt,\n                password            = :password,\n                newsletter          = :newsletter,\n                customer_group_id   = :group_id,\n                language_id         = :language_id,\n                ip                  = :ip,\n                status              = 1,\n                approved            = :approval,\n                date_added          = :date", array('store_id' => $this->config->get('store_id'), 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'birthdate' => $data['birthdate'], 'email' => $data['email'], 'telephone' => $data['telephone'], 'mobile' => $data['mobile'], 'gender' => $data['gender'], 'fax' => $data['fax'], 'salt' => $salt, 'password' => sha1($salt . sha1($salt . sha1($data['password']))), 'newsletter' => $data['newsletter'], 'ip' => $this->request->server['REMOTE_ADDR'], 'group_id' => $data['customer_group_id'], 'language_id' => $this->config->get('language_id'), 'approval' => !$group_info['approval'], 'date' => date('Y-m-d H:i:s')));
     $customer_id = $this->lastInsertId();
     if (!$customer_id) {
         Logger::error('[ACCOUNT/CUSTOMER] The customer could not be created');
         Logger::error(print_r(self::$connection->errorInfo(), true));
         return false;
     }
     $this->query("INSERT INTO PREFIX_address\n            SET customer_id         = :id,\n                firstname           = :firstname,\n                middlename          = :middlename,\n                lastname            = :lastname,\n                company             = :company,\n                company_id          = :cid,\n                tax_id              = :tax,\n                address_1           = :address_1,\n                number              = :number,\n                addon               = :addon,\n                address_2           = :address_2,\n                postcode            = :postcode,\n                city                = :city,\n                country_id          = :country_id,\n                zone_id             = :zone_id", array('id' => $customer_id, 'firstname' => $data['firstname'], 'middlename' => $data['middlename'], 'lastname' => $data['lastname'], 'company' => $data['company'], 'cid' => $data['company_id'], 'tax' => $data['tax_id'], 'address_1' => $data['address_1'], 'number' => $data['number'], 'addon' => $data['addon'], 'address_2' => $data['address_2'], 'postcode' => $data['postcode'], 'city' => $data['city'], 'country_id' => $data['country_id'], 'zone_id' => $data['zone_id']));
     $address_id = $this->lastInsertId();
     $this->query("UPDATE PREFIX_customer SET address_id = :aid WHERE customer_id = :cid", array('aid' => $address_id, 'cid' => $customer_id));
     if ($group_info['approval']) {
         $message = Language::getVar('SUMO_ACCOUNT_WAIT_FOR_APPROVAL');
     } else {
         $message = Language::getVar('SUMO_ACCOUNT_GO_TO_LOGIN', $this->url->link('account/login', '', 'SSL'));
     }
     Mailer::setCustomer($data);
     $template = Mailer::getTemplate('account_register');
     $template['content'] = str_replace('{approvalOrLogin}', $message, $template['content']);
     Mail::setTo($data['email']);
     Mail::setSubject($template['title']);
     Mail::setHtml($template['content']);
     Mail::send();
     if ($this->config->get('admin_notify_email')) {
         $sendTo = array($this->config->get('email'));
         $extra = $this->config->get('extra_notify_email');
         if (!empty($extra)) {
             $extra = explode(',', $extra);
             foreach ($extra as $mail) {
                 if (!empty($mail) && filter_var($mail, \FILTER_VALIDATE_EMAIL)) {
                     $sendTo[] = $mail;
                 }
             }
         }
         $template = Mailer::getTemplate('account_register_admin_notify');
         if ($group_info['approval']) {
             $template['content'] = str_replace('{action}', Language::getVar('SUMO_ADMIN_ACTIVATE_ACCOUNT', $this->url->link('account/login')), $template['content']);
         } else {
             $template['content'] = str_replace('{action}', '', $template['content']);
         }
         foreach ($sendTo as $to) {
             Mail::setTo($to);
             Mail::setSubject($template['title']);
             Mail::setHtml($template['content']);
             Mail::send();
         }
     }
     Cache::removeAll();
     return $customer_id;
 }
Example #11
0
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->load_language('account/invite');
     $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/invite');
         $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
         $message = sprintf($this->language->get('text_greeting'), $this->config->get('config_name')) . "<br/>";
         $message .= $this->language->get('text_invite_link') . "<br/>";
         $message .= "<a href=" . $this->url->link('account/register', '&invitecode=' . $this->customer->getCode(), 'SSL') . ">" . $this->url->link('account/register', '&invitecode=' . $this->customer->getCode(), 'SSL') . "</a>";
         $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->setHtml(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/invite', '', '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('heading_title'), 'href' => $this->url->link('account/invite', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $this->data['action'] = $this->url->link('account/invite', '', 'SSL');
     $this->data['back'] = $this->url->link('account/login', '', 'SSL');
     $this->data['invite'] = $this->url->link('account/register', '&invitecode=' . $this->customer->getCode(), 'SSL');
     $this->history();
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/invite.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/account/invite.tpl';
     } else {
         $this->template = 'default/template/account/invite.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 #12
0
 public function update()
 {
     $this->redirect($this->url->link('account/address', '', 'SSL'));
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/address', '', 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->language->load('account/address');
     $this->document->setTitle($this->language->get('heading_title'));
     $this->load->model('account/address');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateForm()) {
         $this->model_account_address->editAddress($this->request->get['address_id'], $this->request->post);
         // Default Shipping Address
         if (isset($this->session->data['shipping_address_id']) && $this->request->get['address_id'] == $this->session->data['shipping_address_id']) {
             $this->session->data['shipping_country_id'] = $this->request->post['country_id'];
             $this->session->data['shipping_zone_id'] = $this->request->post['zone_id'];
             $this->session->data['shipping_postcode'] = $this->request->post['postcode'];
             unset($this->session->data['shipping_method']);
             unset($this->session->data['shipping_methods']);
         }
         // Default Payment Address
         if (isset($this->session->data['payment_address_id']) && $this->request->get['address_id'] == $this->session->data['payment_address_id']) {
             $this->session->data['payment_country_id'] = $this->request->post['country_id'];
             $this->session->data['payment_zone_id'] = $this->request->post['zone_id'];
             unset($this->session->data['payment_method']);
             unset($this->session->data['payment_methods']);
         }
         $this->session->data['success'] = $this->language->get('text_update');
         // send a notification message to the site administrator
         $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');
         $this->load->model('setting_email_address/setting_email_address');
         $email_address_info = $this->model_setting_email_address_setting_email_address->getEmailAddress('MODIFICARI_DATE');
         // Modificari date
         if (isset($email_address_info) && !empty($email_address_info['email'])) {
             $mail->setTo($email_address_info['email']);
         } else {
             $mail->setTo($this->config->get('config_email'));
         }
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $subject = $this->language->get('text_subject_notification');
         $message = $this->language->get('text_client') . "<strong>" . $this->customer->getAxCode() . "</strong> (" . $this->customer->getEmail() . "), ";
         $message .= $this->language->get('text_change_company_info');
         $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
         $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         //$this->redirect($this->url->link('account/address', '', 'SSL'));
         $this->redirect($this->url->link('account/account', '', 'SSL'));
     }
     $this->getForm();
 }
Example #13
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->redirect(HTTPS_SERVER . 'index.php?route=account/account');
     }
     $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()) {
         $this->language->load('mail/account_forgotten');
         $password = substr(md5(rand()), 0, 7);
         $message .= $this->language->get('text_email');
         $message .= $password;
         $message .= $this->language->get('text_footer_email');
         $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($this->language->get('text_subject_'));
         $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $this->model_account_customer->editPasswordByEmail($this->request->post['email'], $password);
         $this->session->data['success'] = $this->language->get('text_success');
         $this->redirect(HTTPS_SERVER . 'index.php?route=account/login');
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => HTTP_SERVER . 'index.php?route=common/home', 'text' => $this->language->get('text_home'), 'separator' => FALSE);
     $this->document->breadcrumbs[] = array('href' => HTTPS_SERVER . 'index.php?route=account/account', 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => HTTPS_SERVER . 'index.php?route=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'] = HTTPS_SERVER . 'index.php?route=account/forgotten';
     $this->data['back'] = HTTPS_SERVER . 'index.php?route=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/column_right', 'common/footer', 'common/column_left', 'common/header');
     $this->response->setOutput($this->render(TRUE), $this->config->get('config_compression'));
 }
 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 #15
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 #16
0
 public function index()
 {
     $this->language->load('newsletter/active');
     $this->load->model('catalog/newsletter');
     $code = $this->request->get['code'];
     $check = $this->model_catalog_newsletter->getNewsLetterVerifyCode($code);
     if ($check) {
         $newsletter_info = $this->model_catalog_newsletter->getNewsLetterbyEmail($check['email']);
         $this->model_catalog_newsletter->updateNewsLetterStatusEmail($newsletter_info['email']);
         $this->model_catalog_newsletter->deleteNewsLetterVerifyEmail($newsletter_info['email']);
         $this->data['text_desc_active'] = $this->language->get('text_desc_active');
         // HTML Mail
         $template = new Template();
         $subject = $this->language->get('text_subject');
         $template->data['title'] = $this->language->get('text_subject');
         $template->data['text_hello'] = sprintf($this->language->get('text_hello'), $newsletter_info['email'], $newsletter_info['name']);
         $template->data['text_greeting'] = $this->language->get('text_greeting');
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/verify_success.tpl')) {
             $html = $template->fetch($this->config->get('config_template') . '/template/mail/verify_success.tpl');
         } else {
             $html = $template->fetch('default/template/mail/verify_success.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($newsletter_info['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->setHtml($html);
         $mail->send();
     } else {
         $this->data['text_desc_active'] = $this->language->get('text_desc_code');
     }
     $this->document->setTitle($this->language->get('heading_title'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('href' => $this->url->link('common/home'), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('href' => $this->url->link('newsletter/confirm'), 'text' => $this->language->get('text_confirm'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['continue'] = $this->url->link('common/home');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/newsletter/active.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/newsletter/active.tpl';
     } else {
         $this->template = 'default/template/newsletter/active.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 #17
0
 public function confirm($order_id)
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($order_id);
     if ($order_info) {
         $this->load->model('localisation/language');
         $language = new Language($order_info['language_directory']);
         $language->load($order_info['language_filename']);
         $language->load('mail/voucher');
         $voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE order_id = '" . (int) $order_id . "'");
         foreach ($voucher_query->rows as $voucher) {
             // HTML Mail
             $template = new Template();
             $template->data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
             $template->data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
             $template->data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
             $template->data['text_message'] = $language->get('text_message');
             $template->data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
             $template->data['text_footer'] = $language->get('text_footer');
             if (file_exists(DIR_IMAGE . $voucher['image'])) {
                 $template->data['image'] = 'cid:' . md5(basename($voucher['image']));
             } else {
                 $template->data['image'] = '';
             }
             $template->data['store_name'] = $order_info['store_name'];
             $template->data['store_url'] = $order_info['store_url'];
             $template->data['message'] = nl2br($voucher['message']);
             if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) {
                 $html = $template->fetch($this->config->get('config_template') . '/template/mail/voucher.tpl');
             } else {
                 $html = $template->fetch('default/template/mail/voucher.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($voucher['to_email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($order_info['store_name']);
             $mail->setSubject(sprintf($language->get('text_subject'), $voucher['from_name']));
             $mail->setHtml($html);
             if (file_exists(DIR_IMAGE . $voucher['image'])) {
                 $mail->addAttachment(DIR_IMAGE . $voucher['image'], md5(basename($voucher['image'])));
             }
             $mail->send();
         }
     }
 }
Example #18
0
 public function child()
 {
     $this->language->load('comment/write');
     $this->load->model('catalog/comment');
     $json = array();
     if (strlen(utf8_decode($this->request->post['name'])) < 3 || strlen(utf8_decode($this->request->post['name'])) > 255) {
         $json['error'] = $this->language->get('error_name');
     }
     if (strlen(utf8_decode($this->request->post['text'])) < 3) {
         $json['error'] = $this->language->get('error_text');
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && !isset($json['error'])) {
         $this->model_catalog_comment->addCommentChild($this->request->post);
         $json['success'] = $this->language->get('text_success');
         $info = $this->model_catalog_comment->getComment($this->request->post['parent_id']);
         if ($this->request->post['send_mail'] == 'on' && $info['email'] != '') {
             // HTML Mail
             $email = $info['email'];
             $name = $info['name'];
             $template = new Template();
             $subject = $this->language->get('text_subject');
             $template->data['title'] = $this->language->get('text_subject');
             $template->data['text_hello'] = sprintf($this->language->get('text_hello'), $email, $name);
             $template->data['text_greeting'] = $this->language->get('text_greeting');
             $template->data['text_greeting'] .= sprintf($this->language->get('text_faq'), $info['text']);
             $template->data['text_greeting'] .= sprintf($this->language->get('text_ans'), $this->request->post['text']);
             if (file_exists(DIR_TEMPLATE . 'mail/reply_comment.tpl')) {
                 $html = $template->fetch('mail/reply_comment.tpl');
             } else {
                 $html = $template->fetch('mail/reply_comment.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($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->setHtml($html);
             $mail->send();
         }
     }
     $this->response->setOutput(json_encode($json));
 }
    public function subscribe()
    {
        $prefix_eval = "";
        $this->language->load('module/newslettersubscribe');
        $this->load->model('account/newslettersubscribe');
        if (isset($this->request->post['subscribe_email']) and filter_var($this->request->post['subscribe_email'], FILTER_VALIDATE_EMAIL)) {
            if ($this->config->get('newslettersubscribe_registered') and $this->model_account_newslettersubscribe->checkRegisteredUser($this->request->post)) {
                $this->model_account_newslettersubscribe->UpdateRegisterUsers($this->request->post, 1);
                echo '$("' . $prefix_eval . ' #notification").html("<div class=\\"success\\"> ' . $this->language->get('subscribe') . '</div>");$("' . $prefix_eval . ' #subscribe")[0].reset();';
            } else {
                if (!$this->model_account_newslettersubscribe->checkmailid($this->request->post)) {
                    $this->model_account_newslettersubscribe->subscribe($this->request->post);
                    echo '$("' . $prefix_eval . ' #notification").html("<div class=\\"success\\"> ' . $this->language->get('subscribe') . '</div>");$("' . $prefix_eval . ' #subscribe")[0].reset();';
                    if ($this->config->get('newslettersubscribe_mail_status')) {
                        $subject = $this->language->get('mail_subject');
                        $message = '<table width="60%" cellpadding="2"  cellspacing="1" border="0"> 
									 <tr>
									   <td> Email Id </td>
									   <td> ' . $this->request->post['subscribe_email'] . ' </td>
									 </tr>
									 <tr>
									   <td> Name  </td>
									   <td> ' . $this->request->post['subscribe_name'] . ' </td>
									 </tr>';
                        $message .= '</table>';
                        $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($this->config->get('config_name'));
                        $mail->setSubject($subject);
                        $mail->setHtml($message);
                        $mail->send();
                    }
                } else {
                    echo '$("' . $prefix_eval . ' #notification").html("<div class=\\"warning\\"> ' . $this->language->get('alreadyexist') . '</div>");$("' . $prefix_eval . ' #subscribe")[0].reset();';
                }
            }
        } else {
            echo '$("' . $prefix_eval . ' #notification").html("<div class=\\"warning\\"> ' . $this->language->get('error_invalid') . '</div>")';
        }
    }
 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 #21
0
 public function send($route, $output, $order_id, $order_status_id)
 {
     $this->log->write(array($route, $output));
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($order_id);
     // If order status in the complete range create any vouchers that where in the order need to be made available.
     if (in_array($order_info['order_status_id'], $this->config->get('config_complete_status'))) {
         $voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) WHERE v.order_id = '" . (int) $order_info['order_id'] . "' AND vtd.language_id = '" . (int) $order_info['language_id'] . "'");
         if ($voucher_query->num_rows) {
             // Send out any gift voucher mails
             $language = new Language($order_info['language_code']);
             $language->load($order_info['language_code']);
             $language->load('mail/voucher');
             foreach ($voucher_query->rows as $voucher) {
                 // HTML Mail
                 $data = array();
                 $data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
                 $data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
                 $data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
                 $data['text_message'] = $language->get('text_message');
                 $data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
                 $data['text_footer'] = $language->get('text_footer');
                 if (is_file(DIR_IMAGE . $voucher['image'])) {
                     $data['image'] = $this->config->get('config_url') . 'image/' . $voucher['image'];
                 } else {
                     $data['image'] = '';
                 }
                 $data['store_name'] = $order_info['store_name'];
                 $data['store_url'] = $order_info['store_url'];
                 $data['message'] = nl2br($voucher['message']);
                 $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($voucher['to_email']);
                 $mail->setFrom($this->config->get('config_email'));
                 $mail->setSender(html_entity_decode($order_info['store_name'], ENT_QUOTES, 'UTF-8'));
                 $mail->setSubject(html_entity_decode(sprintf($language->get('text_subject'), $voucher['from_name']), ENT_QUOTES, 'UTF-8'));
                 $mail->setHtml($this->load->view('mail/voucher', $data));
                 $mail->send();
             }
         }
     }
 }
Example #22
0
 public function index()
 {
     if ($this->customer->isLogged()) {
         $this->redirect($this->url->link('account/account', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'));
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $start = rand(0, 10);
         $end = rand(10, 14);
         $password = str_shuffle(substr(sha1(uniqid(mt_rand(), true) . $this->request->server['REMOTE_ADDR']), $start, $end));
         $this->model_account_customer->editPassword($this->request->post['email'], $password);
         $customerData = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
         // Get template
         Mailer::setCustomer($customerData);
         $template = Mailer::getTemplate('forgot_password_customer');
         // Add link to email
         $template['content'] = str_replace('{password}', $password, $template['content']);
         $template['content'] = str_replace('{remote_addr}', $this->request->server['REMOTE_ADDR'], $template['content']);
         Mail::setTo($customerData['email']);
         Mail::setSubject($template['title']);
         Mail::setHtml($template['content']);
         Mail::send();
         $this->session->data['success'] = Language::getVar('SUMO_ACCOUNT_PASSWORD_SENT');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_FORGOTTEN_TITLE'), 'href' => $this->url->link('account/forgotten', '', 'SSL'));
     $this->data['warning'] = '';
     if (isset($this->error['warning'])) {
         $this->data['warning'] = $this->error['warning'];
     }
     $this->data['action'] = $this->url->link('account/forgotten', '', 'SSL');
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/forgotten.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
 private function sendACREmail($customers)
 {
     $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->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     foreach ($customers as $customer) {
         if ($this->config->get('abandoned_cart_reminder_add_coupon') && ((int) $this->config->get('abandoned_cart_reminder_reward_limit') == 0 || $customer['number_reward_sent'] == 0 || (int) $this->config->get('abandoned_cart_reminder_reward_limit') > $customer['number_reward_sent'])) {
             $coupon_attached = true;
         } else {
             $coupon_attached = false;
         }
         $email_template_languages = $this->config->get('abandoned_cart_reminder_mail');
         if ($customer['acr_mail_language_id'] && isset($email_template_languages[$customer['acr_mail_language_id']]) && $this->isLanguageEnabled($customer['acr_mail_language_id'])) {
             $used_language_id = $customer['acr_mail_language_id'];
         } else {
             $used_language_id = $this->config->get('config_language_id');
         }
         $email_template = $email_template_languages[$used_language_id];
         $subject = html_entity_decode($email_template['subject'], ENT_QUOTES, 'UTF-8');
         $html = $this->getReminderHtml($customer, 'send', $coupon_attached);
         $mail->setSubject($subject);
         $mail->setTo($customer['email']);
         $mail->setHtml($html);
         $mail->send();
         echo "Reminder sent to " . $customer['email'];
         if (!$coupon_attached) {
             echo " WITHOUT COUPON (Reason: Already sent until now " . $customer['number_reward_sent'] . " coupons )";
         }
         echo "<br />";
         $this->model_module_abandoned_cart_reminder->increaseNumberReminderSent($customer['customer_id']);
         if ($coupon_attached) {
             $this->model_module_abandoned_cart_reminder->increaseNumberRewardSent($customer['customer_id']);
         }
         $this->model_module_abandoned_cart_reminder->addHistory($customer, $coupon_attached, $html);
     }
 }
Example #24
0
 public function confirm($order_id)
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($order_id);
     if ($order_info) {
         $this->load->model('localisation/language');
         $language = new Language($order_info['language_directory']);
         $language->load($order_info['language_filename']);
         $language->load('mail/voucher');
         $voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE v.order_id = '" . (int) $order_id . "'");
         foreach ($voucher_query->rows as $voucher) {
             // HTML Mail
             $data = array();
             $data['title'] = sprintf($language->get('text_subject'), $voucher['from_name']);
             $data['text_greeting'] = sprintf($language->get('text_greeting'), $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']));
             $data['text_from'] = sprintf($language->get('text_from'), $voucher['from_name']);
             $data['text_message'] = $language->get('text_message');
             $data['text_redeem'] = sprintf($language->get('text_redeem'), $voucher['code']);
             $data['text_footer'] = $language->get('text_footer');
             if (is_file(DIR_IMAGE . $voucher['image'])) {
                 $data['image'] = $this->config->get('config_url') . 'image/' . $voucher['image'];
             } else {
                 $data['image'] = '';
             }
             $data['store_name'] = $order_info['store_name'];
             $data['store_url'] = $order_info['store_url'];
             $data['message'] = nl2br($voucher['message']);
             if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/voucher.tpl')) {
                 $html = $this->load->view($this->config->get('config_template') . '/template/mail/voucher.tpl', $data);
             } else {
                 $html = $this->load->view('default/template/mail/voucher.tpl', $data);
             }
             $mail = new Mail($this->config->get('config_mail'));
             $mail->setTo($voucher['to_email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($order_info['store_name']);
             $mail->setSubject(sprintf($language->get('text_subject'), $voucher['from_name']));
             $mail->setHtml($html);
             $mail->send();
         }
     }
 }
 public function sendVoucher($voucher_id)
 {
     $voucher_info = $this->getVoucher($voucher_id);
     if ($voucher_info) {
         $this->language->load('mail/voucher');
         $template = new Template();
         $template->data['title'] = sprintf($this->language->get('text_subject'), $voucher_info['from_name']);
         $template->data['text_greeting'] = $this->language->get('text_greeting');
         $template->data['text_from'] = sprintf($this->language->get('text_from'), $voucher_info['from_name']);
         $template->data['text_message'] = $this->language->get('text_message');
         $template->data['text_redeem'] = sprintf($this->language->get('text_redeem'), $voucher_info['code']);
         $template->data['text_footer'] = $this->language->get('text_footer');
         $voucher_theme_info = $this->getVoucherTheme($voucher_info['voucher_theme_id']);
         if ($voucher_info && file_exists(DIR_IMAGE . $voucher_theme_info['image'])) {
             $template->data['image'] = HTTP_CATALOG . 'image/' . $voucher_theme_info['image'];
         } else {
             $template->data['image'] = '';
         }
         $template->data['store_name'] = $this->config->get('config_name');
         //            $template->data['store_url'] = HTTP_CATALOG;
         $template->data['store_url'] = 'http://artlook.net.ua';
         $template->data['message'] = nl2br($voucher_info['message']);
         $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($voucher_info['to_email']);
         $mail->setFrom($this->config->get('config_email'));
         $mail->setSender($this->config->get('config_name'));
         $mail->setSubject(html_entity_decode(sprintf($this->language->get('text_subject'), $voucher_info['from_name']), ENT_QUOTES, 'UTF-8'));
         $mail->setHtml($template->fetch('artlook/template/mail/voucher.tpl'));
         $mail->send();
         return true;
     }
 }
 public function sendEmail()
 {
     $json = array();
     if ($this->validate($this->request->post)) {
         unset($this->session->data['captcha']);
         $this->load->language('information/contact');
         $data['email_subject'] = sprintf($this->language->get('email_subject'), 'Informações do produto', $this->request->post['name']);
         $data['url_store'] = $this->config->get('config_url');
         $data['name_store'] = $this->config->get('config_name');
         $data['logo_store'] = $data['url_store'] . 'image/' . $this->config->get('config_logo');
         $data['email_name'] = sprintf($this->language->get('email_name'), $this->request->post['name']);
         if (isset($this->request->post['cellphone']) && $this->request->post['cellphone'] != '') {
             $data['email_cel'] = sprintf($this->language->get('email_cel'), $this->request->post['cellphone']);
         }
         $data['email_enquiry'] = sprintf($this->language->get('email_enquiry'), $this->request->post['message']);
         $data['store_url'] = $this->config->get('config_address');
         $data['store_name'] = $this->config->get('config_name');
         $data['text_powered_by'] = $this->language->get('text_powered_by');
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/mail/contact.tpl')) {
             $html = $this->load->view($this->config->get('config_template') . '/template/mail/contact.tpl', $data);
         } else {
             $html = $this->load->view('default/template/mail/contact.tpl', $data);
         }
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->request->post['email']);
         $mail->setSender($this->request->post['name']);
         $mail->setSubject(sprintf($this->language->get('email_subject'), 'Informações do produto', $this->request->post['name']));
         $mail->setHtml($html);
         $mail->setText(html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8'));
         $mail->send();
         $json['success'] = 'O e-mail enviado com sucesso! Aguarde nosso contato.';
     } else {
         $json['error'] = $this->error;
     }
     $this->response->addHeader('Content-Type: application/json');
     $this->response->setOutput(json_encode($json));
 }
Example #27
0
 public function confirm($order_id)
 {
     $this->load->model('checkout/order');
     $order_info = $this->model_checkout_order->getOrder($order_id);
     if ($order_info) {
         $this->load->model('localisation/language');
         $language = new Language($order_info['language_directory']);
         $language->load('mail/voucher');
         $voucher_query = $this->db->query("SELECT *, vtd.name AS theme FROM `" . DB_PREFIX . "voucher` v LEFT JOIN " . DB_PREFIX . "voucher_theme vt ON (v.voucher_theme_id = vt.voucher_theme_id) LEFT JOIN " . DB_PREFIX . "voucher_theme_description vtd ON (vt.voucher_theme_id = vtd.voucher_theme_id) AND vtd.language_id = '" . (int) $order_info['language_id'] . "' WHERE v.order_id = '" . (int) $order_id . "'");
         foreach ($voucher_query->rows as $voucher) {
             $data = array('recip_name' => $voucher['to_name'], 'recip_email' => $voucher['to_email'], 'store_name' => $order_info['store_name'], 'name' => $voucher['from_name'], 'amount' => $this->currency->format($voucher['amount'], $order_info['currency_code'], $order_info['currency_value']), 'message' => nl2br($voucher['message']), 'store_href' => $order_info['store_url'], 'image' => file_exists(DIR_IMAGE . $voucher['image']) ? $voucher['image'] : '', 'code' => $voucher['code']);
             $subject = $this->emailtemplate->getSubject('Voucher', 'customer_5', $data);
             $message = $this->emailtemplate->getMessage('Voucher', 'customer_5', $data);
             $mail = new Mail($this->config->get('config_mail'));
             $mail->setTo($voucher['to_email']);
             $mail->setFrom($this->config->get('config_email'));
             $mail->setSender($order_info['store_name']);
             $mail->setSubject($subject);
             $mail->setHtml($message);
             $mail->send();
         }
     }
 }
 public function sendMail()
 {
     $mail = new Mail();
     $template = new Mailtemplate();
     $template->data['mail_from'] = "GMS Travels";
     $template->data['web_url'] = "http://www.gmstravels.com";
     $template->data['logo'] = "../public/images/logo.png";
     $template->data['company_name'] = "GMS Travels";
     $template->data['text_from'] = "GMS Travels";
     $template->data['text_greeting'] = "Dear Madam/Sir";
     // $_POST['subject'];
     $template->data['text_footer'] = "Thank you";
     $template->data['message'] = $_POST['message'];
     $mail->setTo($_POST['to_email']);
     $mail->setFrom("*****@*****.**");
     $mail->setSender("GMS Travels");
     $mail->setSubject(html_entity_decode(sprintf($_POST['subject']), ENT_QUOTES, 'UTF-8'));
     $mail->setHtml($template->gettmp('../views/tmp/emailtmp.tpl'));
     if ($mail->send()) {
         return true;
     } else {
         return false;
     }
 }
Example #29
0
 public function sendMail($mail_id)
 {
     $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');
     $this->load->model('setting_email_address/setting_email_address');
     $email_address_info = $this->model_setting_email_address_setting_email_address->getEmailAddress("CASUTA_DE_EMAIL");
     // Casuta de email
     if (isset($email_address_info) && !empty($email_address_info['email'])) {
         $mail->setTo($email_address_info['email']);
     } else {
         $mail->setTo($this->config->get('config_email'));
     }
     $this->language->load('mailbox/mailbox');
     $mail_details = $this->model_mailbox_mailbox->getMailDetails($mail_id);
     $mail->setFrom($mail_details['email']);
     $mail->setSender($this->config->get('config_name'));
     $this->language->load('mailbox/mailbox');
     $subject = $this->language->get('text_message_from');
     $attachments = $mail_details['attachment'];
     $message = '';
     if (!empty($attachments)) {
         $attachment_exp = explode("#", $attachments);
         foreach ($attachment_exp as $attachment) {
             $message .= "<a href='" . HTTP_SERVER . "mail_attachment/" . $attachment . "'>" . HTTP_SERVER . "mail_attachment/" . $attachment . "</a><br>";
         }
     }
     $mail->setSubject(html_entity_decode($subject . $mail_details['name'], ENT_QUOTES, 'UTF-8'));
     $mail->setHtml(html_entity_decode($mail_details['message'] . "<br><br><br>" . $message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
 }
Example #30
0
                                                                              `date_added`  = NOW()');
            $notification->execute(array(':user_id' => $request->affiliate_user_id, ':language_id' => DEFAULT_LANGUAGE_ID, ':label' => 'activity', ':title' => 'New verification request from you affiliate', ':description' => sprintf("@%s was send a new verification request. Good job!", $request->username)));
            // Send cheers to email
            $mail_data['project_name'] = PROJECT_NAME;
            $mail_data['subject'] = sprintf('New verification request from you affiliate - %s', PROJECT_NAME);
            $mail_data['message'] = sprintf("@%s was send a new verification request. Good job!", $request->username);
            $mail_data['href_home'] = URL_BASE;
            $mail_data['href_contact'] = URL_BASE . 'contact';
            $mail_data['href_subscription'] = URL_BASE . 'subscriptions';
            $mail_data['href_facebook'] = URL_FACEBOOK;
            $mail_data['href_twitter'] = URL_TWITTER;
            $mail_data['href_tumblr'] = URL_TUMBLR;
            $mail_data['href_github'] = URL_GITHUB;
            $mail->setTo($request->affiliate_email);
            $mail->setSubject($mail_data['subject']);
            $mail->setHtml(helper_load_view('email/common.tpl', $mail_data));
            $mail->send();
            if ((double) $bitcoin->getreceivedbyaccount($address_id) != (double) $request->amount) {
                $error[] = sprintf("Amount is not match! Required amount: %s Received amount: %s", (double) $request->amount, (double) $bitcoin->getreceivedbyaccount($address_id));
            }
        }
    }
}
// Prepare output
$output = sprintf("Total: %s\n", $total_count);
$output .= sprintf("Pending: %s\n", $processed_count);
$output .= sprintf("Transactions: %s\n\n", $transaction_count);
if ($error) {
    $output .= sprintf("WARNING!\n\n");
    $output .= sprintf("%s\n", implode("\n", $error));
}