Execute($audience_select['query_string']); $mail_sent_to = $audience_select['query_name']; if ($_POST['email_to']) { $mail_sent_to = $_POST['email_to']; } // demo active test if (zen_admin_demo()) { $_GET['action']= ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); } $from = zen_db_prepare_input($_POST['from']); $subject = zen_db_prepare_input($_POST['subject']); $recip_count=0; // set time-limit for processing to 5 minutes... if allowed by PHP configuration zen_set_time_limit(600); while (!$mail->EOF) { $id1 = create_coupon_code($mail->fields['customers_email_address']); $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())"); $insert_id = $db->Insert_ID(); $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id ."', '0', 'Admin', '" . $mail->fields['customers_email_address'] . "', now() )"); $message = $_POST['message']; $html_msg['EMAIL_MESSAGE_HTML'] = zen_db_prepare_input($_POST['message_html']); $message .= "\n\n" . TEXT_GV_WORTH . $currencies->format($_POST['amount']) . "\n\n"; $message .= TEXT_TO_REDEEM; $message .= TEXT_WHICH_IS . ' ' . $id1 . ' ' . TEXT_IN_CASE . "\n\n"; $html_msg['GV_WORTH'] = TEXT_GV_WORTH; $html_msg['GV_AMOUNT'] = $currencies->format($_POST['amount']); $html_msg['GV_REDEEM'] = TEXT_TO_REDEEM . TEXT_WHICH_IS . ' ' . $id1 . ' ' . TEXT_IN_CASE; if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'index.php/gv_redeem/gv_no/'.$id1 . "\n\n"; $html_msg['GV_CODE_URL'] = '' .TEXT_CLICK_TO_REDEEM . ''. " "; } else { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=gv_redeem&gv_no='.$id1 . "\n\n"; $html_msg['GV_CODE_URL'] = '' .TEXT_CLICK_TO_REDEEM . '' . " "; } $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE . "\n\n"; $html_msg['GV_CODE_URL'] .= TEXT_OR_VISIT . '' . STORE_NAME . '' . TEXT_ENTER_CODE; $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; // disclaimer $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], $subject , $message, $from, $from, $html_msg, 'gv_mail'); $recip_count++; if (SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO_STATUS== '1' and SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO != '') { zen_mail('', SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO, SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO_SUBJECT . ' ' . $subject, $message, $from, $from, $html_msg, 'gv_mail_extra'); } // Now create the coupon main and email entry $mail->MoveNext(); } if ($_POST['email_to']) { $id1 = create_coupon_code($_POST['email_to']); $message = zen_db_prepare_input($_POST['message']); $message .= "\n\n" . TEXT_GV_WORTH . $currencies->format($_POST['amount']) . "\n\n"; $message .= TEXT_TO_REDEEM; $message .= TEXT_WHICH_IS . ' ' . $id1 . ' ' . TEXT_IN_CASE . "\n\n"; $html_msg['GV_WORTH'] = TEXT_GV_WORTH . $currencies->format($_POST['amount']) .'
'; $html_msg['GV_REDEEM'] = TEXT_TO_REDEEM . TEXT_WHICH_IS . ' ' . $id1 . ' ' . TEXT_IN_CASE . "\n\n"; if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'index.php/gv_redeem/gv_no/'.$id1 . "\n\n"; $html_msg['GV_CODE_URL'] = '' .TEXT_CLICK_TO_REDEEM . ''. " "; } else { $message .= HTTP_SERVER . DIR_WS_CATALOG . 'index.php?main_page=gv_redeem&gv_no='.$id1 . "\n\n"; $html_msg['GV_CODE_URL'] = '' .TEXT_CLICK_TO_REDEEM . '' . " "; } $message .= TEXT_OR_VISIT . HTTP_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE . "\n\n"; $html_msg['GV_CODE_URL'] .= TEXT_OR_VISIT . '' . STORE_NAME . '' . TEXT_ENTER_CODE; $html_msg['EMAIL_MESSAGE_HTML'] = zen_db_prepare_input($_POST['message_html']); $html_msg['EMAIL_FIRST_NAME'] = ''; // unknown, since only an email address was supplied $html_msg['EMAIL_LAST_NAME'] = ''; // unknown, since only an email address was supplied // disclaimer $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; //Send the emails zen_mail('Friend', $_POST['email_to'], $subject , $message, $from, $from, $html_msg, 'gv_mail'); $recip_count++; if (SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO_STATUS== '1' and SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO != '') { zen_mail('', SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO, SEND_EXTRA_DISCOUNT_COUPON_ADMIN_EMAILS_TO_SUBJECT . ' ' . $subject, $message, $from, $from, $html_msg, 'gv_mail_extra'); } // Now create the coupon main entry $insert_query = $db->Execute("insert into " . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())"); $insert_id = $db->Insert_id(); $insert_query = $db->Execute("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() )"); } zen_redirect(zen_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to) . '&recip_count='. $recip_count )); } if ( ($_GET['action'] == 'preview') && (!$_POST['customers_email_address']) && (!$_POST['email_to']) ) { $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error'); } if ( ($_GET['action'] == 'preview') && (!$_POST['subject']) ) { $messageStack->add(ERROR_NO_SUBJECT, 'error'); } if ( ($_GET['action'] == 'preview') && ($_POST['amount'] <= 0) ) { $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error'); } if ($_GET['mail_sent_to']) { $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']. '(' . $_GET['recip_count'] . ')'), 'success'); } ?> > <?php echo TITLE; ?>
'; ?>




' . ERROR_GV_AMOUNT . '' : ''); ?>





' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ' ' . ($_POST['amount'] <= 0 ? '' : zen_image_submit('button_send_mail.gif', IMAGE_SEND_EMAIL)); ?>
Value = ($_POST['message_html']=='') ? TEXT_GV_ANNOUNCE : stripslashes($_POST['message_html']) ; $oFCKeditor->Width = '97%' ; $oFCKeditor->Height = '250' ; // $oFCKeditor->Create() ; $output = $oFCKeditor->CreateHtml() ; echo $output; } else { // using HTMLAREA or just raw "source" echo zen_draw_textarea_field('message_html', 'soft', '100%', '20', ($_POST['message_html']=='') ? TEXT_GV_ANNOUNCE : stripslashes($_POST['message_html']), 'id="message_html" class="editorHook"'); } } ?>