Example #1
0
 public static function executeCronTask()
 {
     $ts_module = new TrustedShops();
     $ts_common = new TSCommon();
     $common_count = 0;
     if (is_array(TSCommon::$available_languages)) {
         $to_remove = array();
         foreach (array_keys(TSCommon::$available_languages) as $iso) {
             $alerts_infos = RatingAlert::getAlertsInformations($iso);
             ///print_r($alerts_infos);
             if ($alerts_infos != false) {
                 $common_count += count($alerts_infos);
                 foreach ($alerts_infos as $infos) {
                     $cert = Configuration::get(TSCommon::PREFIX_TABLE . 'CERTIFICATE_' . Tools::strtoupper($infos['iso']));
                     $certificate = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8($cert));
                     $subject = $ts_module->l('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->l('title_part_2');
                     $template_vars = array('{ts_id}' => $certificate['tsID'], '{button_url}' => TSCommon::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/views/img', '{rating_url}' => $ts_common->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
                     $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], null, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/../mails/');
                     if ($result) {
                         $to_remove[] = (int) $infos['id_alert'];
                     }
                 }
             }
         }
         if (count($to_remove) > 0) {
             self::removeAlerts($to_remove);
         }
     }
     return count($to_remove) == $common_count;
 }
Example #2
0
 public static function sendByMail($log)
 {
     /* Send e-mail to the shop owner only if the minimal severity level has been reached */
     if (intval(Configuration::get('PS_LOGS_BY_EMAIL')) <= intval($log->severity)) {
         Mail::Send((int) Configuration::get('PS_LANG_DEFAULT'), 'log_alert', Mail::l('Log: You have a new alert from your shop'), array(), Configuration::get('PS_SHOP_EMAIL'));
     }
 }
Example #3
0
 private function newMessage($type, $phone, $cname, $message, $email_theme, $email_param = "")
 {
     $host = Tools::getHttpHost();
     $phone = "+" . preg_replace('#\\D+#', '', $phone);
     // insert to DB
     $query = "insert into " . _DB_PREFIX_ . egmarketing::INSTALL_SQL_BD1NAME . " \r\n\t\t(`id_shop`, `host`, `type`, `phone`, `fname`, `lname`, `message`) \r\n\t\tvalues ('" . (int) $context->shop->id . "', '" . Tools::getHttpHost() . "', '" . $type . "', '" . $phone . "',\r\n\t\t\t'" . $cname . "', '" . $cname . "', '" . $message . "')";
     Db::getInstance()->execute(trim($query));
     // notify by email
     if ($email_param == "") {
         $email_param = Configuration::get('EGCALLME_EMAIL_NOTIFY');
     }
     if (trim($email_param) != "") {
         $context = Context::getContext();
         $param = array('{phone}' => $phone, '{message}' => $message, '{fname}' => $cname, '{shop_url}' => $host);
         $emails = explode(';', $email_param);
         foreach ($emails as $email) {
             Mail::Send((int) $context->language->id, $email_theme, Mail::l($type, " " . $phone . " " . $host), $param, $email, $cname, null, null, null, null, _PS_MAIL_DIR_, false, (int) $context->shop->id);
         }
     }
     // sms notification
     $sms_message = "%type %host %phone %cname %message";
     $sms_message = Meta::sprintf2($sms_message, array('host' => $host, 'type' => $type, 'phone' => $phone, 'cname' => $cname, 'message' => $message));
     //$this->sendSMS($sms_message,"79601652555",2);
     $param = array('{phone}' => str_replace('+', '', $phone), '{message}' => $message, '{fname}' => $cname, '{type}' => 'FastOrder', '{host}' => $host, '{shost}' => str_replace('.', '-', $host));
     $this->sendTelegramm($param, $sms_message);
 }
Example #4
0
 /**
  * sendConfirmationMail (This source code come from AuthControllerCore) 
  * @param Customer $customer
  * @return bool
  */
 public static function sendConfirmationMail($social_customer, $passwd)
 {
     if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL') || !Configuration::get('FSL_CUSTOMER_CREATION_EMAIL')) {
         return true;
     }
     return Mail::Send(Context::getContext()->language->id, 'social_account', Mail::l('Welcome!'), array('{provider}' => $social_customer->getProvider(), '{username}' => $social_customer->username, '{firstname}' => $social_customer->firstname, '{lastname}' => $social_customer->lastname, '{email}' => $social_customer->email, '{passwd}' => $passwd), $social_customer->email, $social_customer->firstname . ' ' . $social_customer->lastname, null, null, null, null, dirname(__FILE__) . '/../mails/');
 }
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $this->student->id;
     Mail::Send('registration::emails.message', ['student' => $this->student, 'template' => $this->template], function ($m) {
         $m->to($this->student->email);
     });
 }
Example #6
0
 public function postContact()
 {
     global $smarty, $cookie;
     session_start();
     if ($_SESSION['validate_code'] == strtolower(Tools::getRequest('validate_code'))) {
         if ($cookie->isLogged()) {
             $user = new User($cookie->id_user);
             $_POST['name'] = $user->first_name . ' ' . $user->last_name;
             $_POST['email'] = $user->email;
             if (isset($_POST['id_user'])) {
                 unset($_POST['id_user']);
             }
             $_POST['id_user'] = $user->id;
         }
         $contact = new Contact();
         $contact->copyFromPost();
         if ($contact->add()) {
             $vars = array('{name}' => $contact->name, '{subject}' => $contact->subject, '{email}' => $contact->email, '{message}' => $contact->content);
             Mail::Send('contact', $contact->subject, $vars, Configuration::get('TM_SHOP_EMAIL'));
             $this->_success = 'Your message has been successfully sent to our team.';
         } else {
             $this->_errors = $contact->_errors;
         }
     } else {
         $this->_errors[] = 'Confirmation code is error!';
     }
 }
Example #7
0
 private function newMessage($phone, $fname, $lname, $message, $context)
 {
     $host = Tools::getHttpHost();
     // insert to DB
     $query = "insert into " . _DB_PREFIX_ . egcallme::INSTALL_SQL_BD1NAME . " \n        (`id_shop`, `host`, `type`, `phone`, `fname`,`lname`, `message`) \n        values ('" . (int) $context->shop->id . "', '" . $host . "', 'callback', '" . $phone . "',\n            '" . $fname . "','" . $lname . "', '" . $message . "')";
     Db::getInstance()->execute(trim($query));
     // notify by email
     $emails_param = Configuration::get('EGCALLME_EMAIL_NOTIFY');
     if (trim($emails_param) != "") {
         $param = array('{phone}' => $phone, '{message}' => $message, '{fname}' => $fname, '{lname}' => $lname, '{host}' => $host);
         $emails = explode(';', $emails_param);
         $dir = egcallme::getModuleDir() . '/mails/';
         foreach ($emails as $email) {
             $email_theme = "email_notify";
             Mail::Send((int) $context->language->id, $email_theme, Mail::l("NEW Callback " . $phone, $this->context->language->id), $param, trim($email), "", null, null, null, null, $dir, false, (int) $context->shop->id);
         }
         $param['{phone}'] = preg_replace('#\\D+#', '', $param['{phone}']);
         $requests = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1', 'EGCALLME_HTTPNOT_2', 'EGCALLME_HTTPNOT_3'));
         $texts = Configuration::getMultiple(array('EGCALLME_HTTPNOT_1_TXT', 'EGCALLME_HTTPNOT_2_TXT', 'EGCALLME_HTTPNOT_3_TXT'));
         foreach ($requests as $key => $request) {
             $request = $this->replaceKeywords($param, $request, $texts[$key . '_TXT']);
             $result = file_get_contents($request);
         }
     }
 }
Example #8
0
 public function sendQuestion()
 {
     if (Tools::getValue('enviar_mensaje')) {
         $params = array();
         $params['nombre'] = pSQL(Tools::getValue('nombre', ''));
         $params['email'] = pSQL(Tools::getValue('email', ''));
         $params['ciudad'] = pSQL(Tools::getValue('ciudad', ''));
         $params['provincia'] = pSQL(Tools::getValue('provincia', ''));
         $params['consulta'] = pSQL(Tools::getValue('consulta', ''));
         $params['id_producto'] = (int) Tools::getValue('id_producto', 0);
         $params['date_add'] = date('Y-m-d H:i:s', strtotime('now'));
         $params['validado'] = 0;
         DB::getInstance()->insert('lgconsultas', $params);
         $id_consulta = Db::getInstance()->Insert_ID();
         if ($id_consulta) {
             $consulta = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'lgconsultas` WHERE id_consulta=' . (int) $id_consulta);
             $producto = Db::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'product_lang WHERE id_product=' . (int) $consulta['id_producto'] . ' AND id_lang=' . (int) Configuration::get('PS_LANG_DEFAULT'));
             $enlace = new Link();
             $urlproducto = $enlace->getProductLink($consulta['id_producto']);
             $templateVars = array('id_consulta' => $id_consulta, '{consulta}' => pSQL($consulta['consulta']), '{nombre}' => pSQL($consulta['nombre']), '{email}' => pSQL($consulta['email']), '{provincia}' => pSQL($consulta['provincia']), '{ciudad}' => pSQL($consulta['ciudad']), '{producto}' => $producto, '{urlproducto}' => $urlproducto);
             if (!Mail::Send((int) Configuration::get('PS_LANG_DEFAULT'), 'consulta_enviada', $this->l('You have received a new question about a product'), $templateVars, Configuration::get('LG_CONSULTAS_EMAIL'), null, Configuration::get('LG_CONSULTAS_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, _PS_MODULE_DIR_ . 'lgconsultas/mails/')) {
                 $out = array('status' => 'nok', 'msg' => $this->l('An error occurred while sending your question'));
             } else {
                 $out = array('status' => 'ok', 'msg' => $this->l('Your question has been sent'));
             }
         } else {
             $out = array('status' => 'nok', 'msg' => $this->l('An error occurred while trying to add your question'));
         }
         echo Tools::jsonEncode($out);
         die;
     }
 }
 public function initContent()
 {
     $this->display_column_left = true;
     $docsgjveyls = "module";
     parent::initContent();
     ${$docsgjveyls} = new AgilePaypal();
     foreach ($this->context->cart->getProducts() as $key => $prod) {
         $product_list_html = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $this->context->cart->getProducts());
         $id_land = $this->context->language->id;
         // get current language id , if you are in order page you can use this
         $template_name = 'order_conf_2';
         // this is file name here the file name is test.html
         $title = "New Paypal Order";
         // mail title
         $templateVars['{firstname}'] = "Guiding-you Administrator";
         $templateVars['{lastname}'] = '';
         $templateVars['{email}'] = "email address";
         $templateVars['{passwd}'] = "password";
         $templateVars['{payment}'] = "Agile Paypal";
         $templateVars['{date}'] = date('Y-m-d h:i:s');
         $templateVars['{products}'] = $product_list_html;
         $templateVars['{total_products}'] = $prod['cart_quantity'];
         $templateVars['{total_paid}'] = $prod['total'];
         $templateVars['{customer_id}'] = $this->context->customer->id;
         $templateVars['{order_name}'] = $this->context->customer->firstname . ' ' . $this->context->customer->lastname;
         $to = "webmaster@guiding -you.co";
         $toName = "Guidingyou Admin";
         $from = $this->context->customer->email;
         $fromName = $this->context->customer->firstname . ' ' . $this->context->customer->lastname;
         Mail::Send($id_land, $template_name, $title, $templateVars, $to, $toName, $from, $fromName);
     }
     $module->agilepaypal_redirect();
     $this->setTemplate("redirect.tpl");
 }
Example #10
0
 /**
  * Send an email notification to the site admin
  * @param string $subject The subject of the alert email
  * @param string $body The body of the message for the alert email
  * @return void sends an alert email to site admin
  */
 static function Alert($subject, $body)
 {
     App::LoadClass('Mail');
     $mail = new Mail();
     $mail->subject = $subject;
     $mail->body = $body;
     $mail->Send(Settings::Get('admin_email'));
 }
 /**
  * Start forms process
  * @see FrontController::postProcess()
  */
 public function postProcess()
 {
     if (Tools::isSubmit('email')) {
         if (!($email = Tools::getValue('email')) || !Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('Invalid e-mail address');
         } else {
             $customer = new Customer();
             $customer->getByemail($email);
             if (!Validate::isLoadedObject($customer)) {
                 $this->errors[] = Tools::displayError('There is no account registered to this e-mail address.');
             } elseif (!$customer->active) {
                 $this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
             } elseif (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
                 $this->errors[] = sprintf(Tools::displayError('You can regenerate your password only every %d minute(s)'), (int) $min_time);
             } else {
                 $mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => $this->context->link->getPageLink('password', true, null, 'token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id));
                 if (Mail::Send($this->context->language->id, 'password_query', Mail::l('Password query confirmation'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                     $this->context->smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
                 } else {
                     $this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
                 }
             }
         }
     } elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) {
         $email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer);
         if ($email) {
             $customer = new Customer();
             $customer->getByemail($email);
             if (!Validate::isLoadedObject($customer)) {
                 $this->errors[] = Tools::displayError('Customer account not found');
             } elseif (!$customer->active) {
                 $this->errors[] = Tools::displayError('You cannot regenerate the password for this account.');
             } elseif (strtotime($customer->last_passwd_gen . '+' . (int) Configuration::get('PS_PASSWD_TIME_FRONT') . ' minutes') - time() > 0) {
                 Tools::redirect('index.php?controller=authentication&error_regen_pwd');
             } else {
                 $customer->passwd = Tools::encrypt($password = Tools::passwdGen(MIN_PASSWD_LENGTH));
                 $customer->last_passwd_gen = date('Y-m-d H:i:s', time());
                 if ($customer->update()) {
                     Hook::exec('actionPasswordRenew', array('customer' => $customer, 'password' => $password));
                     $mail_params = array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password);
                     if (Mail::Send($this->context->language->id, 'password', Mail::l('Your new password'), $mail_params, $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                         $this->context->smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
                     } else {
                         $this->errors[] = Tools::displayError('Error occurred while sending the e-mail.');
                     }
                 } else {
                     $this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
                 }
             }
         } else {
             $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
         }
     } elseif (Tools::getValue('token') || Tools::getValue('id_customer')) {
         $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
     }
 }
Example #12
0
 /**
  * Assign wishlist template
  */
 public function assign()
 {
     $errors = array();
     if ($this->context->customer->isLogged()) {
         $add = Tools::getIsset('add');
         $add = empty($add) === false ? 1 : 0;
         $delete = Tools::getIsset('deleted');
         $delete = empty($delete) === false ? 1 : 0;
         $id_wishlist = Tools::getValue('id_wishlist');
         if (Tools::isSubmit('submitWishlist')) {
             if (Configuration::get('PS_TOKEN_ACTIVATED') == 1 and strcmp(Tools::getToken(), Tools::getValue('token'))) {
                 $errors[] = $this->module->l('Invalid token', 'mywishlist');
             }
             if (!sizeof($errors)) {
                 $name = Tools::getValue('name');
                 if (empty($name)) {
                     $errors[] = $this->module->l('You must specify a name.', 'mywishlist');
                 }
                 if (WishList::isExistsByNameForUser($name)) {
                     $errors[] = $this->module->l('This name is already used by another list.', 'mywishlist');
                 }
                 if (!sizeof($errors)) {
                     $wishlist = new WishList();
                     $wishlist->id_shop = $this->context->shop->id;
                     $wishlist->id_shop_group = $this->context->shop->id_shop_group;
                     $wishlist->name = $name;
                     $wishlist->id_customer = (int) $this->context->customer->id;
                     list($us, $s) = explode(' ', microtime());
                     srand($s * $us);
                     $wishlist->token = strtoupper(substr(sha1(uniqid(rand(), true) . _COOKIE_KEY_ . $this->context->customer->id), 0, 16));
                     $wishlist->add();
                     Mail::Send($this->context->language->id, 'wishlink', Mail::l('Your wishlist\'s link', $this->context->language->id), array('{wishlist}' => $wishlist->name, '{message}' => Tools::getProtocol() . htmlentities($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/blockwishlist/view.php?token=' . $wishlist->token), $this->context->customer->email, $this->context->customer->firstname . ' ' . $this->context->customer->lastname, NULL, strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, $this->module->getLocalPath() . 'mails/');
                 }
             }
         } else {
             if ($add) {
                 WishList::addCardToWishlist($this->context->customer->id, Tools::getValue('id_wishlist'), $this->context->language->id);
             } else {
                 if ($delete and empty($id_wishlist) === false) {
                     $wishlist = new WishList((int) $id_wishlist);
                     if (Validate::isLoadedObject($wishlist)) {
                         $wishlist->delete();
                     } else {
                         $errors[] = $this->module->l('Cannot delete this wishlist', 'mywishlist');
                     }
                 }
             }
         }
         $this->context->smarty->assign('wishlists', WishList::getByIdCustomer($this->context->customer->id));
         $this->context->smarty->assign('nbProducts', WishList::getInfosByIdCustomer($this->context->customer->id));
     } else {
         Tools::redirect('index.php?controller=authentication&back=' . urlencode($this->context->link->getModuleLink('blockwishlist', 'mywishlist')));
     }
     $this->context->smarty->assign(array('id_customer' => (int) $this->context->customer->id, 'errors' => $errors, 'form_link' => $errors));
     $this->setTemplate('mywishlist.tpl');
 }
Example #13
0
 public function goContact()
 {
     include_once "libmail.php";
     $m = new Mail();
     $m->From($this->email . ';admin@mir-it.info');
     $m->To(array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'));
     $m->Subject($this->subject);
     $m->Body('Отправитель: ' . $this->name . '. ' . $this->text);
     $m->Send();
 }
 public static function SendTranslateSubject($id_lang, $template, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false, $id_shop = NULL, $bcc = null)
 {
     ${"GLOBALS"}["ofwtthdu"] = "templatePath";
     ${"GLOBALS"}["waqsvhsc"] = "from";
     ${"GLOBALS"}["oljyfstsifb"] = "fileAttachment";
     ${"GLOBALS"}["ktavbwwuty"] = "die";
     ${"GLOBALS"}["pbykixc"] = "toName";
     ${"GLOBALS"}["ygkvnpurdj"] = "id_lang";
     ${"GLOBALS"}["nrxherkluqq"] = "toName";
     $pvdkehuv = "toName";
     $uiwfgerto = "fromName";
     ${"GLOBALS"}["mwjoukbjfci"] = "templatePath";
     ${"GLOBALS"}["asvlqglenan"] = "die";
     ${"GLOBALS"}["gtukoxtrtzfi"] = "modeSMTP";
     ${"GLOBALS"}["kesvwedp"] = "to";
     ${"GLOBALS"}["kdgoyhmsahxr"] = "bcc";
     $hfncmd = "id_lang";
     $wyjnsgeimx = "templatePath";
     ${"GLOBALS"}["comjqjca"] = "templateVars";
     $chllfgsuw = "from";
     ${"GLOBALS"}["ggypray"] = "id_shop";
     $ungkmvucvl = "id_shop";
     ${"GLOBALS"}["nmxbjsqu"] = "id_shop";
     $vjstsi = "fileAttachment";
     ${"GLOBALS"}["ohlqtao"] = "id_lang";
     ${"GLOBALS"}["viwpzapqypm"] = "from";
     $uebssytghjjc = "fromName";
     ${"GLOBALS"}["ffrcidosklbi"] = "fromName";
     ${"GLOBALS"}["rcvwsfnutml"] = "id_shop";
     ${"GLOBALS"}["vuhnpgm"] = "id_lang";
     ${"GLOBALS"}["qtvkxqmputu"] = "to";
     ${"GLOBALS"}["tlsoaxi"] = "modeSMTP";
     $orgwjctvwjf = "modeSMTP";
     ${"GLOBALS"}["drwyhg"] = "templateVars";
     ${"GLOBALS"}["jxxusew"] = "toName";
     $spcvktgi = "die";
     ${"GLOBALS"}["ihiiypxhojun"] = "bcc";
     $uvoidyuj = "templatePath";
     $euugydhqjd = "templatePath";
     $cimcxfmih = "to";
     switch (${${"GLOBALS"}["obburiaad"]}) {
         case "new_order":
             return Mail::Send(${${"GLOBALS"}["vuhnpgm"]}, "new_order", Mail::l('New Order'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${$cimcxfmih}, ${${"GLOBALS"}["pximfkjwj"]}, ${$chllfgsuw}, ${${"GLOBALS"}["ffrcidosklbi"]}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["gtukoxtrtzfi"]}, ${${"GLOBALS"}["ghlgsfyfdx"]}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["rcvwsfnutml"]}, ${${"GLOBALS"}["llhlusocwbt"]});
         case "fund_request":
             return Mail::Send(${${"GLOBALS"}["ohlqtao"]}, "fund_request", Mail::l('Fund request from a seller'), ${${"GLOBALS"}["drwyhg"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["nrxherkluqq"]}, ${${"GLOBALS"}["ufhhkde"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${$vjstsi}, ${${"GLOBALS"}["yuvpsy"]}, ${${"GLOBALS"}["ofwtthdu"]}, ${${"GLOBALS"}["asvlqglenan"]}, ${${"GLOBALS"}["nmxbjsqu"]}, ${${"GLOBALS"}["llhlusocwbt"]});
         case "app_selleraccount":
             return Mail::Send(${$hfncmd}, "app_selleraccount", Mail::l('Your seller account approved!'), ${${"GLOBALS"}["comjqjca"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["pbykixc"]}, ${${"GLOBALS"}["viwpzapqypm"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${${"GLOBALS"}["oljyfstsifb"]}, ${${"GLOBALS"}["yuvpsy"]}, ${$euugydhqjd}, ${${"GLOBALS"}["ktavbwwuty"]}, ${${"GLOBALS"}["cfimirivyt"]}, ${${"GLOBALS"}["llhlusocwbt"]});
         case "new_selleraccount":
             return Mail::Send(${${"GLOBALS"}["edbldrigs"]}, "new_selleraccount", Mail::l('Your seller account'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["kesvwedp"]}, ${$pvdkehuv}, ${${"GLOBALS"}["ufhhkde"]}, ${$uebssytghjjc}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["tlsoaxi"]}, ${$uvoidyuj}, ${$spcvktgi}, ${$ungkmvucvl}, ${${"GLOBALS"}["ihiiypxhojun"]});
         case "new_selleraccount_admin":
             return Mail::Send(${${"GLOBALS"}["edbldrigs"]}, "new_selleraccount_admin", Mail::l('A new seller account has been added'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["xjcxgnow"]}, ${${"GLOBALS"}["jxxusew"]}, ${${"GLOBALS"}["ufhhkde"]}, ${${"GLOBALS"}["ebejdcjwvbis"]}, ${${"GLOBALS"}["leiyninz"]}, ${$orgwjctvwjf}, ${${"GLOBALS"}["mwjoukbjfci"]}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["ggypray"]}, ${${"GLOBALS"}["llhlusocwbt"]});
         case "new_product":
             return Mail::Send(${${"GLOBALS"}["ygkvnpurdj"]}, "new_product", Mail::l('New product approval request'), ${${"GLOBALS"}["opsyefhwbkot"]}, ${${"GLOBALS"}["qtvkxqmputu"]}, ${${"GLOBALS"}["pximfkjwj"]}, ${${"GLOBALS"}["waqsvhsc"]}, ${$uiwfgerto}, ${${"GLOBALS"}["leiyninz"]}, ${${"GLOBALS"}["yuvpsy"]}, ${$wyjnsgeimx}, ${${"GLOBALS"}["mryvscjv"]}, ${${"GLOBALS"}["cfimirivyt"]}, ${${"GLOBALS"}["kdgoyhmsahxr"]});
     }
 }
Example #15
0
 private function showError($subject)
 {
     $id_lang = intval($this->_order->id_lang);
     $to = $this->_customer->email;
     $toName = $this->_customer->firstname . ' ' . $this->_customer->lastname;
     $message = new Swift_Message('[' . Configuration::get('PS_SHOP_NAME') . '] ' . $subject);
     $data = array('{lastname}' => $this->_customer->lastname, '{firstname}' => $this->_customer->firstname, '{shop_url}' => 'http://' . Tools::getHttpHost(false, true) . __PS_BASE_URI__, '{shop_name}' => Configuration::get('PS_SHOP_NAME'), '{shop_logo}' => file_exists(_PS_IMG_DIR_ . 'logo.jpg') ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_ . 'logo.jpg'))) : '', '{id_order}' => intval($this->_order->id));
     Mail::Send($id_lang, 'payment_error', $subject, $data, $to, $toName);
     // redirect to error with message
     Tools::redirectLink(__PS_BASE_URI__ . 'modules/fondy/result-error.php?message=' . urlencode($subject));
 }
 protected function sendConfirmationMail(Customer $customer)
 {
     /*
      * EU-Legal
      * Password not visible
      */
     if (!Configuration::get('PS_CUSTOMER_CREATION_EMAIL')) {
         return true;
     }
     return Mail::Send($this->context->language->id, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => '***'), $customer->email, $customer->firstname . ' ' . $customer->lastname);
 }
    public function sendCampaign()
    {
        // get abandoned cart :
        $sql = "SELECT * FROM (\n\t\tSELECT\n\t\tCONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, c.id_customer, a.id_cart, a.date_upd,a.date_add,\n\t\t\t\tIF (IFNULL(o.id_order, 'Non ordered') = 'Non ordered', IF(TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', a.`date_add`)) > 86400, 'Abandoned cart', 'Non ordered'), o.id_order) id_order, IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest\n\t\tFROM `" . _DB_PREFIX_ . "cart` a  \n\t\t\t\tJOIN `" . _DB_PREFIX_ . "customer` c ON (c.id_customer = a.id_customer)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "currency` cu ON (cu.id_currency = a.id_currency)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "carrier` ca ON (ca.id_carrier = a.id_carrier)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "orders` o ON (o.id_cart = a.id_cart)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', co.`date_add`)) < 1800)\n\t\t) AS toto WHERE id_order='Abandoned cart'";
        $currency = Context::getContext()->currency->sign;
        $defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
        $abandoned_carts = Db::getInstance()->ExecuteS($sql);
        // get all available campaigns
        $sqlCampaigns = 'SELECT * FROM `' . _DB_PREFIX_ . 'campaign` WHERE active=1';
        $allCampaigns = Db::getInstance()->ExecuteS($sqlCampaigns);
        // loop on all abandoned carts
        foreach ($abandoned_carts as $abncart) {
            // loop on all available campaigns
            foreach ($allCampaigns as $camp) {
                $cartIsOnCampaign = $this->checkIfCartIsOnCampaign($abncart['date_add'], $camp['execution_time_day'], $camp['execution_time_hour']);
                if ($cartIsOnCampaign) {
                    $id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
                    $customer = new Customer($abncart['id_customer']);
                    $cR = new CartRule($camp['id_voucher'], $id_lang);
                    $cart = new Cart($abncart['id_cart']);
                    $products = $cart->getProducts();
                    $campM = new Campaign($camp['id_campaign']);
                    if (!empty($products)) {
                        $cart_content = $campM->getCartContentHeader();
                    } else {
                        $cart_content = '';
                    }
                    foreach ($products as $prod) {
                        $p = new Product($prod['id_product'], true, $id_lang);
                        $price_no_tax = Product::getPriceStatic($p->id, false, null, 2, null, false, true, 1, false, null, $abncart['id_cart'], null, $null, true, true, null, false, false);
                        $total_no_tax = $prod['cart_quantity'] * $price_no_tax;
                        $images = Image::getImages((int) $id_lang, (int) $p->id);
                        $link = new Link();
                        $cart_content .= '<tr >
										<td align="center" ><img src="' . $link->getImageLink($p->link_rewrite, $images[0]['id_image']) . '" width="80"/></td>
										<td align="center" ><a href="' . $link->getProductLink($p) . '"/>' . $p->name . '</a></td>
										<td align="center" >' . Tools::displayprice($price_no_tax) . '</td>
										<td align="center" >' . $prod['cart_quantity'] . '</td>
										<td align="center" >' . Tools::displayprice($total_no_tax) . '</td>
									</tr>';
                    }
                    $tpl_vars = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{coupon_name}' => $cR->name, '{coupon_code}' => $cR->code, '{cart_content}' => $cart_content, '{coupon_value}' => $camp['voucher_amount_type'] == 'percent' ? $cR->reduction_percent . '%' : $currency . $cR->reduction_amount, '{coupon_valid_to}' => date('d/m/Y', strtotime($cR->date_to)), '{campaign_name}' => $camp['name']);
                    $path = _PS_ROOT_DIR_ . '/modules/superabandonedcart/mails/';
                    // send email to customer :
                    Mail::Send($id_lang, $campM->getFileName(), $camp['name'], $tpl_vars, $customer->email, null, null, null, null, null, $path, false, Context::getContext()->shop->id);
                    // Email to admin :
                    Mail::Send($id_lang, $campM->getFileName(), Mail::l(sprintf('Email sent to %s %s for campaign %s', $customer->lastname, $customer->firstname, $camp['name'])), $tpl_vars, Configuration::get('PS_SHOP_EMAIL'), null, null, null, null, null, $path, false, Context::getContext()->shop->id);
                    //	echo 'ID ' . $abncart['id_cart'];
                }
            }
        }
    }
function echomsg($message, $alert = false)
{
    $tnow = date('Y-m-d H:i:s');
    echo "\n{$tnow} - {$message}";
    if ($alert) {
        $event = 'Currency Conversion Rates Update Failed';
        $templateVars = array();
        $templateVars['{event}'] = $event;
        $templateVars['{description}'] = $message;
        $to_email = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
        @Mail::Send(1, 'alert', $event, $templateVars, $to_email, null, '*****@*****.**', 'Indusdiva.com', NULL, NULL, _PS_MAIL_DIR_, false);
    }
}
Example #19
0
 public function postEmail($data)
 {
     $validate = $this->validation($data);
     if ($validate && empty($validate['error'])) {
         $template_vars = array('{guest_name}' => $validate['name'], '{guest_phone}' => $validate['phone']);
         $shop_email = strval(Configuration::get('PS_SHOP_EMAIL'));
         if (Mail::Send($this->context->language->id, 'callme', Mail::l('Email Call Me', $this->context->language->id), $template_vars, $shop_email, null, null, null, null, null, dirname(__FILE__) . '/mails/', false, $this->context->shop->id)) {
             return $this->viewStatus(true);
         }
     } else {
         return $this->viewStatus(false);
     }
 }
 public function hookActionObjectCustomerUpdateAfter($params)
 {
     $data = parse_str($_SERVER['HTTP_REFERER']);
     $customer_id = $id_customer;
     $customer = new Customer($customer_id);
     $customer_status_after = strval(Tools::getValue('active'));
     if ($this->customer_status_before != $customer_status_after && $customer_status_after === '1') {
         /*echo '<script type="text/javascript">';
         		echo 'console.log(Name:'.dirname(__FILE__).'/mails/)';
         		echo '</script>';*/
         Mail::Send($this->context->language->id, 'account_activated', Mail::l('Your account has been activated.', $this->context->language->id), array('{email}' => $customer->email, '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{shopname}' => $this->context->shop->name), $customer->email, $customer->lastname, NULL, $this->context->shop->name, NULL, NULL, dirname(__FILE__) . '/mails/');
     }
 }
Example #21
0
 public function postProcess()
 {
     global $currentIndex, $cookie;
     if (Tools::isSubmit('deleteorder_return_detail')) {
         if ($this->tabAccess['delete'] === '1') {
             if ($id_order_detail = (int) Tools::getValue('id_order_detail') and Validate::isUnsignedId($id_order_detail)) {
                 if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
                     $orderReturn = new OrderReturn($id_order_return);
                     if (!Validate::isLoadedObject($orderReturn)) {
                         die(Tools::displayError());
                     }
                     if ((int) $orderReturn->countProduct() > 1) {
                         if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, (int) Tools::getValue('id_customization', 0))) {
                             Tools::redirectAdmin($currentIndex . '&conf=4token=' . $this->token);
                         } else {
                             $this->_errors[] = Tools::displayError('An error occurred while deleting an order return detail.');
                         }
                     } else {
                         $this->_errors[] = Tools::displayError('You need at least one product.');
                     }
                 } else {
                     $this->_errors[] = Tools::displayError('The order return is invalid.');
                 }
             } else {
                 $this->_errors[] = Tools::displayError('The order return detail is invalid.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
         }
     } elseif (Tools::isSubmit('submitAddorder_return')) {
         if ($this->tabAccess['edit'] === '1') {
             if ($id_order_return = (int) Tools::getValue('id_order_return') and Validate::isUnsignedId($id_order_return)) {
                 $orderReturn = new OrderReturn($id_order_return);
                 $order = new Order($orderReturn->id_order);
                 $customer = new Customer($orderReturn->id_customer);
                 $orderReturn->state = (int) Tools::getValue('state');
                 if ($orderReturn->save()) {
                     $orderReturnState = new OrderReturnState($orderReturn->state);
                     $vars = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{order_name}' => sprintf("#%06d", (int) $order->id), '{state_order_return}' => isset($orderReturnState->name[(int) $order->id_lang]) ? $orderReturnState->name[(int) $order->id_lang] : $orderReturnState->name[(int) _PS_LANG_DEFAULT_]);
                     Mail::Send((int) $order->id_lang, 'order_return_state', Mail::l('Your order return state has changed', (int) $order->id_lang), $vars, $customer->email, $customer->firstname . ' ' . $customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true);
                     Tools::redirectAdmin($currentIndex . '&conf=4&token=' . $this->token);
                 }
             } else {
                 $this->_errors[] = Tools::displayError('No order return ID.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
         }
     }
     parent::postProcess();
 }
Example #22
0
 public function displayMain()
 {
     global $smarty, $link;
     $errors = array();
     $step = 1;
     $isExp = false;
     if (Tools::getRequest('reset') == 'passwd') {
         $step = 2;
     }
     if ($step == 1 && Tools::isSubmit('ResetPassword')) {
         $user = new User();
         $user->getByEmail(Tools::getRequest('email'));
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             $subject = 'Reset your password in' . Configuration::get('TM_SHOP_DOMAIN');
             $vars = array('{name}' => $user->first_name . ' ' . $user->last_name, '{subject}' => $subject, '{link}' => $link->getPage('PasswordView') . '?reset=passwd&id_user='******'&key=' . $md5_key);
             if (Mail::Send('passwd', $subject, $vars, $user->email)) {
                 $step = 4;
             } else {
                 $errors[] = 'Send mail fail! Pless try agen!';
             }
         } else {
             $errors[] = 'The email don\'t exists!';
         }
     } elseif ($step == 2) {
         $sign = Tools::getRequest('key');
         $id_user = Tools::getRequest('id_user');
         $user = new User($id_user);
         if (Validate::isLoadedObject($user)) {
             $md5_key = md5(_COOKIE_KEY_ . $user->email . $user->passwd . $user->upd_date);
             if ($md5_key == $sign) {
                 if (Tools::isSubmit('confrimPassword')) {
                     $user->copyFromPost();
                     if (Validate::isPasswd(Tools::getRequest('passwd')) && $user->update()) {
                         $step = 3;
                     } else {
                         $errors[] = 'This passwd is incorrect';
                     }
                 }
             } else {
                 $isExp = true;
                 $errors[] = 'This link has expired!';
             }
         } else {
             $isExp = true;
             $errors[] = 'The customer don\'t exists!';
         }
     }
     $smarty->assign(array('step' => $step, 'isExp' => $isExp, 'errors' => $errors));
     return $smarty->fetch('password.tpl');
 }
Example #23
0
 public function postProcess()
 {
     global $currentIndex, $cookie;
     if (Tools::isSubmit('deleteorder_return_detail')) {
         if ($this->tabAccess['delete'] === '1') {
             if ($id_order_detail = intval(Tools::getValue('id_order_detail')) and Validate::isUnsignedId($id_order_detail)) {
                 if ($id_order_return = intval(Tools::getValue('id_order_return')) and Validate::isUnsignedId($id_order_return)) {
                     $orderReturn = new OrderReturn($id_order_return);
                     if (!Validate::isLoadedObject($orderReturn)) {
                         die(Tools::displayError());
                     }
                     if (intval($orderReturn->countProduct()) > 1) {
                         if (OrderReturn::deleteOrderReturnDetail($id_order_return, $id_order_detail, intval(Tools::getValue('id_customization', 0)))) {
                             Tools::redirectAdmin($currentIndex . '&conf=4token=' . $this->token);
                         } else {
                             $this->_errors[] = Tools::displayError('an error occured while deleting an order return detail');
                         }
                     } else {
                         $this->_errors[] = Tools::displayError('you need at least one product');
                     }
                 } else {
                     $this->_errors[] = Tools::displayError('the order return is invalid');
                 }
             } else {
                 $this->_errors[] = Tools::displayError('the order return detail is invalid');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to delete here.');
         }
     } elseif (Tools::isSubmit('submitAddorder_return')) {
         if ($this->tabAccess['edit'] === '1') {
             if ($id_order_return = intval(Tools::getValue('id_order_return')) and Validate::isUnsignedId($id_order_return)) {
                 $orderReturn = new OrderReturn($id_order_return);
                 $customer = new Customer($orderReturn->id_customer);
                 $orderReturn->state = intval(Tools::getValue('state'));
                 if ($orderReturn->save()) {
                     $orderReturnState = new OrderReturnState($orderReturn->state);
                     $vars = array('{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{id_order_return}' => $id_order_return, '{state_order_return}' => $orderReturnState->name[intval(Configuration::get('PS_LANG_DEFAULT'))]);
                     Mail::Send(intval($cookie->id_lang), 'order_return_state', html_entity_decode($this->l('Your order return state has changed'), ENT_NOQUOTES, 'UTF-8'), $vars, $customer->email, $customer->firstname . ' ' . $customer->lastname);
                     Tools::redirectAdmin($currentIndex . '&conf=4&token=' . $this->token);
                 }
             } else {
                 $this->_errors[] = Tools::displayError('no order return ID.');
             }
         } else {
             $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
         }
     }
     parent::postProcess();
 }
 public function process()
 {
     parent::process();
     if (Tools::isSubmit('email')) {
         if (!($email = Tools::getValue('email')) or !Validate::isEmail($email)) {
             $this->errors[] = Tools::displayError('Invalid e-mail address');
         } else {
             $customer = new Customer();
             $customer->getByemail($email);
             if (!Validate::isLoadedObject($customer)) {
                 $this->errors[] = Tools::displayError('There is no account registered to this e-mail address.');
             } else {
                 if (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
                     $this->errors[] = Tools::displayError('You can regenerate your password only every') . ' ' . (int) $min_time . ' ' . Tools::displayError('minute(s)');
                 } else {
                     if (Mail::Send((int) self::$cookie->id_lang, 'password_query', Mail::l('Password query confirmation'), array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{url}' => self::$link->getPageLink('password.php', true) . '?token=' . $customer->secure_key . '&id_customer=' . (int) $customer->id), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                         self::$smarty->assign(array('confirmation' => 2, 'email' => $customer->email));
                     } else {
                         $this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
                     }
                 }
             }
         }
     } elseif (($token = Tools::getValue('token')) && ($id_customer = (int) Tools::getValue('id_customer'))) {
         $email = Db::getInstance()->getValue('SELECT `email` FROM ' . _DB_PREFIX_ . 'customer c WHERE c.`secure_key` = \'' . pSQL($token) . '\' AND c.id_customer = ' . (int) $id_customer);
         if ($email) {
             $customer = new Customer();
             $customer->getByemail($email);
             if (strtotime($customer->last_passwd_gen . '+' . (int) ($min_time = Configuration::get('PS_PASSWD_TIME_FRONT')) . ' minutes') - time() > 0) {
                 Tools::redirect('authentication.php?error_regen_pwd');
             } else {
                 $customer->passwd = Tools::encrypt($password = Tools::passwdGen((int) MIN_PASSWD_LENGTH));
                 $customer->last_passwd_gen = date('Y-m-d H:i:s', time());
                 if ($customer->update()) {
                     if (Mail::Send((int) self::$cookie->id_lang, 'password', Mail::l('Your password'), array('{email}' => $customer->email, '{lastname}' => $customer->lastname, '{firstname}' => $customer->firstname, '{passwd}' => $password), $customer->email, $customer->firstname . ' ' . $customer->lastname)) {
                         self::$smarty->assign(array('confirmation' => 1, 'email' => $customer->email));
                     } else {
                         $this->errors[] = Tools::displayError('Error occurred when sending the e-mail.');
                     }
                 } else {
                     $this->errors[] = Tools::displayError('An error occurred with your account and your new password cannot be sent to your e-mail. Please report your problem using the contact form.');
                 }
             }
         } else {
             $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
         }
     } elseif (($token = Tools::getValue('token')) || ($id_customer = Tools::getValue('id_customer'))) {
         $this->errors[] = Tools::displayError('We cannot regenerate your password with the data you submitted');
     }
 }
 public function displayFrontForm()
 {
     global $smarty;
     $error = false;
     $confirm = false;
     if (isset($_POST['submitAddtoafriend'])) {
         global $cookie, $link;
         /* Product informations */
         $product = new Product((int) Tools::getValue('id_product'), false, (int) $cookie->id_lang);
         $productLink = $link->getProductLink($product);
         /* Fields verifications */
         if (empty($_POST['email']) or empty($_POST['name'])) {
             $error = $this->l('You must fill in all fields.');
         } elseif (empty($_POST['email']) or !Validate::isEmail($_POST['email'])) {
             $error = $this->l('The e-mail given is invalid.');
         } elseif (!Validate::isName($_POST['name'])) {
             $error = $this->l('The name given is invalid.');
         } elseif (!isset($_GET['id_product']) or !is_numeric($_GET['id_product'])) {
             $error = $this->l('An error occurred during the process.');
         } else {
             /* Email generation */
             $subject = ($cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A friend')) . ' ' . $this->l('sent you a link to') . ' ' . $product->name;
             $templateVars = array('{product}' => $product->name, '{product_link}' => $productLink, '{customer}' => $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : $this->l('A friend'), '{name}' => Tools::safeOutput($_POST['name']));
             /* Email sending */
             if (!Mail::Send((int) $cookie->id_lang, 'send_to_a_friend', Mail::l('A friend sent you a link to') . ' ' . $product->name, $templateVars, $_POST['email'], NULL, $cookie->email ? $cookie->email : NULL, $cookie->customer_firstname ? $cookie->customer_firstname . ' ' . $cookie->customer_lastname : NULL, NULL, NULL, dirname(__FILE__) . '/mails/')) {
                 $error = $this->l('An error occurred during the process.');
             } else {
                 Tools::redirect(_MODULE_DIR_ . '/' . $this->name . '/sendtoafriend-form.php?id_product=' . $product->id . '&submited');
             }
         }
     } else {
         global $cookie, $link;
         /* Product informations */
         $product = new Product((int) Tools::getValue('id_product'), false, (int) $cookie->id_lang);
         $productLink = $link->getProductLink($product);
     }
     /* Image */
     $images = $product->getImages((int) $cookie->id_lang);
     foreach ($images as $k => $image) {
         if ($image['cover']) {
             $cover['id_image'] = (int) $product->id . '-' . (int) $image['id_image'];
             $cover['legend'] = $image['legend'];
         }
     }
     if (!isset($cover)) {
         $cover = array('id_image' => Language::getIsoById((int) $cookie->id_lang) . '-default', 'legend' => 'No picture');
     }
     $smarty->assign(array('cover' => $cover, 'errors' => $error, 'confirm' => $confirm, 'product' => $product, 'productLink' => $productLink));
     return $this->display(__FILE__, 'sendtoafriend.tpl');
 }
Example #26
0
 public function send_link($id, $hash, $email)
 {
     Mail::$to = $email;
     Mail::$subject = 'registr';
     Mail::$text = '
             link: <br>' . Config::get('site_name') . 'reg/activate/' . $id . '/' . $hash;
     if (Mail::Send()) {
         echo 'send true';
         exit;
     } else {
         echo 'send false';
         exit;
     }
 }
Example #27
0
 public function sendmail($req, $from, $id_lang, $template, $subject)
 {
     if (Configuration::get('PRODUCT_REQUEST_EMAIL')) {
         $to = strval(Configuration::get('PRODUCT_REQUEST_EMAIL'));
     } else {
         if (!Configuration::get('PS_MAIL_EMAIL_MESSAGE')) {
             $to = strval(Configuration::get('PS_SHOP_EMAIL'));
         } else {
             $to = new Contact((int) Configuration::get('PS_MAIL_EMAIL_MESSAGE'));
             $to = strval($to->email);
         }
     }
     Mail::Send($id_lang, $template, $subject, $req, $to, NULL, NULL, NULL, NULL, NULL, 'modules/requestsample/mails/');
 }
 private function onConversionExpired()
 {
     if (!Configuration::get('CASHWAY_SEND_EMAIL')) {
         $this->terminateReply(202, 'Ok, but not sending email per shop config.');
     }
     $order = new Order((int) $this->data->order_id);
     if (!Validate::isLoadedObject($order)) {
         $this->terminateReply(404, 'Could not find such an order.');
     }
     $customer = new Customer($order->id_customer);
     $reorder_url = $this->context->link->getPageLink('order', true, $this->context->language->id, array('submitReorder' => '1', 'id_order' => (int) $order->id));
     Mail::Send($this->context->language->id, 'conversion_expired', Mail::l('', $this->context->language->id), array('{reorder_url}' => $reorder_url), $customer->email, null, null, null, null, null, dirname(__FILE__) . '/mails/', false, $this->context->shop->id);
     $this->terminateReply(201, 'Call back email sent.');
 }
 public function hookOrderReturn($params)
 {
     $sEmail = Configuration::get('NOW_ORDER_RETURN_EMAIL');
     if (Configuration::get('NOW_ORDER_RETURN_ACTIVE') && $sEmail) {
         $oOrderReturn = $params['orderReturn'];
         $oOrder = new Order((int) $oOrderReturn->id_order);
         if (Validate::isLoadedObject($oOrderReturn)) {
             $context = Context::getContext();
             $aProducts = OrderReturn::getOrdersReturnProducts((int) $oOrderReturn->id, $oOrder);
             $aParamsEmail = array('{firstname}' => $context->customer->firstname, '{lastname}' => $context->customer->lastname, '{id_order_return}' => $oOrderReturn->id, '{id_order}' => $oOrderReturn->id_order, '{product_html}' => $this->getProductListforEmailHTML($aProducts), '{product_txt}' => $this->getProductListforEmailTXT($aProducts));
             $return = Mail::Send($context->language->id, 'order_return', Mail::l('Order Return', $context->language->id), $aParamsEmail, $sEmail, 'Administrator', $context->customer->email, $context->customer->lastname . ' - ' . $context->customer->firstname, NULL, NULL, $this->module_dir . 'mails/');
             return $return;
         }
     }
 }
Example #30
0
 public function sendAdminApprovalMail($orderId, $data)
 {
     global $cookie;
     $id_lang = $cookie->id_lang;
     $activation_link = md5(uniqid(rand(), true));
     $link = $this->context->link->getModuleLink($this->name, 'approval') . '?link=' . $activation_link;
     $sql = sprintf("update %sorders set activation_link='%s' where id_order=%d", _DB_PREFIX_, $activation_link, $orderId);
     Db::getInstance()->Execute($sql);
     $order = new Order($orderId);
     $order->getFields();
     $products = $this->context->cart->getProducts();
     $manager_email = Configuration::get('ORDER_CNF_MANAGER_EMAIL');
     $data['link'] = $link;
     Mail::Send($id_lang, 'admin_approval', $this->l('Order Approval'), $data, $manager_email, NULL, NULL, NULL, NULL, NULL, 'modules/adminorderapproval/mails/');
     return true;
 }