} tep_redirect(tep_href_link(FILENAME_COUPON_ADMIN, 'mail_sent_to=' . urlencode($mail_sent_to))); } if ($_GET['action'] == 'preview_email' && !$_POST['customers_email_address']) { $_GET['action'] = 'email'; $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ($_GET['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice'); } $coupon_id = isset($_GET['cid']) ? tep_db_prepare_input($_GET['cid']) : ''; switch ($_GET['action']) { case 'setflag': if ($_GET['flag'] == 'N' || $_GET['flag'] == 'Y') { if (isset($_GET['cid'])) { tep_set_coupon_status($coupon_id, $_GET['flag']); } } tep_redirect(tep_href_link(FILENAME_COUPON_ADMIN, '&cid=' . $_GET['cid'])); break; case 'confirmdelete': $delete_query = tep_db_query("delete from " . TABLE_COUPONS . " where coupon_id='" . (int) $coupon_id . "'"); break; case 'update': // get all _POST and validate $_POST['coupon_code'] = trim($_POST['coupon_code']); $languages = tep_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id']; if ($_POST['coupon_name'][$language_id]) { $_POST['coupon_name'][$language_id] = trim($_POST['coupon_name'][$language_id]);
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject); } tep_redirect(tep_href_link(FILENAME_COUPON_ADMIN, 'mail_sent_to=' . urlencode($mail_sent_to))); } if ($_GET['action'] == 'preview_email' && !$_POST['customers_email_address']) { $_GET['action'] = 'email'; $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ($_GET['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice'); } switch ($_GET['action']) { case 'setstatus': if ($_GET['flag'] == '0' || $_GET['flag'] == '1') { if (isset($_GET['cid'])) { tep_set_coupon_status($_GET['cid'], $_GET['flag']); } } tep_redirect(tep_href_link(FILENAME_COUPON_ADMIN, '&cid=' . $_GET['cid'])); break; case 'confirmdelete': $coupon_id = tep_db_prepare_input($_GET['cid']); tep_db_query("delete from " . TABLE_COUPONS . " where coupon_id='" . $_GET['cid'] . "'"); tep_db_query("delete from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id='" . $_GET['cid'] . "'"); break; case 'update': // get all $_POST and validate $_POST['coupon_code'] = trim($_POST['coupon_code']); $languages = tep_get_languages(); for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { $language_id = $languages[$i]['id'];