66 |
66 |
$mail_sent_to = TEXT_NEWSLETTER_CUSTOMERS;
|
67 |
67 |
break;
|
68 |
68 |
default:
|
|
69 |
|
|
70 |
if ($_POST['email_to']) {
|
|
71 |
$mail_sent_to = $_POST['email_to'];
|
|
72 |
}
|
|
73 |
else {
|
69 |
|
$customers_email_address = xtc_db_prepare_input($_POST['customers_email_address']);
|
|
74 |
$customers_email_address = xtc_db_prepare_input($_POST['customers_email_address']);
|
70 |
75 |
|
71 |
|
$mail_query = xtc_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . xtc_db_input($customers_email_address) . "'");
|
72 |
|
$mail_sent_to = $_POST['customers_email_address'];
|
|
76 |
$mail_query = xtc_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . xtc_db_input($customers_email_address) . "'");
|
|
77 |
$mail_sent_to = $_POST['customers_email_address'];
|
73 |
|
if ($_POST['email_to']) {
|
74 |
|
$mail_sent_to = $_POST['email_to'];
|
75 |
78 |
}
|
76 |
79 |
break;
|
77 |
80 |
}
|
78 |
81 |
|
79 |
82 |
$from = xtc_db_prepare_input($_POST['from']);
|
80 |
|
while ($mail = xtc_db_fetch_array($mail_query)) {
|
81 |
|
$id1 = create_coupon_code($mail['customers_email_address']);
|
82 |
83 |
|
|
84 |
if ($_POST['email_to']) {
|
|
85 |
$id1 = create_coupon_code($_POST['email_to']);
|
|
86 |
|
83 |
87 |
// assign language to template for caching
|
84 |
88 |
$smarty->assign('language', $_SESSION['language']);
|
85 |
89 |
$smarty->caching = false;
|
... | ... | |
91 |
95 |
|
92 |
96 |
$smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
|
93 |
97 |
$smarty->assign('logo_path',HTTP_SERVER . DIR_WS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/img/');
|
|
98 |
|
94 |
99 |
$smarty->assign('AMMOUNT', $currencies->format($_POST['amount']));
|
|
100 |
|
95 |
101 |
$smarty->assign('MESSAGE', gm_prepare_string($_POST['message'], true));
|
96 |
102 |
$smarty->assign('GIFT_ID', $id1);
|
97 |
103 |
$smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
|
98 |
104 |
|
99 |
|
|
|
105 |
if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
|
|
106 |
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '/gv_no,'.$id1;
|
|
107 |
} else {
|
100 |
|
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1;
|
|
108 |
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1;
|
|
109 |
}
|
101 |
110 |
|
102 |
|
|
103 |
111 |
$smarty->assign('GIFT_LINK',$link);
|
104 |
112 |
// bof gm
|
105 |
113 |
$gm_logo_mail = MainFactory::create_object('GMLogoManager', array("gm_logo_mail"));
|
... | ... | |
108 |
116 |
}
|
109 |
117 |
// eof gm
|
110 |
118 |
$html_mail = fetch_email_template($smarty, 'send_gift', 'html');
|
111 |
|
// BOF GM_MOD
|
112 |
|
$link = str_replace('&', '&', $link);
|
113 |
|
$smarty->assign('GIFT_LINK', $link);
|
114 |
|
// EOF GM_MOD
|
115 |
119 |
$txt_mail = fetch_email_template($smarty, 'send_gift', 'txt');
|
116 |
120 |
|
117 |
|
xtc_php_mail(EMAIL_BILLING_ADDRESS,EMAIL_BILLING_NAME, $mail['customers_email_address'] , $mail['customers_firstname'] . ' ' . $mail['customers_lastname'] , '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $subject, $html_mail , $txt_mail);
|
|
121 |
xtc_php_mail(EMAIL_BILLING_ADDRESS,EMAIL_BILLING_NAME, $_POST['email_to'] , '' , '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $subject, $html_mail , $txt_mail);
|
118 |
|
|
|
122 |
|
119 |
123 |
|
120 |
|
// Now create the coupon main and email entry
|
|
124 |
// Now create the coupon email entry
|
121 |
125 |
$insert_query = xtc_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");
|
122 |
126 |
$insert_id = xtc_db_insert_id($insert_query);
|
123 |
|
$insert_query = xtc_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $mail['customers_email_address'] . "', now() )");
|
|
127 |
$insert_query = xtc_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $_POST['email_to'] . "', now() )");
|
124 |
128 |
}
|
125 |
|
if ($_POST['email_to']) {
|
126 |
|
$id1 = create_coupon_code($_POST['email_to']);
|
|
129 |
else {
|
|
130 |
while ($mail = xtc_db_fetch_array($mail_query)) {
|
|
131 |
$id1 = create_coupon_code($mail['customers_email_address']);
|
127 |
132 |
|
128 |
|
// assign language to template for caching
|
129 |
|
$smarty->assign('language', $_SESSION['language']);
|
130 |
|
$smarty->caching = false;
|
|
133 |
// assign language to template for caching
|
|
134 |
$smarty->assign('language', $_SESSION['language']);
|
|
135 |
$smarty->caching = false;
|
131 |
136 |
|
132 |
|
// set dirs manual
|
133 |
|
$smarty->template_dir=DIR_FS_CATALOG.'templates';
|
134 |
|
$smarty->compile_dir=DIR_FS_CATALOG.'templates_c';
|
135 |
|
$smarty->config_dir=DIR_FS_CATALOG.'lang';
|
|
137 |
// set dirs manual
|
|
138 |
$smarty->template_dir=DIR_FS_CATALOG.'templates';
|
|
139 |
$smarty->compile_dir=DIR_FS_CATALOG.'templates_c';
|
|
140 |
$smarty->config_dir=DIR_FS_CATALOG.'lang';
|
136 |
141 |
|
137 |
|
$smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
|
138 |
|
$smarty->assign('logo_path',HTTP_SERVER . DIR_WS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/img/');
|
|
142 |
$smarty->assign('tpl_path','templates/'.CURRENT_TEMPLATE.'/');
|
|
143 |
$smarty->assign('logo_path',HTTP_SERVER . DIR_WS_CATALOG.'templates/'.CURRENT_TEMPLATE.'/img/');
|
139 |
|
|
140 |
|
$smarty->assign('AMMOUNT', $currencies->format($_POST['amount']));
|
|
144 |
$smarty->assign('AMMOUNT', $currencies->format($_POST['amount']));
|
141 |
|
|
142 |
|
$smarty->assign('MESSAGE', gm_prepare_string($_POST['message'], true));
|
143 |
|
$smarty->assign('GIFT_ID', $id1);
|
144 |
|
$smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
|
|
145 |
$smarty->assign('MESSAGE', gm_prepare_string($_POST['message'], true));
|
|
146 |
$smarty->assign('GIFT_ID', $id1);
|
|
147 |
$smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
|
145 |
148 |
|
146 |
|
if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
|
147 |
|
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '/gv_no,'.$id1;
|
148 |
|
} else {
|
|
149 |
|
149 |
|
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1;
|
|
150 |
$link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . '?gv_no='.$id1;
|
150 |
|
}
|
151 |
151 |
|
|
152 |
|
152 |
|
$smarty->assign('GIFT_LINK',$link);
|
153 |
|
// bof gm
|
154 |
|
$gm_logo_mail = MainFactory::create_object('GMLogoManager', array("gm_logo_mail"));
|
155 |
|
if($gm_logo_mail->logo_use == '1') {
|
156 |
|
$smarty->assign('gm_logo_mail', $gm_logo_mail->get_logo());
|
157 |
|
}
|
158 |
|
// eof gm
|
159 |
|
$html_mail = fetch_email_template($smarty, 'send_gift', 'html');
|
|
153 |
$smarty->assign('GIFT_LINK',$link);
|
|
154 |
// bof gm
|
|
155 |
$gm_logo_mail = MainFactory::create_object('GMLogoManager', array("gm_logo_mail"));
|
|
156 |
if($gm_logo_mail->logo_use == '1') {
|
|
157 |
$smarty->assign('gm_logo_mail', $gm_logo_mail->get_logo());
|
|
158 |
}
|
|
159 |
// eof gm
|
|
160 |
$html_mail = fetch_email_template($smarty, 'send_gift', 'html');
|
|
161 |
// BOF GM_MOD
|
|
162 |
$link = str_replace('&', '&', $link);
|
|
163 |
$smarty->assign('GIFT_LINK', $link);
|
|
164 |
// EOF GM_MOD
|
160 |
|
$txt_mail = fetch_email_template($smarty, 'send_gift', 'txt');
|
|
165 |
$txt_mail = fetch_email_template($smarty, 'send_gift', 'txt');
|
161 |
166 |
|
162 |
|
xtc_php_mail(EMAIL_BILLING_ADDRESS,EMAIL_BILLING_NAME, $_POST['email_to'] , '' , '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $subject, $html_mail , $txt_mail);
|
|
167 |
xtc_php_mail(EMAIL_BILLING_ADDRESS,EMAIL_BILLING_NAME, $mail['customers_email_address'] , $mail['customers_firstname'] . ' ' . $mail['customers_lastname'] , '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $subject, $html_mail , $txt_mail);
|
163 |
|
|
|
168 |
|
164 |
169 |
|
165 |
|
// Now create the coupon email entry
|
|
170 |
// Now create the coupon main and email entry
|
166 |
|
$insert_query = xtc_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");
|
167 |
|
$insert_id = xtc_db_insert_id($insert_query);
|
|
171 |
$insert_query = xtc_db_query("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");
|
|
172 |
$insert_id = xtc_db_insert_id($insert_query);
|
168 |
|
$insert_query = xtc_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $_POST['email_to'] . "', now() )");
|
|
173 |
$insert_query = xtc_db_query("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $mail['customers_email_address'] . "', now() )");
|
|
174 |
}
|
169 |
|
}
|
|
175 |
}
|
170 |
176 |
xtc_redirect(xtc_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
|
171 |
177 |
}
|
172 |
178 |
elseif ( ($_GET['action'] == 'preview') && ($_POST['customers_email_address'] || $_POST['email_to']) ) {
|