diff --git a/catalog/account_notifications.php b/catalog/account_notifications.php index 6e85fbb70..b0e9c41ba 100644 --- a/catalog/account_notifications.php +++ b/catalog/account_notifications.php @@ -29,7 +29,7 @@ $product_global = 0; } - (array)$products = $_POST['products']; + $products = isset($_POST['products']) && is_array($_POST['products']) ? $_POST['products'] : []; if ($product_global !== $Qglobal->valueInt('global_product_notifications')) { $product_global = ($Qglobal->valueInt('global_product_notifications') === 1) ? 0 : 1; diff --git a/catalog/admin/includes/languages/english/main.txt b/catalog/admin/includes/languages/english/main.txt index af4b58e60..b6ef949ba 100644 --- a/catalog/admin/includes/languages/english/main.txt +++ b/catalog/admin/includes/languages/english/main.txt @@ -192,3 +192,6 @@ error_filetype_not_allowed = Error: File upload type not allowed. success_file_saved_successfully = Success: File upload saved successfully. warning_no_file_uploaded = Warning: No file uploaded. module_content_bootstrap_row_description =

Content Width can be 12 or less per column per row.

12/12 = 100% width, 6/12 = 50% width, 4/12 = 33% width.

Total of all columns in any one row must equal 12 (eg: 3 boxes of 4 columns each, 1 box of 12 columns and so on).

+ +email_type_html = HTML +email_type_plain = Plain diff --git a/catalog/admin/includes/languages/english/orders.txt b/catalog/admin/includes/languages/english/orders.txt index 46c8f6a30..35d9a501d 100644 --- a/catalog/admin/includes/languages/english/orders.txt +++ b/catalog/admin/includes/languages/english/orders.txt @@ -64,6 +64,20 @@ email_text_comments_update = The comments for your order are {{comments}} +email_separator_html =
+email_text_order_number_html = Order Number: +email_text_invoice_url_html = Detailed Invoice: +email_text_date_ordered_html = Date Ordered: + +email_text_status_update_html =

Your order has been updated to the following status.

+

New status: {{status}}

+

Please reply to this email if you have any questions.

+ +email_text_comments_update_html =

The comments for your order are

+
+
{{comments}}
+
+ error_order_does_not_exist = Error: Order #{{order_id}} does not exist. success_order_updated = Success: Order has been successfully updated. warning_order_not_updated = Warning: Nothing to change. The order was not updated. diff --git a/catalog/admin/includes/modules/newsletters/newsletter.php b/catalog/admin/includes/modules/newsletters/newsletter.php index fe3e639f4..6c608cdff 100644 --- a/catalog/admin/includes/modules/newsletters/newsletter.php +++ b/catalog/admin/includes/modules/newsletters/newsletter.php @@ -12,12 +12,13 @@ use OSC\OM\Registry; class newsletter { - var $show_choose_audience, $title, $content; + var $show_choose_audience, $title, $content, $content_html; - function newsletter($title, $content) { + function __construct($title, $content, $content_html = null) { $this->show_choose_audience = false; $this->title = $title; $this->content = $content; + $this->content_html = $content_html; } function choose_audience() { @@ -43,7 +44,29 @@ function confirm() { '  ' . "\n" . ' ' . "\n" . ' ' . "\n" . - ' ' . nl2br($this->content) . '' . "\n" . + ' ' . "\n" . + ' ' . "\n" . + '
' . "\n" . + '
' . "\n" . + ' ' . "\n" . + ' ' . "\n" . + ' ' . "\n" . + '
' . "\n" . + '
' . "\n" . + ' ' . nl2br(HTML::outputProtected($this->content)) . "\n" . + '
' . "\n" . + '
' . "\n" . + ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . '  ' . "\n" . @@ -62,7 +85,14 @@ function send($newsletter_id) { $newsletterEmail = new Mail(); $newsletterEmail->setFrom(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER); $newsletterEmail->setSubject($this->title); - $newsletterEmail->setBody($this->content); + + if (!empty($this->content)) { + $newsletterEmail->setBodyPlain($this->content); + } + + if (!empty($this->content_html)) { + $newsletterEmail->setBodyHTML($this->content_html); + } $Qmail = $OSCOM_Db->get('customers', [ 'customers_firstname', diff --git a/catalog/admin/includes/modules/newsletters/product_notification.php b/catalog/admin/includes/modules/newsletters/product_notification.php index 674811a3f..cbf911aa2 100644 --- a/catalog/admin/includes/modules/newsletters/product_notification.php +++ b/catalog/admin/includes/modules/newsletters/product_notification.php @@ -12,12 +12,13 @@ use OSC\OM\Registry; class product_notification { - var $show_choose_audience, $title, $content; + var $show_choose_audience, $title, $content, $content_html; - function product_notification($title, $content) { + function __construct($title, $content, $content_html = null) { $this->show_choose_audience = true; $this->title = $title; $this->content = $content; + $this->content_html = $content_html; } function choose_audience() { @@ -155,7 +156,8 @@ function confirm() { } } - $confirm_string = '' . "\n" . + $confirm_string = HTML::form('confirm', OSCOM::link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send')) . "\n" . + '
' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . @@ -169,12 +171,34 @@ function confirm() { ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . - ' ' . "\n" . + ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . - ' ' . HTML::form('confirm', OSCOM::link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=confirm_send')) . "\n" . + ' ' . "\n" . ' ' . "\n" . ' ' . "\n" . - '
' . OSCOM::getDef('text_count_customers', ['audience' => sizeof($audience)]) . '
 
' . nl2br($this->content) . '' . "\n" . + ' ' . "\n" . + '
' . "\n" . + '
' . "\n" . + ' ' . "\n" . + ' ' . "\n" . + ' ' . "\n" . + '
' . "\n" . + '
' . "\n" . + ' ' . nl2br(HTML::outputProtected($this->content)) . "\n" . + '
' . "\n" . + '
' . "\n" . + '
 
'; if (sizeof($audience) > 0) { if (isset($_GET['global']) && ($_GET['global'] == 'true')) { @@ -188,7 +212,8 @@ function confirm() { } $confirm_string .= HTML::button(OSCOM::getDef('image_cancel'), 'fa fa-close', OSCOM::link(FILENAME_NEWSLETTERS, 'page=' . $_GET['page'] . '&nID=' . $_GET['nID'] . '&action=send')) . '
'; + '' . "\n" . + ''; return $confirm_string; } @@ -299,7 +324,14 @@ function send($newsletter_id) { $notificationEmail = new Mail(); $notificationEmail->setFrom(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER); $notificationEmail->setSubject($this->title); - $notificationEmail->setBody($this->content); + + if (!empty($this->content)) { + $notificationEmail->setBodyPlain($this->content); + } + + if (!empty($this->content_html)) { + $notificationEmail->setBodyHTML($this->content_html); + } foreach ( $audience as $key => $value ) { $notificationEmail->clearTo(); diff --git a/catalog/admin/mail.php b/catalog/admin/mail.php index 955134ad7..30fa7a2c5 100644 --- a/catalog/admin/mail.php +++ b/catalog/admin/mail.php @@ -54,7 +54,14 @@ $customerEmail = new Mail(); $customerEmail->setFrom($_POST['from']); $customerEmail->setSubject($_POST['subject']); - $customerEmail->setBody($_POST['message']); + + if (!empty($_POST['message'])) { + $customerEmail->setBodyPlain($_POST['message']); + } + + if (!empty($_POST['message_html'])) { + $customerEmail->setBodyHTML($_POST['message_html']); + } while ($Qmail->fetch()) { $customerEmail->clearTo(); @@ -123,7 +130,33 @@   -
+ + + +
+
+ + + + + +
+ +
+ +
+
+   @@ -201,7 +234,22 @@ - + + + +
+
+ +
+ +
+ +
+
+   diff --git a/catalog/admin/newsletters.php b/catalog/admin/newsletters.php index 93665db9e..2d0f9c361 100644 --- a/catalog/admin/newsletters.php +++ b/catalog/admin/newsletters.php @@ -33,15 +33,16 @@ case 'update': if (isset($_POST['newsletter_id'])) $newsletter_id = HTML::sanitize($_POST['newsletter_id']); $newsletter_module = HTML::sanitize($_POST['module']); - + $allowed = array_map(function($v) {return basename($v, '.php');}, glob('includes/modules/newsletters/*.php')); if (!in_array($newsletter_module, $allowed)) { $OSCOM_MessageStack->add(OSCOM::getDef('error_newsletter_module_not_exists'), 'error'); $newsletter_error = true; - } - + } + $title = HTML::sanitize($_POST['title']); - $content = HTML::sanitize($_POST['content']); + $content = $_POST['content']; + $content_html = $_POST['content_html']; $newsletter_error = false; if (empty($title)) { @@ -57,6 +58,7 @@ if ($newsletter_error == false) { $sql_data_array = array('title' => $title, 'content' => $content, + 'content_html' => $content_html, 'module' => $newsletter_module); if ($action == 'insert') { @@ -125,6 +127,7 @@ $parameters = array('title' => '', 'content' => '', + 'content_html' => '', 'module' => ''); $nInfo = new objectInfo($parameters); @@ -137,6 +140,7 @@ $Qnewsletter = $OSCOM_Db->get('newsletters', [ 'title', 'content', + 'content_html', 'module' ], [ 'newsletters_id' => (int)$nID @@ -183,7 +187,22 @@ - content); ?> + + + +
+
+ content_html); ?> +
+ +
+ content); ?> +
+
+ @@ -201,6 +220,7 @@ $Qnewsletter = $OSCOM_Db->get('newsletters', [ 'title', 'content', + 'content_html', 'module' ], [ 'newsletters_id' => (int)$nID @@ -212,7 +232,33 @@ - content); ?> + + + +
+
+ + + + + +
+ +
+ content)); ?> +
+
+ @@ -224,6 +270,7 @@ $Qnewsletter = $OSCOM_Db->get('newsletters', [ 'title', 'content', + 'content_html', 'module' ], [ 'newsletters_id' => (int)$nID @@ -234,7 +281,7 @@ $OSCOM_Language->loadDefinitions('modules/newsletters/' . $nInfo->module); include('includes/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; - $module = new $module_name($nInfo->title, $nInfo->content); + $module = new $module_name($nInfo->title, $nInfo->content, $nInfo->content_html); ?> show_choose_audience) { echo $module->choose_audience(); } else { echo $module->confirm(); } ?> @@ -246,6 +293,7 @@ $Qnewsletter = $OSCOM_Db->get('newsletters', [ 'title', 'content', + 'content_html', 'module' ], [ 'newsletters_id' => (int)$nID @@ -256,7 +304,7 @@ $OSCOM_Language->loadDefinitions('modules/newsletters/' . $nInfo->module); include('includes/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; - $module = new $module_name($nInfo->title, $nInfo->content); + $module = new $module_name($nInfo->title, $nInfo->content, $nInfo->content_html); ?> confirm(); ?> @@ -269,6 +317,7 @@ 'newsletters_id', 'title', 'content', + 'content_html', 'module' ], [ 'newsletters_id' => (int)$nID @@ -279,7 +328,7 @@ $OSCOM_Language->loadDefinitions('modules/newsletters/' . $nInfo->module); include('includes/modules/newsletters/' . $nInfo->module . substr($PHP_SELF, strrpos($PHP_SELF, '.'))); $module_name = $nInfo->module; - $module = new $module_name($nInfo->title, $nInfo->content); + $module = new $module_name($nInfo->title, $nInfo->content, $nInfo->content_html); ?> diff --git a/catalog/admin/orders.php b/catalog/admin/orders.php index 55b119789..1a7f95276 100644 --- a/catalog/admin/orders.php +++ b/catalog/admin/orders.php @@ -89,14 +89,22 @@ $customer_notified = '0'; if (isset($_POST['notify']) && ($_POST['notify'] == 'on')) { $notify_comments = ''; + $notify_comments_html = ''; + if (isset($_POST['notify_comments']) && ($_POST['notify_comments'] == 'on')) { $notify_comments = OSCOM::getDef('email_text_comments_update', ['comments' => $comments]) . "\n\n"; + $notify_comments_html = OSCOM::getDef('email_text_comments_update_html', ['comments' => nl2br($comments)]); } - $email = STORE_NAME . "\n" . OSCOM::getDef('email_separator') . "\n" . OSCOM::getDef('email_text_order_number') . ' ' . $oID . "\n" . OSCOM::getDef('email_text_invoice_url') . ' ' . OSCOM::link('Shop/' . FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID) . "\n" . OSCOM::getDef('email_text_date_ordered') . ' ' . DateTime::toLong($Qcheck->value('date_purchased')) . "\n\n" . $notify_comments . OSCOM::getDef('email_text_status_update', ['status' => $orders_status_array[$status]]) . "\n"; + $invoice_url = OSCOM::link('Shop/' . FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID); + + $email = STORE_NAME . "\n" . OSCOM::getDef('email_separator') . "\n" . OSCOM::getDef('email_text_order_number') . ' ' . $oID . "\n" . OSCOM::getDef('email_text_invoice_url') . ' ' . $invoice_url . "\n" . OSCOM::getDef('email_text_date_ordered') . ' ' . DateTime::toLong($Qcheck->value('date_purchased')) . "\n\n" . $notify_comments . OSCOM::getDef('email_text_status_update', ['status' => $orders_status_array[$status]]) . "\n"; + + $email_html = '

' . STORE_NAME . '

' . OSCOM::getDef('email_separator_html') . '

' . OSCOM::getDef('email_text_order_number_html') . ' ' . $oID . '

' . OSCOM::getDef('email_text_invoice_url_html') . ' ' . $invoice_url . '

' . OSCOM::getDef('email_text_date_ordered_html') . ' ' . DateTime::toLong($Qcheck->value('date_purchased')) . '

' . $notify_comments_html . OSCOM::getDef('email_text_status_update_html', ['status' => $orders_status_array[$status]]); $orderEmail = new Mail($Qcheck->value('customers_email_address'), $Qcheck->value('customers_name'), STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_text_subject')); - $orderEmail->setBody($email); + $orderEmail->setBodyPlain($email); + $orderEmail->setBodyHTML($email_html); $orderEmail->send(); $customer_notified = '1'; diff --git a/catalog/create_account.php b/catalog/create_account.php index 02f8494ca..df5f8e0be 100644 --- a/catalog/create_account.php +++ b/catalog/create_account.php @@ -242,11 +242,14 @@ if (ACCOUNT_GENDER == 'true') { if ($gender == 'm') { $email_text = OSCOM::getDef('email_greet_mr', ['lastname' => $lastname]); + $email_text_html = OSCOM::getDef('email_greet_mr_html', ['lastname' => $lastname]); } else { $email_text = OSCOM::getDef('email_greet_ms', ['lastname' => $lastname]); + $email_text_html = OSCOM::getDef('email_greet_ms_html', ['lastname' => $lastname]); } } else { $email_text = OSCOM::getDef('email_greet_none', ['firstname' => $firstname]); + $email_text_html = OSCOM::getDef('email_greet_none_html', ['firstname' => $firstname]); } $email_text .= "\n\n" . @@ -255,8 +258,14 @@ OSCOM::getDef('email_contact', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . "\n\n" . OSCOM::getDef('email_warning', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . "\n"; + $email_text_html .= OSCOM::getDef('email_welcome_html', ['store_name' => STORE_NAME]) . + OSCOM::getDef('email_text_html') . + OSCOM::getDef('email_contact_html', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]) . + OSCOM::getDef('email_warning_html', ['store_email_address' => STORE_OWNER_EMAIL_ADDRESS]); + $customerEmail = new Mail($email_address, $name, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_subject', ['store_name' => STORE_NAME])); - $customerEmail->setBody($email_text); + $customerEmail->setBodyPlain($email_text); + $customerEmail->setBodyHTML($email_text_html); $customerEmail->send(); OSCOM::redirect('create_account_success.php'); diff --git a/catalog/includes/OSC/OM/Mail.php b/catalog/includes/OSC/OM/Mail.php index 312b178d9..c85e33000 100644 --- a/catalog/includes/OSC/OM/Mail.php +++ b/catalog/includes/OSC/OM/Mail.php @@ -91,12 +91,15 @@ public function setSubject($subject) $this->subject = $subject; } - public function setBody($html) + public function setBody($text, $html = null) { - $plain = strip_tags($html); + $this->setBodyPlain($text); + + if (!isset($html) || empty($html)) { + $html = nl2br($text); + } $this->setBodyHTML($html); - $this->setBodyPlain($plain); } public function setBodyPlain($body) diff --git a/catalog/includes/OSC/Schema/newsletters.txt b/catalog/includes/OSC/Schema/newsletters.txt index 399120c89..5763ef88f 100644 --- a/catalog/includes/OSC/Schema/newsletters.txt +++ b/catalog/includes/OSC/Schema/newsletters.txt @@ -1,6 +1,7 @@ newsletters_id int not_null auto_increment title varchar(255) not_null content text not_null +content_html text not_null module varchar(255) not_null date_added datetime not_null date_sent datetime diff --git a/catalog/includes/languages/english/create_account.txt b/catalog/includes/languages/english/create_account.txt index 96ba532bf..2bf610303 100644 --- a/catalog/includes/languages/english/create_account.txt +++ b/catalog/includes/languages/english/create_account.txt @@ -2,20 +2,37 @@ navbar_title = Create an Account heading_title = My Account Information text_origin_login = NOTE: If you already have an account with us, please login at the login page. email_subject = Welcome to {{store_name}} + email_greet_mr = Dear Mr. {{lastname}}, email_greet_ms = Dear Ms. {{lastname}}, email_greet_none = Dear {{firstname}} -email_welcome = We welcome you to {{store_name}}. +email_welcome = We welcome you to {{store_name}}. -email_text = You can now take part in the various services we have to offer you. Some of these services include: +email_text = You can now take part in the various services we have to offer you. Some of these services include: -
  • Permanent Cart - Any products added to your online cart remain there until you remove them, or check them out. -
  • Address Book - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves. -
  • Order History - View your history of purchases that you have made with us. -
  • Products Reviews - Share your opinions on products with our other customers. +Permanent Cart - Any products added to your online cart remain there until you remove them, or check them out. +Address Book - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves. +Order History - View your history of purchases that you have made with us. +Products Reviews - Share your opinions on products with our other customers. email_contact = For help with any of our online services, please email the store-owner: {{store_email_address}} -email_warning = Note: This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to {{store_email_address}} +email_warning = Note: This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to {{store_email_address}} + +email_greet_mr_html =

    Dear Mr. {{lastname}},

    +email_greet_ms_html =

    Dear Ms. {{lastname}},

    +email_greet_none_html =

    Dear {{firstname}}

    +email_welcome_html =

    We welcome you to {{store_name}}.

    + +email_text_html =

    You can now take part in the various services we have to offer you. Some of these services include:

    +
      +
    1. Permanent Cart - Any products added to your online cart remain there until you remove them, or check them out.
    2. +
    3. Address Book - We can now deliver your products to another address other than yours! This is perfect to send birthday gifts direct to the birthday-person themselves.
    4. +
    5. Order History - View your history of purchases that you have made with us.
    6. +
    7. Products Reviews - Share your opinions on products with our other customers.
    8. +
    + +email_contact_html =

    For help with any of our online services, please email the store-owner: {{store_email_address}}

    +email_warning_html =

    Note: This email address was given to us by one of our customers. If you did not signup to be a member, please send an email to {{store_email_address}}

    category_company = Company Details category_personal = Your Personal Details diff --git a/catalog/includes/languages/english/password_forgotten.txt b/catalog/includes/languages/english/password_forgotten.txt index eddd4f787..eb91f47df 100644 --- a/catalog/includes/languages/english/password_forgotten.txt +++ b/catalog/includes/languages/english/password_forgotten.txt @@ -5,6 +5,7 @@ text_main = If you've forgotten your password, enter your e-mail address below a text_password_reset_initiated = Please check your e-mail for instructions on how to change your password. The instructions contain a link that is valid only for 24 hours or until your password has been updated. text_no_email_address_found = Error: The E-Mail Address was not found in our records, please try again. email_password_reset_subject = {{store_name}} - New Password + email_password_reset_body = A new password has been requested for your account at {{store_name}}. Please follow this personal link to securely change your password: @@ -15,4 +16,10 @@ This link will be automatically discarded after 24 hours or after your password For help with any of our online services, please email the store-owner: {{store_email_address}} +email_password_reset_body_html =

    A new password has been requested for your account at {{store_name}}.

    +

    Please follow this personal link to securely change your password:

    +

    {{reset_url}}

    +

    This link will be automatically discarded after 24 hours or after your password has been changed.

    +

    For help with any of our online services, please email the store-owner: {{store_email_address}}

    + error_action_recorder = Error: A password reset link has already been sent. Please try again in {{module_action_recorder_reset_password_minutes}} minutes. diff --git a/catalog/password_forgotten.php b/catalog/password_forgotten.php index e7bfdcf6e..eb89bd987 100644 --- a/catalog/password_forgotten.php +++ b/catalog/password_forgotten.php @@ -39,7 +39,8 @@ } $passwordEmail = new Mail($email_address, $Qcheck->value('customers_firstname') . ' ' . $Qcheck->value('customers_lastname'), STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, OSCOM::getDef('email_password_reset_subject', ['store_name' => STORE_NAME])); - $passwordEmail->setBody(OSCOM::getDef('email_password_reset_body', ['store_name' => STORE_NAME, 'store_email_address' => STORE_OWNER_EMAIL_ADDRESS, 'reset_url' => $reset_key_url])); + $passwordEmail->setBodyHTML(OSCOM::getDef('email_password_reset_body_html', ['store_name' => STORE_NAME, 'store_email_address' => STORE_OWNER_EMAIL_ADDRESS, 'reset_url' => $reset_key_url])); + $passwordEmail->setBodyPlain(OSCOM::getDef('email_password_reset_body', ['store_name' => STORE_NAME, 'store_email_address' => STORE_OWNER_EMAIL_ADDRESS, 'reset_url' => $reset_key_url])); $passwordEmail->send(); $password_reset_initiated = true;