public static function execute(ApplicationAbstract $application) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_MessageStack = Registry::get('MessageStack'); $Qcheck = $OSCOM_PDO->prepare('select customers_id, customers_firstname, customers_lastname, customers_gender, customers_email_address, customers_password from :table_customers where customers_email_address = :customers_email_address limit 1'); $Qcheck->bindValue(':customers_email_address', $_POST['email_address']); $Qcheck->execute(); if ($Qcheck->fetch() !== false) { $password = Hash::getRandomString(ACCOUNT_PASSWORD); if (Account::savePassword($password, $Qcheck->valueInt('customers_id'))) { if (ACCOUNT_GENDER > -1) { if ($Qcheck->value('customers_gender') == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname')) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_password_reminder_body'), OSCOM::getIPAddress(), STORE_NAME, $password, STORE_OWNER_EMAIL_ADDRESS); $pEmail = new Mail($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $Qcheck->valueProtected('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_password_reminder_subject'), STORE_NAME)); $pEmail->setBodyPlain($email_text); $pEmail->send(); $OSCOM_MessageStack->add('LogIn', OSCOM::getDef('success_password_forgotten_sent'), 'success'); } OSCOM::redirect(OSCOM::getLink(null, null, 'LogIn', 'SSL')); } else { $OSCOM_MessageStack->add('PasswordForgotten', OSCOM::getDef('error_password_forgotten_no_email_address_found')); } }
public static function execute(ApplicationAbstract $application) { $OSCOM_MessageStack = Registry::get('MessageStack'); $name = HTML::sanitize($_POST['name']); $email_address = HTML::sanitize($_POST['email']); $enquiry = HTML::sanitize($_POST['enquiry']); if (filter_var($email_address, FILTER_VALIDATE_EMAIL)) { $email = new Mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $name, $email_address, OSCOM::getDef('contact_email_subject')); $email->setBodyPlain($enquiry); $email->send(); OSCOM::redirect(OSCOM::getLink(null, null, 'Contact&Success')); } else { $OSCOM_MessageStack->add('Contact', OSCOM::getDef('field_customer_email_address_check_error')); } }
/** * Send an email * * @param string $to_name The name of the recipient * @param string $to_email_address The email address of the recipient * @param string $subject The subject of the email * @param string $body The body text of the email * @param string $from_name The name of the sender * @param string $from_email_address The email address of the sender * @access public */ function osc_email($to_name, $to_email_address, $subject, $body, $from_name, $from_email_address) { if (SEND_EMAILS == '-1') { return false; } $OSCOM_Mail = new Mail($to_name, $to_email_address, $from_name, $from_email_address, $subject); $OSCOM_Mail->setBodyPlain($body); $OSCOM_Mail->send(); }
public static function execute(ApplicationAbstract $application) { $OSCOM_Customer = Registry::get('Customer'); $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $OSCOM_MessageStack = Registry::get('MessageStack'); $OSCOM_Service = Registry::get('Service'); $OSCOM_Breadcrumb = Registry::get('Breadcrumb'); if (ALLOW_GUEST_TO_TELL_A_FRIEND == '-1' && $OSCOM_Customer->isLoggedOn() === false) { $OSCOM_NavigationHistory->setSnapshot(); OSCOM::redirect(OSCOM::getLink(null, 'Account', 'LogIn', 'SSL')); } $requested_product = null; $product_check = false; if (count($_GET) > 3) { $requested_product = basename(key(array_slice($_GET, 3, 1, true))); if ($requested_product == 'Write') { unset($requested_product); if (count($_GET) > 4) { $requested_product = basename(key(array_slice($_GET, 4, 1, true))); } } } if (isset($requested_product)) { if (Product::checkEntry($requested_product)) { $product_check = true; } } if ($product_check === false) { $application->setPageContent('not_found.php'); return false; } Registry::set('Product', new Product($requested_product)); $OSCOM_Product = Registry::get('Product'); if (empty($_POST['from_name'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_customers_name_empty')); } if (!filter_var($_POST['from_email_address'] . FILTER_VALIDATE_EMAIL)) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_customers_email_address')); } if (empty($_POST['to_name'])) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_friends_name_empty')); } if (!filter_var($_POST['to_email_address'], FILTER_VALIDATE_EMAIL)) { $OSCOM_MessageStack->add('TellAFriend', OSCOM::getDef('error_tell_a_friend_invalid_friends_email_address')); } if ($OSCOM_MessageStack->size('TellAFriend') < 1) { $email_subject = sprintf(OSCOM::getDef('email_tell_a_friend_subject'), HTML::sanitize($_POST['from_name']), STORE_NAME); $email_body = sprintf(OSCOM::getDef('email_tell_a_friend_intro'), HTML::sanitize($_POST['to_name']), HTML::sanitize($_POST['from_name']), $OSCOM_Product->getTitle(), STORE_NAME) . "\n\n"; if (!empty($_POST['message'])) { $email_body .= HTML::sanitize($_POST['message']) . "\n\n"; } $email_body .= sprintf(OSCOM::getDef('email_tell_a_friend_link'), OSCOM::getLink(null, null, $OSCOM_Product->getKeyword(), 'NONSSL', false)) . "\n\n" . sprintf(OSCOM::getDef('email_tell_a_friend_signature'), STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); $pEmail = new Mail(HTML::sanitize($_POST['to_name']), HTML::sanitize($_POST['to_email_address']), HTML::sanitize($_POST['from_name']), HTML::sanitize($_POST['from_email_address']), $email_subject); $pEmail->setBodyPlain($email_body); $pEmail->send(); $OSCOM_MessageStack->add('header', sprintf(OSCOM::getDef('success_tell_a_friend_email_sent'), $OSCOM_Product->getTitle(), HTML::outputProtected($_POST['to_name'])), 'success'); OSCOM::redirect(OSCOM::getLink(null, null, $OSCOM_Product->getKeyword())); } $application->setPageTitle($OSCOM_Product->getTitle()); $application->setPageContent('tell_a_friend.php'); }
protected function sendDebugEmail() { if (strlen(MODULE_PAYMENT_PAYPAL_EXPRESS_CHECKOUT_DEBUG_EMAIL) > 0) { $email_body = '$_POST:' . "\n\n"; foreach ($_POST as $key => $value) { $email_body .= $key . '=' . $value . "\n"; } $email_body .= "\n" . '$_GET:' . "\n\n"; foreach ($_GET as $key => $value) { $email_body .= $key . '=' . $value . "\n"; } $email = new Mail(null, MODULE_PAYMENT_PAYPAL_EXPRESS_CHECKOUT_DEBUG_EMAIL, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'PayPal Express Debug E-Mail'); $email->setBodyPlain($email_body); $email->send(); } }
public static function sendEmail($id) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Currencies = Registry::get('Currencies'); $OSCOM_Language = Registry::get('Language'); $Qorder = $OSCOM_PDO->prepare('select * from :table_orders where orders_id = :orders_id limit 1'); $Qorder->bindInt(':orders_id', $id); $Qorder->execute(); if ($Qorder->fetch() !== false) { $email_order = STORE_NAME . "\n" . OSCOM::getDef('email_order_separator') . "\n" . sprintf(OSCOM::getDef('email_order_order_number'), $id) . "\n" . sprintf(OSCOM::getDef('email_order_invoice_url'), OSCOM::getLink('Shop', 'Account', 'Orders=' . $id, 'SSL', false, true, true)) . "\n" . sprintf(OSCOM::getDef('email_order_date_ordered'), DateTime::getLong()) . "\n\n" . OSCOM::getDef('email_order_products') . "\n" . OSCOM::getDef('email_order_separator') . "\n"; $Qproducts = $OSCOM_PDO->prepare('select orders_products_id, products_model, products_name, products_price, products_tax, products_quantity from :table_orders_products where orders_id = :orders_id order by orders_products_id'); $Qproducts->bindInt(':orders_id', $id); $Qproducts->execute(); while ($Qproducts->fetch()) { $email_order .= $Qproducts->valueInt('products_quantity') . ' x ' . $Qproducts->value('products_name') . ' (' . $Qproducts->value('products_model') . ') = ' . $OSCOM_Currencies->displayPriceWithTaxRate($Qproducts->value('products_price'), $Qproducts->value('products_tax'), $Qproducts->valueInt('products_quantity'), false, $Qorder->value('currency'), $Qorder->value('currency_value')) . "\n"; $Qvariants = $OSCOM_PDO->prepare('select group_title, value_title from :table_orders_products_variants where orders_id = :orders_id and orders_products_id = :orders_products_id order by id'); $Qvariants->bindInt(':orders_id', $id); $Qvariants->bindInt(':orders_products_id', $Qproducts->valueInt('orders_products_id')); $Qvariants->execute(); while ($Qvariants->fetch()) { $email_order .= "\t" . $Qvariants->value('group_title') . ': ' . $Qvariants->value('value_title') . "\n"; } } $email_order .= OSCOM::getDef('email_order_separator') . "\n"; $Qtotals = $OSCOM_PDO->prepare('select title, text from :table_orders_total where orders_id = :orders_id order by sort_order'); $Qtotals->bindInt(':orders_id', $id); $Qtotals->execute(); while ($Qtotals->fetch()) { $email_order .= strip_tags($Qtotals->value('title') . ' ' . $Qtotals->value('text')) . "\n"; } if (strlen($Qorder->value('delivery_name')) > 0 && strlen($Qorder->value('delivery_street_address')) > 0) { $address = array('name' => $Qorder->value('delivery_name'), 'company' => $Qorder->value('delivery_company'), 'street_address' => $Qorder->value('delivery_street_address'), 'suburb' => $Qorder->value('delivery_suburb'), 'city' => $Qorder->value('delivery_city'), 'state' => $Qorder->value('delivery_state'), 'zone_code' => $Qorder->value('delivery_state_code'), 'country_title' => $Qorder->value('delivery_country'), 'country_iso2' => $Qorder->value('delivery_country_iso2'), 'country_iso3' => $Qorder->value('delivery_country_iso3'), 'postcode' => $Qorder->value('delivery_postcode'), 'format' => $Qorder->value('delivery_address_format')); $email_order .= "\n" . OSCOM::getDef('email_order_delivery_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n"; } $address = array('name' => $Qorder->value('billing_name'), 'company' => $Qorder->value('billing_company'), 'street_address' => $Qorder->value('billing_street_address'), 'suburb' => $Qorder->value('billing_suburb'), 'city' => $Qorder->value('billing_city'), 'state' => $Qorder->value('billing_state'), 'zone_code' => $Qorder->value('billing_state_code'), 'country_title' => $Qorder->value('billing_country'), 'country_iso2' => $Qorder->value('billing_country_iso2'), 'country_iso3' => $Qorder->value('billing_country_iso3'), 'postcode' => $Qorder->value('billing_postcode'), 'format' => $Qorder->value('billing_address_format')); $email_order .= "\n" . OSCOM::getDef('email_order_billing_address') . "\n" . OSCOM::getDef('email_order_separator') . "\n" . Address::format($address) . "\n\n"; $Qstatus = $OSCOM_PDO->prepare('select orders_status_name from :table_orders_status where orders_status_id = :orders_status_id and language_id = :language_id'); $Qstatus->bindInt(':orders_status_id', $Qorder->valueInt('orders_status')); $Qstatus->bindInt(':language_id', $OSCOM_Language->getID()); $Qstatus->execute(); $email_order .= sprintf(OSCOM::getDef('email_order_status'), $Qstatus->value('orders_status_name')) . "\n" . OSCOM::getDef('email_order_separator') . "\n"; $Qstatuses = $OSCOM_PDO->prepare('select date_added, comments from :table_orders_status_history where orders_id = :orders_id and comments != "" order by orders_status_history_id'); $Qstatuses->bindInt(':orders_id', $id); $Qstatuses->execute(); while ($Qstatuses->fetch()) { $email_order .= DateTime::getLong($Qstatuses->value('date_added')) . "\n\t" . wordwrap(str_replace("\n", "\n\t", $Qstatuses->value('comments')), 60, "\n\t", 1) . "\n\n"; } // HPDL // if (is_object($GLOBALS[$payment])) { // $email_order .= OSCOM::getDef('email_order_payment_method') . "\n" . // OSCOM::getDef('email_order_separator') . "\n"; // $email_order .= $OSCOM_ShoppingCart->getBillingMethod('title') . "\n\n"; // if (isset($GLOBALS[$payment]->email_footer)) { // $email_order .= $GLOBALS[$payment]->email_footer . "\n\n"; // } // } $oEmail = new Mail($Qorder->value('customers_name'), $Qorder->value('customers_email_address'), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject')); $oEmail->setBodyPlain($email_order); $oEmail->send(); // send emails to other people if (SEND_EXTRA_ORDER_EMAILS_TO != '') { $oEmail = new Mail('', SEND_EXTRA_ORDER_EMAILS_TO, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, OSCOM::getDef('email_order_subject')); $oEmail->setBodyPlain($email_order); $oEmail->send(); } } }
/** * Stores a new customer account entry in the database * * @param array $data An array containing the customers information * @access public * @return boolean */ public static function createEntry($data) { $OSCOM_PDO = Registry::get('PDO'); $OSCOM_Session = Registry::get('Session'); $OSCOM_Customer = Registry::get('Customer'); $OSCOM_ShoppingCart = Registry::get('ShoppingCart'); $OSCOM_NavigationHistory = Registry::get('NavigationHistory'); $Qcustomer = $OSCOM_PDO->prepare('insert into :table_customers (customers_firstname, customers_lastname, customers_email_address, customers_newsletter, customers_status, customers_ip_address, customers_password, customers_gender, customers_dob, number_of_logons, date_account_created) values (:customers_firstname, :customers_lastname, :customers_email_address, :customers_newsletter, :customers_status, :customers_ip_address, :customers_password, :customers_gender, :customers_dob, :number_of_logons, now())'); $Qcustomer->bindValue(':customers_firstname', $data['firstname']); $Qcustomer->bindValue(':customers_lastname', $data['lastname']); $Qcustomer->bindValue(':customers_email_address', $data['email_address']); $Qcustomer->bindValue(':customers_newsletter', isset($data['newsletter']) && $data['newsletter'] == '1' ? '1' : ''); $Qcustomer->bindValue(':customers_status', '1'); $Qcustomer->bindValue(':customers_ip_address', OSCOM::getIPAddress()); $Qcustomer->bindValue(':customers_password', Hash::get($data['password'])); $Qcustomer->bindValue(':customers_gender', ACCOUNT_GENDER > -1 && isset($data['gender']) && ($data['gender'] == 'm' || $data['gender'] == 'f') ? $data['gender'] : ''); $Qcustomer->bindValue(':customers_dob', ACCOUNT_DATE_OF_BIRTH == '1' ? date('Ymd', $data['dob']) : ''); $Qcustomer->bindInt(':number_of_logons', 0); $Qcustomer->execute(); if ($Qcustomer->rowCount() === 1) { $customer_id = $OSCOM_PDO->lastInsertId(); if (SERVICE_SESSION_REGENERATE_ID == '1') { $OSCOM_Session->recreate(); } $OSCOM_Customer->setCustomerData($customer_id); // restore cart contents $OSCOM_ShoppingCart->synchronizeWithDatabase(); $OSCOM_NavigationHistory->removeCurrentPage(); // build the welcome email content if (ACCOUNT_GENDER > -1 && isset($data['gender'])) { if ($data['gender'] == 'm') { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_male'), $OSCOM_Customer->getLastName()) . "\n\n"; } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_female'), $OSCOM_Customer->getLastName()) . "\n\n"; } } else { $email_text = sprintf(OSCOM::getDef('email_addressing_gender_unknown'), $OSCOM_Customer->getName()) . "\n\n"; } $email_text .= sprintf(OSCOM::getDef('email_create_account_body'), STORE_NAME, STORE_OWNER_EMAIL_ADDRESS); $c_email = new Mail($OSCOM_Customer->getName(), $OSCOM_Customer->getEmailAddress(), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(OSCOM::getDef('email_create_account_subject'), STORE_NAME)); $c_email->setBodyPlain($email_text); $c_email->send(); return true; } return false; }