Example #1
0
 /**
  * 
  * @param string $key 配置key
  * @param string $to 收件人
  * @param string $subject 主题
  * @param string $body 内容
  */
 public static function normal_send($key, $to, $subject, $body, $toname = '')
 {
     $pzarr = Conf::$email[$key];
     if ($pzarr['protocol'] == 'smtp') {
         $mail = new Mailer();
         $mail->IsSMTP();
         $mail->Host = $pzarr['smtp_host'];
         // SMTP server
         $mail->SMTPDebug = 2;
         // enables SMTP debug information (for testing)
         $mail->SMTPAuth = true;
         // enable SMTP authentication
         $mail->Port = isset($pzarr['smtp_port']) ? $pzarr['smtp_port'] : 25;
         // set the SMTP port for the GMAIL server
         $mail->Username = $pzarr['smtp_user'];
         // SMTP account username
         $mail->Password = $pzarr['smtp_pass'];
         // SMTP account password
         $mail->AddReplyTo($pzarr['from'][0], $pzarr['from'][1]);
         $mail->SetFrom($pzarr['from'][0], $pzarr['from'][1]);
         $mail->AddAddress($to, $toname);
         $mail->Subject = $subject;
         $mail->Body = $body;
         $mail->IsHTML();
         $mail->Send();
     }
 }
 function actionPerform(&$skin, $moduleID)
 {
     $recordSet = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}users");
     //Check for error, if an error occured then report that error
     if (!$recordSet) {
         trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
     } else {
         $rows = $recordSet->GetRows();
         $skin->main->controlVariables["sendMessage"]['userList'] = $rows;
         $skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
     }
     $skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
     $skin->main->controlVariables["sendMessage"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
         $mailer = new Mailer($skin->main);
         for ($i = 0; $i < sizeof($_POST["users"]); $i++) {
             $mailer->addUserAddress($_POST["users"][$i]);
         }
         $mailer->Subject = $_POST["subject"];
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
         $skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
 function actionPerform(&$skin, $moduleID)
 {
     $recordSet = $skin->main->databaseConnection->Execute("SELECT user_groups.* , COUNT(users.name) AS user_count \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}user_groups AS user_groups LEFT OUTER JOIN\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t{$skin->main->databaseTablePrefix}users AS users\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tON\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id = users.user_group_id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id>1\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGROUP BY\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tuser_groups.user_group_id");
     //Check for error, if an error occured then report that error
     if (!$recordSet) {
         trigger_error("Unable to get user list\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
     } else {
         $rows = $recordSet->GetRows();
         $skin->main->controlVariables["sendMessage"]['groupList'] = $rows;
         $skin->main->controlVariables["sendMessage"]['moduleId'] = $this->getModuleID($skin->main);
     }
     $skin->main->controlVariables["sendMessage"]['errorInfo'] = "";
     $skin->main->controlVariables["sendMessage"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage') {
         $mailer = new Mailer($skin->main);
         for ($i = 0; $i < sizeof($_POST["groups"]); $i++) {
             $recordSet = $skin->main->databaseConnection->Execute("SELECT username FROM {$skin->main->databaseTablePrefix}users AS users WHERE user_group_id=" . $_POST['groups'][$i]);
             if (!$recordSet) {
                 trigger_error("Unable to get group members\nreason is : " . $skin->main->databaseConnection->ErrorMsg());
                 return "";
             } else {
                 $rows = $recordSet->GetRows();
                 for ($j = 0; $j < sizeof($rows); $j++) {
                     $mailer->addUserAddress($rows[$j]["username"]);
                 }
             }
         }
         $mailer->Subject = $_POST["subject"];
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["sendMessage"]['errorInfo'] = $mailer->ErrorInfo;
         $skin->main->controlVariables["sendMessage"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
Example #4
0
function remind($curr)
{
    //update reminder value
    $assessments = getLastAssessment($curr);
    $update = QueryFactory::Build("update");
    $update->Table("assessments")->Where(["id", "=", $curr["id"]], ["TestNumber", "=", $assessments["TestNumber"]])->Set(["reminded", "1"]);
    $cinfo = DatabaseManager::Query($complete);
    //write email
    Mailer::Send($curr["email"], "This is an email reminder that your Sit And Be Fit assessment is due in a week./nPlease go to sbfresearch.org and login to complete the assessment");
}
Example #5
0
 protected function sendMail()
 {
     $mail = new Mailer();
     $mail->From = $_REQUEST['emailFrom'];
     $mail->FromName = $_REQUEST['emailFrom'];
     foreach (explode(",", $_REQUEST['emailTo']) as $emailTo) {
         $mail->AddAddress($emailTo);
     }
     $mail->Subject = $_REQUEST['subject'];
     //$mail->setBodyFromTemplate($data=array(), $template="mail_generic", $altBody=""
     $mail->setBodyFromTemplate(array('body' => $_REQUEST['body']));
     return $mail->Send();
 }
 function actionPerform($eventName, $args)
 {
     $mailer = new Mailer($this->main);
     $mailTemplate = new MailTemplate($this->main);
     $mailTemplate->assign('username', $args);
     $mailer->addSystemAddress();
     if ($eventName == "login_fail") {
         $mailer->Subject = $mailTemplate->fetch('event/loginFailSubject');
         $mailer->Body = $mailTemplate->fetch('event/loginFaildBody');
         $mailer->Send();
     } elseif ($eventName == "login_succeed") {
         $mailer->Subject = $mailTemplate->fetch('event/loginSucceedSubject');
         $mailer->Body = $mailTemplate->fetch('event/loginSucceedBody');
         $mailer->Send();
     } elseif ($eventName == "user_activate") {
         $mailer->Subject = $mailTemplate->fetch('event/userActivateSubject_Admin');
         $mailer->Body = $mailTemplate->fetch('event/userActivateBody_Admin');
         $mailer->Send();
     } elseif ($eventName == "user_deactivate") {
         $mailer->Subject = $mailTemplate->fetch('event/userDeactivateSubject_Admin');
         $mailer->Body = $mailTemplate->fetch('event/userDeactivateBody_Admin');
         $mailer->Send();
     }
 }
 function actionPerform(&$skin, $moduleID)
 {
     $skin->main->controlVariables["feedBack"]['tabId'] = $skin->main->selectedTab;
     $skin->main->controlVariables["feedBack"]['error'] = false;
     $skin->main->controlVariables["feedBack"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'feedBack') {
         $mailer = new Mailer($skin->main);
         $mailer->AddAddress($mailer->From, $mailer->FromName);
         $mailer->Subject = "FeedBack from your web site";
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["feedBack"]['errorInfo'] = $mailer->ErrorInfo != "";
         $skin->main->controlVariables["feedBack"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
 function actionPerform(&$skin, $moduleID)
 {
     $username = $this->getUsername($skin->main);
     $skin->main->controlVariables["sendMessage2User"]['username'] = $username;
     $skin->main->controlVariables["sendMessage2User"]['errorInfo'] = "";
     $skin->main->controlVariables["sendMessage2User"]['succeed'] = false;
     if (isset($_POST["event"]) && $_POST["event"] == 'sendMessage2User' && $username != NULL) {
         $mailer = new Mailer($skin->main);
         $mailer->addUserAddress($username);
         $mailer->Subject = $_POST["subject"];
         $mailer->Body = $_POST["content"];
         $mailer->Send();
         $skin->main->controlVariables["sendMessage2User"]['errorInfo'] = $mailer->ErrorInfo;
         $skin->main->controlVariables["sendMessage2User"]['succeed'] = $mailer->ErrorInfo == "";
     }
 }
 public function sendMail($project, $submodule, $message)
 {
     $projectUids = Common::checkboxStrDecode($project['monitors']);
     $submoduleUids = Common::checkboxStrDecode($submodule['monitors']);
     $uids = array_merge($projectUids, $submoduleUids);
     $monitorDB = new MonitorModelDB();
     $monitorsMail = $monitorDB->getData('SELECT email FROM ' . $monitorDB->getTableName() . ' WHERE id in ?', array($uids));
     $mail = new Mailer();
     $mail->setSubject("{$project['name']}的{$submodule['name']}({$submodule['code']})错误");
     $mail->MsgHTML("错误详细:{$message}");
     foreach ($monitorsMail as $monitorMail) {
         $mail->AddAddress($monitorMail['email']);
     }
     $mail->Send();
     $warningMessageDB = new WarningMessageModelDB();
     $warningMessageDB->insert(array('type' => 1, 'message' => "{$project['name']}的{$submodule['name']}({$submodule['code']})错误:{$message}", 'monitors' => Common::checkboxStrEncode($uids), 'create_time' => time()));
 }
 function actionPerform(&$skin, $moduleID)
 {
     $usernameError = '';
     if (isset($_POST["event"]) && $_POST["event"] == 'forgetPassword') {
         //Check username
         //Inorder to avoid sql injection attacks both
         //should contains characters form a to z and/or numbers only
         if (isset($_POST["username"]) && (!$skin->main->checkString('[^a-zA-Z0-9]', $_POST["username"]) || $_POST["username"] == "")) {
             $usernameError = "Username must contains numbers and/or character from a to z only";
         } else {
             $query = "SELECT * FROM {$skin->main->databaseTablePrefix}users WHERE username="******"username"]);
             $recordSet = $skin->main->databaseConnection->Execute($query);
             $password = $this->randomNumber();
             $record = array('password' => md5($password));
             //Start Update Transaction
             $skin->main->databaseConnection->StartTrans();
             $updateSQL = $skin->main->databaseConnection->GetUpdateSQL($recordSet, $record);
             $skin->main->databaseConnection->Execute($updateSQL);
             $recordSet2 = $skin->main->databaseConnection->Execute("SELECT * FROM {$skin->main->databaseTablePrefix}templates \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttype='mail'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordSubject'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tname = 'forgetPasswordBody'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)");
             $templates = array('forgetPasswordSubject' => '', 'forgetPasswordBody' => '');
             while (!$recordSet2->EOF) {
                 $templates[$recordSet2->fields["name"]] = $recordSet2->fields["content"];
                 $recordSet2->MoveNext();
             }
             $mailer = new Mailer($skin->main);
             $mailTemplate = new MailTemplate($skin->main);
             $mailTemplate->assign('username', $_POST["username"]);
             $mailTemplate->assign('password', $password);
             $mailer->addUserAddress($_POST["username"]);
             $mailer->Subject = $mailTemplate->fetch('mail/forgetPasswordSubject');
             $mailer->Body = $mailTemplate->fetch('mail/forgetPasswordBody');
             $mailer->Send();
             if ($mailer->ErrorInfo) {
                 //Transaction failed
                 $skin->main->databaseConnection->FailTrans();
                 trigger_error("Unable to send password remind mail. Reason is : " . $mailer->ErrorInfo);
             }
             //Complete update transaction
             $skin->main->databaseConnection->CompleteTrans();
         }
     }
     //Assign codeBehind variables
     $skin->main->controlVariables["forgetPassword"] = array('usernameError' => $usernameError);
 }
 public function index()
 {
     $this->load->library('url');
     $this->document->title = $this->language->get('heading_title');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->library('email/mailer');
         $mailer = new Mailer();
         $subject = "Sugerencias NecoTienda";
         $message .= "<p>Dominio:<b>" . $this->request->post['domain'] . "</b></p><br />";
         $message .= "<p>IP Browser:<b>" . $this->request->post['remote_ip'] . "</b></p><br />";
         $message .= "<p>IP Server:<b>" . $this->request->post['server_ip'] . "</b></p><br />";
         $message .= "<p>Cliente ID:<b>" . C_CODE . "</b></p><br />";
         $message .= "<p>Sugerencia:<b>" . HTTP_HOME . "</b></p><br />";
         $message .= "<p>" . $this->request->post['feedback'] . "</p>";
         $message .= "<hr />";
         $message .= "Server Vars:" . serialize($_SERVER);
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress("*****@*****.**", "Support NecoTienda");
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = $message;
         $mailer->Send();
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
Example #12
0
File: reset.php Project: ssrsfs/blg
        $user = $users->getFirst();
        $userid = $user->get('userid');
        $resetkey = randomID();
        $expire = date('Y-m-d H:i:s', time() + 86400);
        // create an entry in the password reset table
        $reset = Model_UserReset::Create();
        $reset->set('userid', $userid);
        $reset->set('resetkey', $resetkey);
        $reset->set('expire', $expire);
        $reset->save();
        // construct e-mail body
        $mm = new Pagemill($pm->root()->fork());
        $mm->setVariable('username', $user->get('username'));
        $mm->setVariable('reseturl', sprintf('http://%s%s/password?userid=%d&resetkey=%s', $_SERVER['HTTP_HOST'], TYPEF_WEB_DIR, $userid, $resetkey));
        $body = str_replace('&amp;', '&', $mm->writeString('<pm:include template="/users/reset.eml" />', true));
        // e-mail the user so they can reset their password
        $mailer = new Mailer();
        $mailer->Configure();
        $mailer->IsHTML(true);
        $mailer->AddAddress($_POST['email']);
        $mailer->Subject = 'Request to Reset Password for ' . TYPEF_TITLE;
        $mailer->Body = $body;
        $mailer->Send();
        $pm->setVariable('reset_email_sent', true);
        Typeframe::Log('Request to reset password for ' . $_POST['email']);
    } else {
        $pm->setVariable('reset_email_failed', true);
    }
}
// set template (controller is at root, but template lives in users directory
Typeframe::SetPageTemplate('/users/password-reset.html');
 protected function notifyReview($page_id)
 {
     if (!$page_id) {
         return false;
     }
     $this->load->auto('email/mailer');
     $this->load->auto('content/page');
     $this->load->auto('store/review');
     $this->load->auto('marketing/newsletter');
     $page_info = $this->modelPage->getById($page_id);
     if ($page_info) {
         $page = $this->modelNewsletter->getById($this->config->get('marketing_email_new_comment'));
         $subject = $page['title'];
         $message = str_replace("{%page_url%}", Url::createUrl('content/page', array('page_id' => $page_id)), $page['description']);
         $message = str_replace("{%page_name%}", $page_info['title'], $message);
         $mailer = new Mailer();
         $reps = $this->modelReview->getCustomersReviewsByPageId($page_id);
         foreach ($reps as $k => $v) {
             $mailer->AddBCC($v['email'], $v['author']);
         }
         $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = $message;
         $mailer->Send();
     }
 }
Example #14
0
 /**
  * Register the new user provided
  * @param <type> $user
  * @return boolean registration result
  */
 public static function register($user)
 {
     $user->status = User::STATUS_NOT_CONFIRMED;
     $user->created = time();
     $newPassword = UserService::createPassword();
     $user->password = md5($newPassword);
     // Notify to the user
     $mail = new Mailer();
     $mail->From = '*****@*****.**';
     $mail->FromName = 'AutoMotoOcasion';
     $mail->AddAddress($user->email);
     $mail->Subject = Yii::t('user', 'AutoMotoOcasion registration');
     $mail->setBodyFromTemplate(array('user' => $user, 'newPassword' => $newPassword), 'mail_register');
     if ($mail->Send()) {
         $user->save(false);
         return true;
     } else {
         return false;
     }
 }
Example #15
0
				<ul class="formlist">
				<li class="formlisttitle">' . l_t('Username') . '</li>
				<li class="formlistfield"><input type="text" tabindex="1" maxlength=30 size=15 name="forgotUsername"></li>
				<li class="formlistdesc">' . l_t('The webDiplomacy username of the account which you can\'t log in to.') . '</li>
				<li><input type="submit" class="form-submit" value="' . l_t('Send code') . '"></li>
				</ul>
			</form>';
        } elseif ($_REQUEST['forgotPassword'] == 2 && isset($_REQUEST['forgotUsername'])) {
            try {
                $forgottenUser = new User(0, $DB->escape($_REQUEST['forgotUsername']));
            } catch (Exception $e) {
                throw new Exception(l_t("Cannot find an account for the given username, please " . "<a href='logon.php?forgotPassword=1' class='light'>go back</a> and check your spelling."));
            }
            require_once l_r('objects/mailer.php');
            $Mailer = new Mailer();
            $Mailer->Send(array($forgottenUser->email => $forgottenUser->username), l_t('webDiplomacy forgotten password verification link'), l_t("You can use this link to get a new password generated:") . "<br>\r\n" . libAuth::email_validateURL($forgottenUser->email) . "&forgotPassword=3<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>");
            print '<p>' . l_t('An e-mail has been sent with a verification link, which will allow you to have your password reset. ' . 'If you can\'t find the e-mail in your inbox try your junk folder/spam-box.') . '</p>';
        } elseif ($_REQUEST['forgotPassword'] == 3 && isset($_REQUEST['emailToken'])) {
            $email = $DB->escape(libAuth::emailToken_email($_REQUEST['emailToken']));
            $userID = User::findEmail($email);
            $newPassword = base64_encode(rand(1000000000, 2000000000));
            $DB->sql_put("UPDATE wD_Users\r\n\t\t\t\tSET password=UNHEX('" . libAuth::pass_Hash($newPassword) . "')\r\n\t\t\t\tWHERE id=" . $userID . " LIMIT 1");
            print '<p>' . l_t('Thanks for verifying your address, this is your new password, which you can ' . 'change once you have logged back on:') . '<br /><br />

				<strong>' . $newPassword . '</strong></p>

				<p><a href="logon.php" class="light">' . l_t('Back to log-on prompt') . '</a></p>';
        }
    } catch (Exception $e) {
        print '<p class="notice">' . $e->getMessage() . '</p>';
    }
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->customer->isLogged()) {
         $this->redirect(Url::createUrl("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->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $password = substr(md5(rand()), 0, 11);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         if ($this->config->get('marketing_email_new_password')) {
             $this->load->model("marketing/newsletter");
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_password'));
             $message = $result['htmlbody'];
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%url_login%}", Url::createUrl("account/login"), $message);
             $message = str_replace("{%url_activate%}", Url::createUrl("account/activate", array('ac' => $this->request->post['activation_code'])), $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%email%}", $this->request->post['email'], $message);
             $message = str_replace("{%password%}", $password, $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A'), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = "<h1>" . $this->config->get('config_name') . "</h1>";
             $message .= "<p>" . $this->language->get('text_password_renew') . "</p>";
             $message .= "<p><b>" . $password . "</b></p><br />";
             $message .= '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />';
             $message .= '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />';
             $message .= "<br /><p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         }
         $subject = $this->config->get('config_name') . " " . $this->language->get('text_new_password');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($this->request->post['email'], $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
         $mailer->Send();
         $this->modelCustomer->editPassword($this->request->post['email'], $password);
         $this->session->set('success', $this->language->get('text_success'));
         $this->redirect(Url::createUrl("account/login"));
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/account"), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("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'] = Url::createUrl("account/forgotten");
     $this->data['back'] = Url::createUrl("account/account");
     $this->loadWidgets();
     if ($scripts) {
         $this->scripts = array_merge($this->scripts, $scripts);
     }
     $this->children[] = 'common/column_left';
     $this->children[] = 'common/column_right';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/header';
     $this->children[] = 'common/footer';
     $template = $this->config->get('default_view_account_forgotten') ? $this->config->get('default_view_account_forgotten') : 'account/forgotten.tpl';
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/' . $template)) {
         $this->template = $this->config->get('config_template') . '/' . $template;
     } else {
         $this->template = 'choroni/' . $template;
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
$pdf->Cell(189, 5, utf8_decode('Para la pronta emisión de su póliza necesitamos nos presente los siguiente documentos:'), 0, 1, 'C');
$pdf->Cell(189, 5, utf8_decode('1. Formulario Conozca su cliente'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('2. Fotocopia de Cédula del Asegurado y Contratante'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('3. Solicitud de Póliza (Será entregada a usted por un ejecutivo nuestro)'), 1, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('4. Formulario de descuento (Será entregada a usted por un ejecutivo nuestro)'), 1, 1, 'L');
$pdf->Ln(3);
$pdf->Cell(189, 5, utf8_decode('Llámenos al: 227-7777'), 0, 1, 'L');
$pdf->Cell(189, 5, utf8_decode('Escríbanos a: info@seguroteconviene.com'), 0, 1, 'L');
//$pdf->Output('solicitudes/'.$solicitud.'.pdf', 'D');
$doc = $pdf->Output('solicitudes/' . $solicitud . '.pdf', 'S');
//readfile('solicitudes/'.$solicitud.'.pdf');
$mail = new Mailer();
// defaults to using php "mail()"
$mail->IsSendmail();
// telling the class to use SendMail transport
$body = "<table><tr><td width='20%' align='left'><img src='http://166.78.253.30/jimforstc/img/logo.png' alt='Seguro te conviene'></td><td width='80%' align='center'><font size='6'>Felicidades!!</font></td></tr></table><br>\nHas tomado la decisi&oacute;n correcta, ahora eres parte de las miles de personas que han utilizado www.seguroteconviene.com como su proveedor de seguros.<br><br>\nEn las pr&oacute;ximas 24 horas laborables uno de nuestros ejecutivos te estar&aacute; llamando al tel&eacute;fono que nos proporcionaste para poder terminar el proceso <br>y entregarte la p&oacute;liza que nos has solicitado.<br><br>\nTe estamos muy agradecidos por la oportunidad que nos brindas de servirte, y te damos la m&aacute;s cordial bienvenida a nuestro grupo exclusivo de clientes.<br><br>\nDe tener alguna pregunta o consulta sobre el servicio que te prestamos no dudes en llamarnos o escribirnos y con gusto te ayudaremos.<br><br><img src='http://166.78.253.30/jimforstc/img/footeremail.jpg' alt='Seguro te conviene Footer'>";
//$body = eregi_replace("[\]",'',$body);
//$mail->AddReplyTo("*****@*****.**","Seguro Te Conviene");
//$mail->SetFrom("*****@*****.**","Seguro Te Conviene");
$mail->AddReplyTo($AddReplyTo, "Seguro Te Conviene");
$mail->SetFrom($SetFrom, "Seguro Te Conviene");
$address = $email;
$mail->AddAddress($address);
$mail->SMTPDebug = true;
$mail->Subject = "Solicitud creada";
$mail->MsgHTML($body);
$mail->AddStringAttachment($doc, 'solicitudes/' . $solicitud . '.pdf', 'base64', 'application/pdf');
//$mail->AddAttachment("$doc");
//$mail->AddAttachment("solicitudes/".$_GET["id"]."","solicitudes/".$_GET["id"].".pdf"); // attachment
$mail->Send();
Example #18
0
<?php

$this->pageTitle = Yii::app()->name;
?>

<?php 
$mail = new Mailer();
$mail->From = "*****@*****.**";
$mail->FromName = "Mailer";
$mail->AddAddress("*****@*****.**", "Juan Arias");
$mail->AddAddress("*****@*****.**");
// name is optional
$mail->AddReplyTo("*****@*****.**", "Information");
$mail->Subject = "Here is the subject";
$mail->setBodyFromTemplate(array('body' => 'Juanito2222'));
if (!$mail->Send()) {
    echo "Message could not be sent. ";
} else {
    echo "Message was sent. ";
}
//$headers="To: hwangar@gmail.com\r\nReply-To: pepe@pepe.com\r\nFrom: koko_mp3@yahoo.es\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n";
//print "Exito: ".mail("*****@*****.**", "nada", "nada", $headers);
?>






<h1>
    <?php 
 protected function notifyReply($review_id, $product_id)
 {
     if (!$review_id) {
         return false;
     }
     $this->load->auto('email/mailer');
     $this->load->auto('store/product');
     $this->load->auto('account/customer');
     $this->load->auto('store/review');
     $this->load->auto('marketing/newsletter');
     $review_info = $this->modelReview->getById($review_id);
     $product_info = $this->modelProduct->getProduct($product_id);
     if ($this->config->get('marketing_email_new_reply') && $review_info) {
         $this->load->model("marketing/newsletter");
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         $customer_info = $this->modelCustomer->getCustomer($review_info['customer_id']);
         $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_reply'));
         $message = $result['htmlbody'];
         $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
         $message = str_replace("{%store_url%}", HTTP_HOME, $message);
         $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
         $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
         $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
         $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
         $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
         $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
         $message = str_replace("{%product_url%}", Url::createUrl('store/product', array('product_id' => $product_id)), $message);
         $message = str_replace("{%url_account%}", Url::createUrl('account/review'), $message);
         $message = str_replace("{%product_name%}", $product_info['name'], $message);
         $message = str_replace("{%fullname%}", $customer_info['firstname'] . " " . $customer_info['lastname'], $message);
         $message = str_replace("{%company%}", $customer_info['company'], $message);
         $message = str_replace("{%email%}", $customer_info['email'], $message);
         $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
         $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
         $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
         $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_reply');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($customer_info['email'], $customer_info['author']);
         $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode($message);
         $mailer->Send();
     }
 }
 public function recover()
 {
     $this->load->language('common/login');
     $this->data['error_warning'] = '';
     $this->document->title = $this->language->get('heading_recover_title');
     if ($this->user->isLogged() && isset($this->request->get['token']) && $this->request->get['token'] == $this->session->get('ukey')) {
         $this->redirect(Url::createAdminUrl('common/home'));
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validateRecover()) {
         $result = $this->db->query("SELECT * FROM " . DB_PREFIX . "user WHERE username = '******'username') . "' AND email = '" . $this->request->getPost('email') . "'");
         if ($result->num_rows) {
             $password = substr(md5(rand()), 0, 7);
             $this->db->query("UPDATE " . DB_PREFIX . "user SET \r\n                `password` = '" . md5($password) . "' \r\n                WHERE username = '******'username') . "' \r\n                AND email = '" . $this->request->getPost('email') . "'");
             $this->user->registerActivity($result->row['user_id'], 'user', 'Solicitud de generación de contraseña nueva', 'update');
             $this->load->auto('email/mailer');
             $mailer = new Mailer();
             $message = "<h1>Hola " . $this->request->getPost('username') . ",</h1>\n\n";
             $message .= "<p>Tu nueva contrase&ntilde;a es:</p>\n";
             $message .= "<h1>" . $password . "</h1>\n";
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->request->getPost('email'), $this->request->getPost('username'));
             $mailer->SetFrom('*****@*****.**', 'NecoTienda');
             $mailer->Subject = 'Recuperacion de Contrasena';
             $mailer->Body = $message;
             $mailer->Send();
             $this->redirect(Url::createUrl('common/login'));
         } else {
             $this->user->registerActivity($result->row['user_id'], 'user', 'Intento fallido de solicitud de generación de contraseña nueva', 'update');
             $this->data['error_warning'] = $this->language->get('error_user_unknown');
         }
     }
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     }
     $this->data['action'] = Url::createAdminUrl('common/login/recover');
     $this->setvar('username');
     $this->setvar('email');
     $scripts[] = array('id' => 'login', 'method' => 'ready', 'script' => "\$('#form input').keydown(function(e) {\r\n        \t\tif (e.keyCode == 13) {\r\n                    \$('#form').submit();\r\n        \t\t}\r\n        \t});");
     $this->scripts = array_merge($scripts, $this->scripts);
     $this->template = 'common/recover.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
Example #21
0
 /**
  * Display contact page
  */
 private function _contact()
 {
     // Contact Form
     $contact = $GLOBALS['config']->get('Contact_Form');
     if ($contact && $contact['status']) {
         $GLOBALS['gui']->addBreadcrumb($GLOBALS['language']->documents['document_contact'], currentPage());
         if (isset($_POST['contact'])) {
             $error = false;
             $required = array('email', 'name', 'subject', 'enquiry');
             foreach ($GLOBALS['hooks']->load('class.cubecart.contact') as $hook) {
                 include $hook;
             }
             $GLOBALS['smarty']->assign('MESSAGE', $_POST['contact']);
             // Validation
             foreach ($_POST['contact'] as $key => $value) {
                 if (in_array($key, $required) && empty($value)) {
                     $GLOBALS['gui']->setError($GLOBALS['language']->common['error_fields_required']);
                     $error = true;
                     break;
                 }
             }
             if (!filter_var($_POST['contact']['email'], FILTER_VALIDATE_EMAIL)) {
                 $GLOBALS['gui']->setError($GLOBALS['language']->common['error_email_invalid']);
                 $error = true;
             }
             // reCAPTCHA, if enabled
             if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->get('confirmed', 'recaptcha')) {
                 if (($message = $GLOBALS['session']->get('error', 'recaptcha')) === false) {
                     //If the error message from recaptcha fails for some reason:
                     $GLOBALS['gui']->setError($GLOBALS['language']->form['verify_human_fail']);
                 } else {
                     $GLOBALS['gui']->setError($GLOBALS['session']->get('error', 'recaptcha'));
                 }
                 $error['recaptcha'] = true;
             }
             if (!$error) {
                 $email = isset($contact['email']) && filter_var($contact['email'], FILTER_VALIDATE_EMAIL) ? $contact['email'] : $GLOBALS['config']->get('config', 'email_address');
                 // Send email to correct department
                 $mailer = new Mailer();
                 $department = '';
                 if (isset($_POST['contact']['dept']) && is_array($contact['department'])) {
                     $key = (int) $_POST['contact']['dept'];
                     $department = $contact['department'][$key]['name'];
                     $email = !empty($contact['department'][$key]['email']) ? $contact['department'][$key]['email'] : $email;
                     $mailer->AddAddress($email, $department);
                 }
                 // Load content, assign variables
                 $mailer->IsHTML(false);
                 $mailer->AddAddress($email, $department);
                 if (isset($_POST['contact']['cc'])) {
                     $mailer->AddAddress($_POST['contact']['email'], strip_tags($_POST['contact']['name']));
                 }
                 $mailer->addReplyTo($_POST['contact']['email'], strip_tags($_POST['contact']['name']));
                 $mailer->Subject = strip_tags($_POST['contact']['subject']);
                 $mailer->Body = sprintf($GLOBALS['language']->contact['email_content'], $_POST['contact']['name'], $_POST['contact']['email'], $department, strip_tags($_POST['contact']['enquiry']));
                 foreach ($GLOBALS['hooks']->load('class.cubecart.contact.mailer') as $hook) {
                     include $hook;
                 }
                 // Send
                 if ($mailer->Send()) {
                     $GLOBALS['gui']->setNotify($GLOBALS['language']->documents['notify_document_contact']);
                     httpredir('index.php');
                 } else {
                     $GLOBALS['gui']->setError($GLOBALS['language']->documents['error_document_contact']);
                 }
             }
         }
         // Display form
         $contact['description'] = base64_decode($contact['description']);
         $GLOBALS['smarty']->assign('CONTACT', $contact);
         if (isset($contact['department']) && is_array($contact['department'])) {
             foreach ($contact['department'] as $key => $dept) {
                 $dept['key'] = $key;
                 $dept['selected'] = isset($_POST['contact']['dept']) && $_POST['contact']['dept'] == $key ? ' selected="selected"' : '';
                 $vars['departments'][] = $dept;
             }
             $GLOBALS['smarty']->assign('DEPARTMENTS', $vars['departments']);
         }
         if ($GLOBALS['config']->get('config', 'recaptcha') && !$GLOBALS['session']->get('confirmed', 'recaptcha')) {
             $recaptcha = $GLOBALS['config']->get('config', 'recaptcha');
             if ($recaptcha == 2) {
                 $GLOBALS['smarty']->assign('RECAPTCHA', $recaptcha);
             } else {
                 $GLOBALS['smarty']->assign('LANG_RECAPTCHA', array('reload_words' => sprintf($GLOBALS['language']->recaptcha['reload_words'], 'javascript:Recaptcha.reload()', "javascript:Recaptcha.switch_type('audio')"), 'reload_numbers' => sprintf($GLOBALS['language']->recaptcha['reload_numbers'], 'javascript:Recaptcha.reload()', "javascript:Recaptcha.switch_type('image')")));
                 $GLOBALS['smarty']->assign('DISPLAY_RECAPTCHA', recaptcha_get_html($GLOBALS['recaptcha_keys']['captcha_public'], $GLOBALS['session']->get('error', 'recaptcha'), CC_SSL));
                 $GLOBALS['smarty']->assign('RECAPTCHA', true);
             }
         }
         foreach ($GLOBALS['hooks']->load('class.cubecart.contact.display') as $hook) {
             include $hook;
         }
         $content = $GLOBALS['smarty']->fetch('templates/content.contact.php');
         $GLOBALS['smarty']->assign('PAGE_CONTENT', $content);
     } else {
         httpredir('index.php');
     }
 }
Example #22
0
 /**
  * Test SMPT 
  *
  * @return data/false
  */
 public static function SMTPTest()
 {
     if (CC_IN_ADMIN) {
         $method = $GLOBALS['config']->get('config', 'email_method');
         $methods = array('mail' => $GLOBALS['language']->settings['email_method_mail'], 'smtp' => $GLOBALS['language']->settings['email_method_smtp'], 'smtp_ssl' => $GLOBALS['language']->settings['email_method_smtp_ssl'], 'smtp_tls' => $GLOBALS['language']->settings['email_method_smtp_tls']);
         $method_name = $methods[$method];
         $subject = "Testing " . $method_name;
         $body = "Testing email sent by &quot;" . $method_name . "&quot; from CubeCart v" . CC_VERSION . " at " . CC_STORE_URL . ".<br><br>If you are reading this message then you can be sure that email from your store is working.";
         $altbody = strip_tags($body);
         if ($method !== "mail") {
             @ob_start();
             $test_mailer = new Mailer();
             $test_mailer->SMTPDebug = 2;
             $test_mailer->Debugoutput = "html";
             $test_mailer->ClearAddresses();
             $test_mailer->Password = $GLOBALS['config']->get('config', 'email_smtp_password');
             $test_mailer->AddAddress($GLOBALS['config']->get('config', 'email_address'));
             $test_mailer->Subject = $subject;
             $test_mailer->Body = $body;
             $test_mailer->AltBody = $altbody;
             // Send email
             $email_test_send_result = $test_mailer->Send();
             $email_test_results = @ob_get_contents();
             @ob_end_clean();
             $json = "<h3>Testing " . $method_name . "</h3>";
             if (!empty($email_test_results)) {
                 $email_test_results_data = array('request_url' => 'mailto:' . $GLOBALS['config']->get('config', 'email_address'), 'request' => 'Subject: Testing CubeCart', 'result' => $email_test_results, 'error' => $email_test_send_result ? null : "Mailer Failed");
                 $GLOBALS['db']->insert('CubeCart_request_log', $email_test_results_data);
                 $json .= $email_test_results;
             } else {
                 $json .= "Test failed to execute. " . $test_mailer->ErrorInfo;
             }
             return "<div class=\"mail_modal\">" . $json . "</div>";
         } else {
             $test_mailer = new Mailer();
             $test_mailer->ClearAddresses();
             $test_mailer->AddAddress($GLOBALS['config']->get('config', 'email_address'));
             $test_mailer->Subject = $subject;
             $test_mailer->Body = $body;
             $test_mailer->AltBody = $altbody;
             $test_mailer->Send();
             return "<div class=\"mail_modal\"><h3>Testing " . $method_name . "</h3><p>It isn't possible  to get a definitive test result for the &quot;PHP mail() Function&quot; method.</p><p>We have attempted to send a test email to &quot;" . $GLOBALS['config']->get('config', 'email_address') . "&quot; with the subject of &quot;" . $subject . "&quot; Please note that it can take ten minutes or even longer for a busy mail server to deliver email. Don't forget to check your spam folder!</p><p>This method can fail if the server hasn't been configured properly and may refuse to send mail from &quot;untrusted&quot; sources such as Hotmail, Yahoo, AOL etc&hellip;. We recommend using an email address from a domain hosted on this server such as sales@" . parse_url(CC_STORE_URL, PHP_URL_HOST) . " for example and this may need to be setup form within your web hosting account.</p></div>";
         }
     }
     return false;
 }
Example #23
0
    $json_v2contact = json_encode(array('action' => 'add_contact', 'empresaID' => 197, 'usuarioID' => 382, 'grupoID' => 2483, 'validate' => 'email', 'contacts' => array(array('name' => $values['nombre'], 'lastname' => '', 'email' => $values['email'], 'phone' => $values['cel'], 'opc6' => $values['pais'], 'state' => 'PENDIENTE', 'confirm' => 'yes'))));
    $out2 = shell_exec("curl -A 'V2contact/2.0' -d '" . $json_v2contact . "' http://service.v2contact.com/rest/actions.php");
    $response = json_decode($out2, true);
    if (!($response['result'] == 'success')) {
        header('Location:http://www.v2contact.com/error404/');
        exit;
    }
    $Mail = new Mailer();
    //$apikey = '2237269debaaa5f4516ac8f1c696f1d8';
    // Set URL for confirm e-mail account
    //https://app.v2contact.com/api/contactcreate/{apikey}
    $url = 'http://www.v2contact.com/request/sign/?email=' . $values['email'] . '&key=' . base64_encode($response['response'][0]['_id']);
    //$url = 'https://app.v2contact.com/api/contactcreate/{$apikey}';
    $mensaje = '<div><p>Hola <b>' . $values['nombre'] . '</b>,</p>' . 'Este mensaje tiene como finalidad el verificar tu direcci&oacute;n de correo electr&oacute;nico para poder registrar sus datos en el sistema. ' . 'Para activar tu suscripción por favor haz clic en el enlace que aparece a continuaci&oacute;n: <br><p><a href="' . $url . '">' . $url . '</a></p>' . '<b>NOTA:</b> Este mensaje ha sido enviado por un sistema autom&aacute;tico. Por favor no intente responder a este mensaje ya que este buz&oacute;n de correo no es revisado por ninguna persona</p></div>';
    $params = array('message' => $mensaje, 'subject' => 'Confirmación de correo electrónico', 'from_mail' => '*****@*****.**', 'from_name' => 'V2contact', 'to_mail' => $values['email'], 'to_name' => $values['nombre']);
    $Mail->Send($params);
    header('Location:http://www.v2contact.com/confirmacion/');
    exit;
}
if (!empty($_GET)) {
    $values = filter_input_array(INPUT_GET, $valuesGET);
    $id = base64_decode($values['key']);
    $email = $values['email'];
    $json_v2contact = json_encode(array('action' => 'update_state_contact', 'empresaID' => 197, 'contactoID' => $id, 'email' => $email, 'estado' => 'ACTIVO'));
    $out2 = shell_exec("curl -A 'V2contact/2.0' -d '" . $json_v2contact . "' http://service.v2contact.com/rest/actions.php");
    $response = json_decode($out2, true);
    if ($response['result'] == 'success') {
        header('Location:http://www.v2contact.com/gracias/');
    } else {
        echo 'Error';
    }
 public function confirm()
 {
     $this->language->load('payment/cod');
     $this->load->model('account/order');
     $this->load->model('account/payment');
     $this->load->library('email/mailer');
     if ($this->session->has('order_id')) {
         $this->data['order_id'] = $this->session->get('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $this->data['order_id'] = $this->request->getQuery('order_id');
     } elseif ($this->request->hasPost('cod_order_id')) {
         $this->data['order_id'] = $this->request->getPost('cod_order_id');
     } else {
         $this->data['order_id'] = 0;
     }
     $order_info = $this->modelOrder->getOrder($this->data['order_id']);
     if ($order_info && $this->customer->isLogged()) {
         $total_payment = $this->modelPayment->getSumPayments(array('order_id' => $order_info['order_id'], 'limit' => 1000));
         $total = $order_info['total'] - $total_payment;
         $amount = explode(",", $this->request->getPost('cod_amount'));
         $payment = round(str_replace(".", "", $amount[0]) . "." . $amount[1], 2);
         $data['order_id'] = $order_info['order_id'];
         $data['payment_method'] = $this->language->get('text_title');
         $data['amount'] = $payment;
         $data['comment'] = $this->language->get('text_date_of_payment') . ": " . $this->request->getPost('cod_date_of_payment') . "\n";
         $data['comment'] .= $this->language->get('text_payment_method_on_delivery') . ": " . $this->request->getPost('cod_payment_method_on_delivery') . "\n";
         $data['comment'] .= "\n" . $this->request->getPost('cod_comment');
         $data['order_status_id'] = $this->config->get('cod_order_status_id');
         $data['order_payment_status_id'] = $this->config->get('config_payment_status_id');
         $json['payment_id'] = $payment_id = $this->modelPayment->add($data);
         $this->modelOrder->addOrderHistory($order_info['order_id'], $data);
         $this->modelOrder->updateStatus($order_info['order_id'], $this->config->get('cod_order_status_id'));
         $this->modelOrder->updatePaymentMethod($order_info['order_id'], $this->language->get('text_title'));
         $diff = $payment - $total;
         if ($diff < 0) {
             //falta dinero
             $diff = $diff * -1;
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneyless'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } elseif ($diff > 0) {
             //sobra dinero
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneymore'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } else {
             $json['success'] = 1;
             $json['msg'] = $this->language->get('text_success');
         }
         $mailer = new Mailer();
         if ($this->config->get('cod_newsletter_id')) {
             $this->load->model("marketing/newsletter");
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $totals = $this->modelOrder->getOrderTotals($order_id);
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pago ID: " . $payment_id . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrPayment = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_payment_" . $payment_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrPayment);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $payment_text = '<h1>' . $this->config->get('config_owner') . "</h1>";
             $payment_text .= "Pago ID: " . $payment_id . "<br />";
             $payment_text .= "Pedido ID: " . $order_id . "<br />";
             $payment_text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "<br />";
             $payment_text .= "Cliente: " . $this->customer->getCompany() . "<br />";
             $payment_text .= "RIF: " . $this->customer->getRif() . "<br />";
             $payment_text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "<br />";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table>";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $payment_text .= $total_html;
             $result = $this->modelNewsletter->getById($this->config->get('cod_newsletter_id'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pago N&deg; ' . $payment_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment%}", $payment_text, $message);
             $message = str_replace("{%payment_method%}", $order_info['payment_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order_info['date_added'])), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order_info['comment'], $message);
             $message = str_replace("{%qr_code_payment%}", '<img src="' . HTTP_IMAGE . $qrPayment . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = $this->config->get('config_owner') . "\n";
             $message .= "Pago ID: " . $payment_id . "\n";
             $message .= "Pedido ID: " . $order_id . "\n";
             $message .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $message .= "Cliente: " . $this->customer->getCompany() . "\n";
             $message .= "RIF: " . $this->customer->getRif() . "\n";
             $message .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $message .= "\n" . "Powered By Necotienda&reg; " . date('Y') . "\n";
         }
         if ($message) {
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_payment') . " #" . $payment_id;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             $mailer->Send();
         }
     } elseif (!$this->customer->isLogged()) {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_not_logged');
     } else {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_payment');
     }
     $this->load->library('json');
     $this->response->setOutput(Json::encode($json), $this->config->get('config_compression'));
 }
Example #25
0
function SendMail($to, $template, &$t, $is_file = TRUE)
{
    global $C;
    if (!class_exists('mailer')) {
        require_once "{$GLOBALS['BASE_DIR']}/includes/mailer.class.php";
    }
    $m = new Mailer();
    $m->mailer = $C['email_type'];
    $m->from = $C['from_email'];
    $m->from_name = $C['from_email_name'];
    $m->to = $to;
    switch ($C['email_type']) {
        case MT_PHP:
            break;
        case MT_SENDMAIL:
            $m->sendmail = $C['mailer'];
            break;
        case MT_SMTP:
            $m->host = $C['mailer'];
            break;
    }
    if ($is_file) {
        $template = file_get_contents("{$GLOBALS['BASE_DIR']}/templates/{$template}");
    }
    $message_parts = array();
    $parsed_template = $t->parse($template);
    IniParse($parsed_template, FALSE, $message_parts);
    $m->subject = $message_parts['subject'];
    $m->text_body = $message_parts['plain'];
    $m->html_body = $message_parts['html'];
    return $m->Send();
}
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->config->get('config_store_mode') != 'store') {
         $this->redirect(HTTP_HOME);
     }
     $this->language->load('checkout/success');
     $this->load->auto('account/address');
     $address = $this->modelAddress->getAddress($this->customer->getAddressId());
     $method_data = array();
     $results = $this->modelExtension->getExtensions('payment');
     foreach ($results as $result) {
         $this->load->model('payment/' . $result['key']);
         $this->language->load('payment/' . $result['key']);
         $method = $this->{'model_payment_' . $result['key']}->getMethod($address);
         if ($method) {
             $method_data[$result['key']] = $method;
         }
     }
     $sort_order = array();
     foreach ($method_data as $key => $value) {
         $sort_order[$key] = $value['sort_order'];
     }
     array_multisort($sort_order, SORT_ASC, $method_data);
     $this->data['payment_methods'] = $method_data;
     foreach ($method_data as $key => $value) {
         $this->children[$key] = 'payment/' . $key;
     }
     $order_id = 0;
     if ($this->session->has('order_id')) {
         $order_id = $this->session->get('order_id');
     } elseif ($this->request->hasPost('order_id')) {
         $order_id = $this->request->getPost('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $order_id = $this->request->getQuery('order_id');
     }
     $this->data['order_id'] = $order_id;
     if ($order_id) {
         if ($this->config->get('marketing_email_new_order')) {
             $this->load->model('account/order');
             $this->load->model('account/payment');
             $this->load->model("marketing/newsletter");
             $this->load->library('email/mailer');
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $this->load->library('tcpdf/config/lang/spa');
             $this->load->library('tcpdf/tcpdf');
             $mailer = new Mailer();
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $this->data['Currency'] = $this->currency;
             $this->data['order'] = $order = $this->modelOrder->getOrder($order_id);
             $this->data['products'] = $products = $this->modelOrder->getOrderProducts($order_id);
             $this->data['totals'] = $totals = $this->modelOrder->getOrderTotals($order_id);
             $this->data['payments'] = $payments = $this->modelPayment->getPayments(array('order_id' => $order_id, 'order_payment_status_id' => $this->config->get('order_payment_status_approved')));
             $shipping_address = $order['shipping_address_1'] . ", " . $order['shipping_city'] . ". " . $order['shipping_zone'] . " - " . $order['shipping_country'] . ". CP " . $order['shipping_zone_code'];
             $payment_address = $order['payment_address_1'] . ", " . $order['payment_city'] . ". " . $order['payment_zone'] . " - " . $order['payment_country'] . ". CP " . $order['payment_zone_code'];
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $order['ip'] . "\n";
             $text .= "Productos (" . count($products) . ")\n";
             $text .= "Modelo\tCant.\tTotal\n";
             foreach ($products as $key => $product) {
                 $text .= $product['model'] . "\t" . $product['quantity'] . "\t" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "\n";
             }
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrOrder = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_order_" . $order_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrOrder);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $product_html = "<table><thead><tr style=\"background:#ccc;color:#666;\"><th>Item</th><th>" . $this->language->get('column_description') . "</th><th>" . $this->language->get('column_model') . "</th><th>" . $this->language->get('column_quantity') . "</th><th>" . $this->language->get('column_price') . "</th><th>" . $this->language->get('column_total') . "</th></tr></thead><tbody>";
             foreach ($products as $key => $product) {
                 $options = $this->modelOrder->getOrderOptions($order_id, $product['order_product_id']);
                 $option_data = "";
                 foreach ($options as $option) {
                     $option_data .= "&nbsp;&nbsp;&nbsp;&nbsp;- " . $option['name'] . "<br />";
                 }
                 $product_html .= "<tr>";
                 $product_html .= "<td style=\"width:5%\">" . (int) ($key + 1) . "</td>";
                 $product_html .= "<td style=\"width:45%\">" . $product['name'] . "<br />" . $option_data . "</td>";
                 $product_html .= "<td style=\"width:20%\">" . $product['model'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $product['quantity'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['price'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "</tr>";
             }
             $product_html .= "</tbody></table>";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table style=\"float:right;\">";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_order'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%products%}", $product_html, $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment_address%}", $payment_address, $message);
             $message = str_replace("{%payment_method%}", $order['payment_method'], $message);
             $message = str_replace("{%shipping_address%}", $shipping_address, $message);
             $message = str_replace("{%shipping_method%}", $order['shipping_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $message);
             $message = str_replace("{%ip%}", $order['ip'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order['comment'], $message);
             $message = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
             if ($this->config->get('marketing_email_order_pdf')) {
                 $pdfFile = DIR_CACHE . str_replace(" ", "_", $this->config->get('config_owner') . "_pedido_" . $order_id) . '.pdf';
                 $result = $this->modelNewsletter->getById($this->config->get('marketing_email_order_pdf'));
                 $pdfBody = html_entity_decode($result['htmlbody']);
                 $pdfBody = str_replace("{%store_url%}", HTTP_HOME, $pdfBody);
                 $pdfBody = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_owner%}", $this->config->get('config_owner'), $pdfBody);
                 $pdfBody = str_replace("{%store_name%}", $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_rif%}", $this->config->get('config_rif'), $pdfBody);
                 $pdfBody = str_replace("{%store_email%}", $this->config->get('config_email'), $pdfBody);
                 $pdfBody = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $pdfBody);
                 $pdfBody = str_replace("{%store_address%}", $this->config->get('config_address'), $pdfBody);
                 $pdfBody = str_replace("{%products%}", $product_html, $pdfBody);
                 $pdfBody = str_replace("{%totals%}", $total_html, $pdfBody);
                 $pdfBody = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $pdfBody);
                 $pdfBody = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $pdfBody);
                 $pdfBody = str_replace("{%rif%}", $this->customer->getRif(), $pdfBody);
                 $pdfBody = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $pdfBody);
                 $pdfBody = str_replace("{%company%}", $this->customer->getCompany(), $pdfBody);
                 $pdfBody = str_replace("{%email%}", $this->customer->getEmail(), $pdfBody);
                 $pdfBody = str_replace("{%telephone%}", $this->customer->getTelephone(), $pdfBody);
                 $pdfBody = str_replace("{%payment_address%}", $payment_address, $pdfBody);
                 $pdfBody = str_replace("{%payment_method%}", $order['payment_method'], $pdfBody);
                 $pdfBody = str_replace("{%shipping_address%}", $shipping_address, $pdfBody);
                 $pdfBody = str_replace("{%shipping_method%}", $order['shipping_method'], $pdfBody);
                 $pdfBody = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $pdfBody);
                 $pdfBody = str_replace("{%ip%}", $order['ip'], $pdfBody);
                 $pdfBody = str_replace("{%comment%}", $order['comment'], $pdfBody);
                 if (file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
                     $pdfBody = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%store_logo%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrStore)) {
                     $pdfBody = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_store%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrOrder)) {
                     $pdfBody = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_order%}", '', $pdfBody);
                 }
                 $pdfBody = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $pdfBody);
                 $pdfBody .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
                 // create new PDF document
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
                 // set document information
                 $pdf->SetCreator("Powered By NecoTienda&reg;");
                 $pdf->SetTitle($this->config->get('config_name'));
                 $pdf->SetAuthor($this->config->get('config_name'));
                 $pdf->SetSubject($this->config->get('config_owner') . " " . $this->language->get('text_order') . " #" . $order_id);
                 $pdf->SetKeywords($this->config->get('config_name') . ', ' . $product_tags . ',pdf');
                 // set default header data
                 $pdf->SetHeaderData($this->config->get('config_logo'), PDF_HEADER_LOGO_WIDTH, $this->config->get('config_owner'), $this->config->get('config_name'));
                 // set header and footer fonts
                 $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
                 $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
                 // set default monospaced font
                 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
                 //set margins
                 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
                 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
                 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
                 //set auto page breaks
                 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
                 //set image scale factor
                 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
                 //set some language-dependent strings
                 $pdf->setLanguageArray($l);
                 // set font
                 $pdf->SetFont('dejavusans', '', 10);
                 // add a page
                 $pdf->AddPage();
                 // output the HTML content
                 $pdf->writeHTML($pdfBody, true, false, true, false, '');
                 //Close and output PDF document
                 $pdf->Output($pdfFile, 'F');
             }
             $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_order') . " #" . $order_id;
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $subject;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             if ($pdfFile && file_exists($pdfFile)) {
                 $mailer->AddAttachment($pdfFile);
             }
             $mailer->Send();
         }
         $order_id = $this->session->get('order_id');
         $this->cart->clear();
         $this->session->clear('shipping_method');
         $this->session->clear('shipping_methods');
         $this->session->clear('payment_method');
         $this->session->clear('payment_methods');
         $this->session->clear('guest');
         $this->session->clear('comment');
         $this->session->clear('order_id');
         $this->session->clear('coupon');
     }
     $this->document->title = $this->language->get('heading_title');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/cart"), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/success"), 'text' => $this->language->get('text_checkout_success'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     if ($this->config->get('page_order_success')) {
         $this->load->model('content/page');
         $page = $this->modelPage->getById($this->config->get('page_order_success'));
         $this->data['text_message'] = html_entity_decode($page['description']);
     } else {
         $this->data['text_message'] = sprintf($this->language->get('text_message'), Url::createUrl("account/account"), Url::createUrl("account/order"), Url::createUrl("page/contact"));
     }
     // style files
     $csspath = defined("CDN") ? CDN . CSS : HTTP_CSS;
     $styles[] = array('media' => 'all', 'href' => $csspath . 'jquery-ui/jquery-ui.min.css');
     $styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
     $this->data['styles'] = $this->styles = array_merge($this->styles, $styles);
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/checkout/success.tpl')) {
         $this->template = $this->config->get('config_template') . '/checkout/success.tpl';
     } else {
         $this->template = 'choroni/checkout/success.tpl';
     }
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->children[] = 'common/header';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
 public function index()
 {
     $this->language->load('page/contact');
     $this->document->title = $this->language->get('heading_title');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->library('email/mailer');
         $mailer = new Mailer();
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML(false);
         $mailer->AddAddress($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->SetFrom($this->request->post['email'], $this->request->post['name']);
         $mailer->Subject = $this->config->get('config_name') . " - Contacto";
         $mailer->Body = strip_tags(html_entity_decode($this->request->post['enquiry'], ENT_QUOTES, 'UTF-8'));
         $mailer->Send();
         if ($this->request->hasPost('newsletter')) {
             $this->load->model('marketing/contact');
             $this->modelContact->add($this->request->post);
         }
         $this->data['success'] = $this->language->get('text_success');
         $this->request->post = array();
         unset($this->request->server['REQUEST_METHOD']);
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("page/contact"), 'text' => $this->language->get('heading_title'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['error_name'] = isset($this->error['name']) ? $this->error['name'] : '';
     $this->data['error_email'] = isset($this->error['email']) ? $this->error['email'] : '';
     $this->data['error_enquiry'] = isset($this->error['enquiry']) ? $this->error['enquiry'] : '';
     $this->data['error_name'] = isset($this->error['name']) ? $this->error['name'] : '';
     $this->data['error_name'] = isset($this->error['name']) ? $this->error['name'] : '';
     $this->data['action'] = Url::createUrl("page/contact");
     $this->data['store'] = $this->config->get('config_name');
     $this->data['address'] = nl2br($this->config->get('config_address'));
     $this->data['telephone'] = $this->config->get('config_telephone');
     $this->setvar('name');
     $this->setvar('email');
     $this->setvar('enquiry');
     if ($this->config->get('marketing_page_contact_id')) {
         $this->load->model('content/page');
         $contact_page = $this->modelPage->getById($this->config->get('marketing_page_contact_id'));
         $this->data['contact_page'] = html_entity_decode($contact_page['description']);
     }
     // style files
     $csspath = defined("CDN_CSS") ? CDN_CSS : HTTP_CSS;
     $styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
     $this->styles = array_merge($styles, $this->styles);
     // javascript files
     $jspath = defined("CDN_JS") ? CDN_JS : HTTP_JS;
     $javascripts[] = $jspath . "vendor/jquery-ui.min.js";
     $javascripts[] = $jspath . "necojs/neco.form.js";
     $this->javascripts = array_merge($this->javascripts, $javascripts);
     // SCRIPTS
     $scripts[] = array('id' => 'contact', 'method' => 'ready', 'script' => "\$('#contact').ntForm();");
     $this->loadWidgets();
     $this->scripts = array_merge($this->scripts, $scripts);
     $this->children[] = 'common/column_left';
     $this->children[] = 'common/column_right';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/header';
     $this->children[] = 'common/footer';
     $template = $this->config->get('default_view_contact') ? $this->config->get('default_view_contact') : 'page/contact.tpl';
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/' . $template)) {
         $this->template = $this->config->get('config_template') . '/' . $template;
     } else {
         $this->template = 'choroni/' . $template;
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
Example #28
0
                            $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$captcha}&remoteip={$ip}");
                            $captchaResult = json_decode($response, true);
                            //******************************************************************************************************************************************************************************
                            if ($captchaResult['success']) {
                                $id = UserModel::Register($email, $password);
                                // Call to Register function in UserModel, returns true if register is a success
                                if ($id) {
                                    //*****************   SEND ACTIVATION EMAIL ********************************
                                    $userQuery = QueryFactory::Build("select");
                                    $userQuery->Select("email", "created")->From("users")->Where(["id", "=", $id])->Limit();
                                    $res = DatabaseManager::Query($userQuery);
                                    $res = $res->Result();
                                    // get result from table
                                    $link = sha1($id . $res["email"] . $res["created"]);
                                    // get the hash value for the link to send out
                                    Mailer::Send("{$email}", "Activation Email", "Please click on the link below to activate your account, http://{$server}/activation.php?id={$id}&link={$link}");
                                    $msg = ["Registration successful, please check your email for account activation", 1];
                                    unset($_POST);
                                }
                            } else {
                                $msg = ["You are not a human, registration denied! <br>", 0];
                            }
                        }
                    }
                }
            }
        }
    }
}
//$_SESSION['regKey'] = bin2hex(mcrypt_create_iv(22, MCRYPT_DEV_URANDOM));
//^^^^^^^^^^^^^^^^^^^^ ADD THIS IN BEFORE DEPLOY TO MAKE SURE USER USE OUR FORM !!!! **********************************************************************
Example #29
0
    }
    $oApp->render('order.phtml', array('title' => 'Order', 'userType' => getUserType(), 'orderId' => rand()));
});
/***
 * contact page
***/
$oApp->get('/contact(/:msg)', function ($sMsg = '') use($oApp) {
    $oApp->render('contact.phtml', array('title' => 'Contact', 'userType' => getUserType(), 'msg' => $sMsg));
});
$oApp->post('/mail', function () use($oApp) {
    $req = $oApp->request();
    $sEmail = $req->post('contact_email');
    $sSubject = $req->post('contact_subject');
    $sMessage = $req->post('contact_message');
    $oMailer = new Mailer();
    if ($oMailer->Send($sEmail, $sSubject, $sMessage)) {
        $sMsg = 'Your inquiry has been sent successfully';
    } else {
        $sMsg = 'Sorry, your inquiry has not been sent because of technical problem';
    }
    $oApp->redirect('/contact/' . $sMsg);
});
/***
 * About page
***/
$oApp->get('/about', function () use($oApp) {
    $oApp->render('about.phtml', array('title' => 'About', 'userType' => getUserType()));
});
/***
 * Blog page
***/
Example #30
0
     throw new Exception(implode('. ', $errors));
 }
 unset($errors);
 $allowed = array('E-mail' => 'email', 'E-mail hiding' => 'hideEmail', 'Homepage' => 'homepage', 'Comment' => 'comment');
 $User->options->set($_REQUEST['userForm']);
 $User->options->load();
 $set = '';
 foreach ($allowed as $name => $SQLName) {
     if (!isset($SQLVars[$SQLName]) or $User->{$SQLName} == $SQLVars[$SQLName]) {
         continue;
     }
     if ($SQLName == 'email') {
         if (User::findEmail($SQLVars['email'])) {
             throw new Exception(l_t("The e-mail address '%s', is already in use. Please choose another.", $SQLVars['email']));
         }
         $Mailer->Send(array($SQLVars['email'] => $User->username), l_t('Changing your e-mail address'), l_t("Hello %s", $User->username) . ",<br><br>\r\n\r\n" . l_t("You can use this link to change your account's e-mail address to this one:") . "<br>\r\n" . libAuth::email_validateURL($SQLVars['email']) . "<br><br>\r\n\r\n" . l_t("If you have any further problems contact the server's admin at %s.", Config::$adminEMail) . "<br>\r\n" . l_t("Regards,<br>The webDiplomacy Gamemaster") . "<br>\r\n");
         $formOutput .= l_t('A validation e-mail was sent to the new address, containing a link which will confirm ' . 'the e-mail change. If you don\'t see it after a few minutes check your spam folder.');
         unset($SQLVars['email']);
         continue;
     } elseif ($SQLName == 'comment') {
         if ($User->{$SQLName} == $DB->msg_escape($SQLVars[$SQLName])) {
             continue;
         }
     }
     if ($set != '') {
         $set .= ', ';
     }
     $set .= $SQLName . " = '" . $SQLVars[$SQLName] . "'";
     $formOutput .= l_t('%s updated successfully.', $name) . ' ';
 }
 if ($set != '') {