function update(&$callingClass, $notifier, $paramsArray) { if ($notifier != "NOTIFY_CHECKOUT_PROCESS_BEGIN") { return; } // セッションが存在する場合は無処理 if ($_SESSION['customer_id']) { return; } // セッションがタイムアウトした // パラメータの確認 if (!isset($_REQUEST['SID']) || !isset($_REQUEST['FUKA'])) { return; } // 存在チェック $sid = $_REQUEST['SID']; $fuka = $_REQUEST['FUKA']; if (!digitalchcek_is_exist($sid, $fuka)) { return; } // 状態チェック // タイムアウトしたが、既に精算済みか? if (digitalchcek_get_status($sid, $fuka, 'cc') == 'success') { $customers_id = digitalchcek_get_customers_id($sid, $fuka); require_once "includes/languages/" . $_SESSION['language'] . "/modules/payment/digitalcheck_cc.php"; $email_timeout = sprintf(MODULE_PAYMENT_DIGITALCHECK_CC_MAIL_TIMEOUT, $customers_id, $sid); zen_mail('', STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_DIGITALCHECK_CC_TEXT_TIMEOUT, $email_timeout, STORE_NAME, EMAIL_FROM, $email_timeout, 'digitalcheck cc'); } }
function send($newsletter_id) { global $db; $audience_select = get_audience_sql_query($this->query_name, 'newsletters'); $audience = $db->Execute($audience_select['query_string']); $records = $audience->RecordCount(); if ($records == 0) { return 0; } $i = 0; while (!$audience->EOF) { $i++; $html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $audience->fields['customers_lastname']; $html_msg['EMAIL_GREET'] = EMAIL_GREET; $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html; zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters'); echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']); //force output to the screen to show status indicator each time a message is sent... if (function_exists('ob_flush')) { @ob_flush(); } @flush(); $audience->MoveNext(); } $newsletter_id = zen_db_prepare_input($newsletter_id); $db->Execute("update " . TABLE_NEWSLETTERS . "\r\n set date_sent = now(), status = '1'\r\n where newsletters_id = '" . zen_db_input($newsletter_id) . "'"); return $records; //return number of records processed whether successful or not }
function update(&$callingClass, $notifier, $paramsArray) { global $db; global $order; if (ZAIKOROBOT_ENABLE == "true") { $email = ZAIKOROBOT_EMAIL; $subject = "【" . STORE_NAME . "】ご注文ありがとうございます。"; $text = ""; for ($i = 0; $i < count($order->products); $i++) { // SKU型番に対応 $model = zaikorobot_get_skumodel($order->products[$i]['id'], $order->products[$i]['model'], $order->products[$i]['attributes']); $text .= "商品コード: " . $model . "\n"; $text .= "数量:" . $order->products[$i]['qty'] . " 個\n"; $text .= "\n"; } zaikorobot_add_mail_log($email, $subject, $text, EMAIL_FROM); zen_mail("", $email, $subject, $text, STORE_NAME, EMAIL_FROM); } }
function ipn_debug_email($message, $email_address = '', $always_send = false, $subjecttext = 'IPN DEBUG message') { static $paypal_error_counter; static $paypal_instance_id; if ($email_address == '') { $email_address = defined('MODULE_PAYMENT_PAYPAL_DEBUG_EMAIL_ADDRESS') ? MODULE_PAYMENT_PAYPAL_DEBUG_EMAIL_ADDRESS : STORE_OWNER_EMAIL_ADDRESS; } if (!isset($paypal_error_counter)) { $paypal_error_counter = 0; } if (!isset($paypal_instance_id)) { $paypal_instance_id = time() . '_' . zen_create_random_value(4); } if (defined('MODULE_PAYMENT_PAYPALWPP_DEBUGGING') && MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log and Email' || defined('MODULE_PAYMENT_PAYPAL_IPN_DEBUG') && MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Log and Email' || $always_send) { $paypal_error_counter++; zen_mail(STORE_OWNER, $email_address, $subjecttext . ' (' . $paypal_instance_id . ') #' . $paypal_error_counter, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => $message), 'debug'); } if (defined('MODULE_PAYMENT_PAYPAL_IPN_DEBUG') && (MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Log and Email' || MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Log File' || MODULE_PAYMENT_PAYPAL_IPN_DEBUG == 'Yes') || defined('MODULE_PAYMENT_PAYPALWPP_DEBUGGING') && (MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log File' || MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log and Email')) { ipn_add_error_log($message, $paypal_instance_id); } }
$message .= sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, $currencies->format($gv_amount)) . "\n\n"; $message .= TEXT_REDEEM_GV_MESSAGE_THANKS . "\n" . STORE_OWNER . "\n\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG; $message .= TEXT_REDEEM_GV_MESSAGE_BODY; $message .= TEXT_REDEEM_GV_MESSAGE_FOOTER; $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; $html_msg['GV_NOTICE_HEADER'] = TEXT_REDEEM_GV_MESSAGE_HEADER; $html_msg['GV_NOTICE_RELEASED'] = TEXT_REDEEM_GV_MESSAGE_RELEASED; $html_msg['GV_NOTICE_AMOUNT_REDEEM'] = sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, '<strong>' . $currencies->format($gv_amount) . '</strong>'); $html_msg['GV_NOTICE_VALUE'] = $currencies->format($gv_amount); $html_msg['GV_NOTICE_THANKS'] = TEXT_REDEEM_GV_MESSAGE_THANKS; $html_msg['TEXT_REDEEM_GV_MESSAGE_BODY'] = TEXT_REDEEM_GV_MESSAGE_BODY; $html_msg['TEXT_REDEEM_GV_MESSAGE_FOOTER'] = TEXT_REDEEM_GV_MESSAGE_FOOTER; //send the message zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], TEXT_REDEEM_GV_SUBJECT . TEXT_REDEEM_GV_SUBJECT_ORDER . $gv_resulta->fields['order_id'], $message, STORE_NAME, EMAIL_FROM, $html_msg, 'gv_queue'); zen_record_admin_activity('GV Queue entry released in the amount of ' . $gv_amount . ' for ' . $mail->fields['customers_email_address'], 'info'); $gv_amount = $gv_resulta->fields['amount']; $gv_result = $db->Execute("select amount\r\n from " . TABLE_COUPON_GV_CUSTOMER . "\r\n where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); $customer_gv = false; $total_gv_amount = 0; if ($gv_result->RecordCount() > 0) { $total_gv_amount = $gv_result->fields['amount']; $customer_gv = true; } $total_gv_amount = $total_gv_amount + $gv_amount; if ($customer_gv) { $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . "\r\n set amount='" . $total_gv_amount . "'\r\n where customer_id='" . $gv_resulta->fields['customer_id'] . "'"); } else { $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . "\r\n (customer_id, amount)\r\n values ('" . $gv_resulta->fields['customer_id'] . "', '" . $total_gv_amount . "')"); }
} $email_body .= sprintf(EMAIL_TEXT_LINK, zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id']), '', false) . "\n\n" . sprintf(EMAIL_TEXT_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n"); $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER; $html_msg['EMAIL_PRODUCT_LINK'] = sprintf(str_replace('\\n\\n', '<br />', EMAIL_TEXT_LINK), '<a href="' . zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_GET['products_id']) . '">' . $product_info->fields['products_name'] . '</a>', '', false); $html_msg['EMAIL_TEXT_SIGNATURE'] = sprintf(str_replace('\\n', '', EMAIL_TEXT_SIGNATURE), ''); // include disclaimer $email_body .= "\n\n" . EMAIL_ADVISORY . "\n\n"; //send the email zen_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address, $html_msg, 'tell_a_friend'); // send additional emails if (SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO_STATUS == '1' and SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO != '') { if ($_SESSION['customer_id']) { $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n FROM " . TABLE_CUSTOMERS . "\n WHERE customers_id = :customersID"; $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer'); $account = $db->Execute($account_query); } $extra_info = email_collect_extra_info($from_name, $from_email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail('', SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO, SEND_EXTRA_TELL_A_FRIEND_EMAILS_TO_SUBJECT . ' ' . $email_subject, $email_body . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'tell_a_friend_extra'); } $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info->fields['products_name'], zen_output_string_protected($to_name)), 'success'); zen_redirect(zen_href_link(zen_get_info_page($_GET['products_id']), 'products_id=' . $_GET['products_id'])); } } elseif ($_SESSION['customer_id']) { $account_query = "SELECT customers_firstname, customers_lastname, customers_email_address\n FROM " . TABLE_CUSTOMERS . "\n WHERE customers_id = :customersID"; $account_query = $db->bindVars($account_query, ':customersID', $_SESSION['customer_id'], 'integer'); $account = $db->Execute($account_query); $from_name = $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname']; $from_email_address = $account->fields['customers_email_address']; } $breadcrumb->add(NAVBAR_TITLE);
$gv_email .= EMAIL_GV_LINK . ' ' . zen_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1, 'NONSSL', false); $gv_email .= "\n\n"; $gv_email .= EMAIL_GV_FIXED_FOOTER . "\n\n"; $gv_email .= EMAIL_GV_SHOP_FOOTER; $gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, $send_name); // include disclaimer $gv_email .= "\n\n" . EMAIL_ADVISORY . "\n\n"; $html_msg['EMAIL_GV_FIXED_FOOTER'] = str_replace(array("\r\n", "\n", "\r", "-----"), '', EMAIL_GV_FIXED_FOOTER); $html_msg['EMAIL_GV_SHOP_FOOTER'] = EMAIL_GV_SHOP_FOOTER; // send the email zen_mail($_POST['to_name'], $_POST['email'], $gv_email_subject, nl2br($gv_email), STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send'); // send additional emails if (SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_CUSTOMER_EMAILS_TO != '') { $extra_info = email_collect_extra_info(ENTRY_NAME . $_POST['to_name'], ENTRY_EMAIL . $_POST['email'], $send_name, $account->fields['customers_email_address']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail('', SEND_EXTRA_GV_CUSTOMER_EMAILS_TO, SEND_EXTRA_GV_CUSTOMER_EMAILS_TO_SUBJECT . ' ' . $gv_email_subject, $gv_email . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'gv_send_extra'); } // do a fresh calculation after sending an email $gv_query = "SELECT amount\n FROM " . TABLE_COUPON_GV_CUSTOMER . "\n WHERE customer_id = :customersID"; $gv_query = $db->bindVars($gv_query, ':customersID', $_SESSION['customer_id'], 'integer'); $gv_result = $db->Execute($gv_query); } } else { // customer DID click the back button $_GET['action'] = ''; } } $gv_current_balance = $currencies->format($gv_result->fields['amount']); if ($_GET['action'] == 'complete') { zen_redirect(zen_href_link(FILENAME_GV_SEND, 'action=doneprocess')); }
/** * Error / exception handling */ function _errorHandler($response, $operation = '', $ignore_codes = '') { global $messageStack, $doPayPal; $gateway_mode = isset($response['PNREF']) && $response['PNREF'] != ''; $basicError = !$response || isset($response['RESULT']) && $response['RESULT'] != 0 || isset($response['ACK']) && !strstr($response['ACK'], 'Success') || !isset($response['RESULT']) && !isset($response['ACK']); $ignoreList = explode(',', str_replace(' ', '', $ignore_codes)); foreach ($ignoreList as $key => $value) { if ($value != '' && $response['L_ERRORCODE0'] == $value) { $basicError = false; } } //echo '<br />basicError='.$basicError.'<br />' . urldecode(print_r($response,true)); die('halted'); switch ($operation) { case 'SetExpressCheckout': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ec_step1()', "In function: ec_step1()\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR; $errorNum = urldecode($response['L_ERRORCODE0'] . $response['RESULT']); if ($response['RESULT'] == 25) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_NOT_WPP_ACCOUNT_ERROR; } if ($response['L_ERRORCODE0'] == 10002) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_SANDBOX_VS_LIVE_ERROR; } if ($response['L_ERRORCODE0'] == 10565) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_WPP_BAD_COUNTRY_ERROR; $_SESSION['payment'] = ''; } if ($response['L_ERRORCODE0'] == 10736) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ADDR_ERROR; } if ($response['L_ERRORCODE0'] == 10752) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED; } $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . (isset($response['RESPMSG']) ? ' ' . $response['RESPMSG'] : '') . ' ' . $response['CURL_ERRORS']) : ''; $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $errorText); if ($detailedEmailMessage != '') { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => $detailedMessage), 'paymentalert'); } $this->terminateEC($errorText . ' (' . $errorNum . ') ' . $detailedMessage, true); return true; } break; case 'GetExpressCheckoutDetails': if ($basicError || $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) { // if response indicates an error, send the customer back to checkout and display the error. Debug to store owner if active. if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ec_step2()', "In function: ec_step2()\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList)))) . "\r\n\r\nResponse:\r\n" . urldecode(print_r($response, true))); } $this->terminateEC(MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_ERROR . ' (' . $response['L_ERRORCODE0'] . ' ' . urldecode($response['L_SHORTMESSAGE0'] . $response['RESULT']) . ')', true); return true; } break; case 'DoExpressCheckoutPayment': if ($basicError || $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) { // there's an error, so alert customer, and if debug is on, notify storeowner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - before_process() - EC', "In function: before_process() - Express Checkout\r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } // if funding source problem occurred, must send back to re-select alternate funding source if ($response['L_ERRORCODE0'] == 10422) { $paypal_url = $this->getPayPalLoginServer(); zen_redirect($paypal_url . "?cmd=_express-checkout&token=" . $_SESSION['paypal_ec_token']); die; } // some other error condition $errorText = MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE; $errorNum = urldecode($response['L_ERRORCODE0']); if ($response['L_ERRORCODE0'] == 10415) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ORDER_ALREADY_PLACED_ERROR; } if ($response['L_ERRORCODE0'] == 10417) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_INSUFFICIENT_FUNDS_ERROR; } if ($response['L_ERRORCODE0'] == 10474) { $errorText .= urldecode($response['L_LONGMESSAGE0']); } $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . $response['RESULT'] . ' ' . $response['CURL_ERRORS']) : ''; $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $errorText); if ($detailedEmailMessage != '') { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => $detailedMessage), 'paymentalert'); } $this->terminateEC($detailedEmailMessage == '' ? $errorText . ' (' . urldecode($response['L_SHORTMESSAGE0'] . $response['RESULT']) . ') ' : $detailedMessage, true); return true; } break; case 'DoDirectPayment': if ($basicError || isset($_SESSION['paypal_ec_token']) && $_SESSION['paypal_ec_token'] != urldecode($response['TOKEN'])) { // Error, so send the store owner a complete dump of the transaction. if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - before_process() - DP', "In function: before_process() - Direct Payment \r\nDid first contact attempt return error? " . ($error_occurred ? "Yes" : "No") . " \r\n\r\nValue List:\r\n" . str_replace('&', "\r\n", urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList)))) . "\r\n\r\nResponse:\r\n" . urldecode(print_r($response, true))); } $errorText = MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE; $errorNum = urldecode($response['L_ERRORCODE0'] . $response['RESULT'] . ' ' . $response['RESPMSG']); if ($response['RESULT'] == 25) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_NOT_WPP_ACCOUNT_ERROR; } if ($response['L_ERRORCODE0'] == 10002) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_SANDBOX_VS_LIVE_ERROR; } if ($response['L_ERRORCODE0'] == 10565) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_WPP_BAD_COUNTRY_ERROR; $_SESSION['payment'] = ''; } if ($response['L_ERRORCODE0'] == 10736) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_ADDR_ERROR; } if ($response['L_ERRORCODE0'] == 10752) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED; $errorNum = '10752'; } if ($response['RESPMSG'] != '') { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED; } $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_INVALID_RESPONSE || $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? $errorNum . ' ' . urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . ' ' . $response['CURL_ERRORS']) : ''; $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $detailedMessage . "\n\n" . 'Transaction Response Details: ' . print_r($response, true) . "\n\n" . 'Transaction Submission: ' . urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList), true))); if ($detailedEmailMessage != '') { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($detailedEmailMessage)), 'paymentalert'); } $this->terminateEC($detailedEmailMessage == '' ? $errorText . ' (' . $errorNum . ') ' : $detailedMessage, $gateway_mode ? true : false, FILENAME_CHECKOUT_PAYMENT); return true; } break; case 'DoRefund': if ($basicError || !isset($response['RESPMSG']) && !isset($response['REFUNDTRANSACTIONID'])) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_REFUND_ERROR; if ($response['L_ERRORCODE0'] == 10009) { $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_REFUNDFULL_ERROR; } if ($response['RESULT'] == 105 || isset($response['RESPMSG'])) { $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG']; } if (urldecode($response['L_LONGMESSAGE0']) == 'This transaction has already been fully refunded') { $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']); } if (urldecode($response['L_LONGMESSAGE0']) == 'Can not do a full refund after a partial refund') { $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']); } if (urldecode($response['L_LONGMESSAGE0']) == 'The partial refund amount must be less than or equal to the remaining amount') { $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']); } if (urldecode($response['L_LONGMESSAGE0']) == 'You can not refund this type of transaction') { $response['L_SHORTMESSAGE0'] = urldecode($response['L_LONGMESSAGE0']); } $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; case 'DoAuthorization': case 'DoReauthorization': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_AUTH_ERROR; $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; case 'DoCapture': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_CAPT_ERROR; if ($response['RESULT'] == 111) { $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG']; } $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; case 'DoVoid': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_VOID_ERROR; if ($response['RESULT'] == 12) { $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG']; } if ($response['RESULT'] == 108) { $response['L_SHORTMESSAGE0'] = $response['RESULT'] . ' ' . $response['RESPMSG']; } $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; case 'GetTransactionDetails': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GETDETAILS_ERROR; $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; case 'TransactionSearch': if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_TRANSSEARCH_ERROR; $errorText .= ' (' . urldecode($response['L_SHORTMESSAGE0']) . ') ' . $response['L_ERRORCODE0']; $messageStack->add_session($errorText, 'error'); return true; } break; default: if ($basicError) { // if error, display error message. If debug options enabled, email dump to store owner if ($this->enableDebugging) { $this->_doDebug('PayPal Error Log - ' . $operation, "Value List:\r\n" . str_replace('&', "\r\n", $doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList))) . "\r\n\r\nResponse:\r\n" . print_r($response, true)); } $errorText = MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_API_ERROR; $errorNum .= ' (' . urldecode($response['L_SHORTMESSAGE0'] . ' ' . $response['RESPMSG']) . ') ' . $response['L_ERRORCODE0']; $detailedMessage = $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_GEN_API_ERROR || $errorText == MODULE_PAYMENT_PAYPALWPP_TEXT_DECLINED || $this->enableDebugging || $response['CURL_ERRORS'] != '' || $this->emailAlerts ? urldecode(' ' . $response['L_SHORTMESSAGE0'] . ' - ' . $response['L_LONGMESSAGE0'] . ' ' . $response['CURL_ERRORS']) : ''; $detailedEmailMessage = $detailedMessage == '' ? '' : MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_MESSAGE . urldecode($response['L_ERRORCODE0'] . "\n" . $response['L_SHORTMESSAGE0'] . "\n" . $response['L_LONGMESSAGE0'] . $response['L_ERRORCODE1'] . "\n" . $response['L_SHORTMESSAGE1'] . "\n" . $response['L_LONGMESSAGE1'] . $response['L_ERRORCODE2'] . "\n" . $response['L_SHORTMESSAGE2'] . "\n" . $response['L_LONGMESSAGE2'] . ($response['CURL_ERRORS'] != '' ? "\n" . $response['CURL_ERRORS'] : '') . "\n\n" . 'Zen Cart message: ' . $detailedMessage . "\n\n" . 'Transaction Response Details: ' . print_r($response, true) . "\n\n" . 'Transaction Submission: ' . urldecode($doPayPal->_sanitizeLog($doPayPal->_parseNameValueList($doPayPal->lastParamList), true))); if ($detailedEmailMessage != '') { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, MODULE_PAYMENT_PAYPALWPP_TEXT_EMAIL_ERROR_SUBJECT . ' (' . $errorNum . ')', $detailedMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($detailedEmailMessage)), 'paymentalert'); } $messageStack->add_session($errorText . $errorNum . $detailedMessage, 'error'); return true; } break; } }
* affiliate Page * * @package page * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: header_php.php 1.3 $ */ $_SESSION['navigation']->remove_current_page(); require DIR_WS_MODULES . zen_get_module_directory('require_languages.php'); // include template specific file name defines $define_page = zen_define_page(FILENAME_DEFINE_AFFILIATE, false); $breadcrumb->add(NAVBAR_TITLE); if (isset($_POST['action']) && $_POST['action'] == 'register') { $name = $_POST['userName']; $userEmail = $_POST['userEmail']; $userWeb = $_POST['userWeb']; $userPhone = $_POST['userPhone']; $userComments = $_POST['userComments']; // add in regular email welcome text $email_text .= "\n\n" . $userWeb . '<br/>' . $userPhone . '<br/>' . $userComments; $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT); $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT); $html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_GV_CLOSURE); // include create-account-specific disclaimer $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>'); // send welcome email zen_mail(STORE_NAME, EMAIL_FROM, 'Affiliate programe', $email_text, $name, $email_address, $html_msg, ''); $messageStack->add('affi', TEXT_AFFILIATE_SUCCESS, 'success'); }
function send_order_email($zf_insert_id, $zf_mode) { global $currencies, $order_totals; // print_r($this); // die(); if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL == '1') { // send an email $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock; zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock'); } // lets start with the email confirmation // make an array to store the html version $html_msg = array(); //intro area $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . EMAIL_GREET . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n" . ($html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER); $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM; $html_msg['INTRO_STORE_NAME'] = STORE_NAME; $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING; $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW; $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER; $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id; $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED; $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG); //comments area if ($this->info['comments']) { $email_order .= zen_db_output($this->info['comments']) . "\n\n"; $html_msg['ORDER_COMMENTS'] = zen_db_output($this->info['comments']); } else { $html_msg['ORDER_COMMENTS'] = ''; } //products area $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n"; $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS; $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>'; //order totals area $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . ' ' . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td></tr><tr>'; for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; $html_ot .= '<td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td><td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td></tr><tr>'; } $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2">' . $html_ot . '</table>'; $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION; $html_msg['ADDRESS_CUSTOMER_TITLE'] = EMAIL_TEXT_CUSTOMER_ADDRESS; $html_msg['ADDRESS_CUSTOMER_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, '', "<br />") . '<br />' . ENTRY_EMAIL_ADDRESS . $this->customer['email_address']; $email_order .= "\n" . EMAIL_TEXT_CUSTOMER_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], 0, '', "\n") . "\n" . ENTRY_EMAIL_ADDRESS . $this->customer['email_address'] . "\n"; //addresses area: Delivery $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS; $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a'; $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD; $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a'; if ($this->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n"; } //addresses area: Billing $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n"; $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS; $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />"); if (is_object($GLOBALS[$_SESSION['payment']])) { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $_SESSION['payment']; $email_order .= $GLOBALS[$payment_class]->title . "\n\n"; if ($GLOBALS[$payment_class]->email_footer) { $email_order .= $GLOBALS[$payment_class]->email_footer . "\n\n"; } } else { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $email_order .= PAYMENT_METHOD_GV . "\n\n"; } $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD; $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV; $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->email_footer : ''; $html_msg['EMAIL_VISITORS_DISCLAIMER'] = sprintf(EMAIL_VISITORS_DISCLAIMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>'); // include disclaimer $email_order .= "\n-----\n" . sprintf(EMAIL_VISITORS_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; // include copyright $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n"; while (strstr($email_order, ' ')) { $email_order = str_replace(' ', ' ', $email_order); } $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname']; $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname']; $html_msg['EMAIL_GREET'] = EMAIL_GREET; // $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER; $html_msg['EXTRA_INFO'] = ''; zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors'); // send additional emails if (SEND_EXTRA_ORDER_EMAILS_TO != '') { $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_VISITORS_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_visitors_extra'); } }
if (!isset($_SESSION['login_attempt'])) { $_SESSION['login_attempt'] = 0; } $_SESSION['login_attempt']++; } // END SLAM PREVENTION if ($error == false) { $new_password = zen_create_PADSS_password((int) ADMIN_PASSWORD_MIN_LENGTH < 7 ? 7 : (int) ADMIN_PASSWORD_MIN_LENGTH); $resetToken = time() + ADMIN_PWD_TOKEN_DURATION . '}' . zen_encrypt_password($new_password); $sql = "update " . TABLE_ADMIN . " set reset_token = :token: where admin_id = :admID: "; $sql = $db->bindVars($sql, ':token:', $resetToken, 'string'); $sql = $db->bindVars($sql, ':admID:', $result->fields['admin_id'], 'string'); $db->Execute($sql); $html_msg['EMAIL_CUSTOMERS_NAME'] = $result->fields['admin_name']; $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(TEXT_EMAIL_MESSAGE_PWD_RESET, $_SERVER['REMOTE_ADDR'], $new_password); zen_mail($result->fields['admin_name'], $result->fields['admin_email'], TEXT_EMAIL_SUBJECT_PWD_RESET, sprintf(TEXT_EMAIL_MESSAGE_PWD_RESET, $_SERVER['REMOTE_ADDR'], $new_password), STORE_NAME, EMAIL_FROM, $html_msg, 'password_forgotten_admin'); $email_message = MESSAGE_PASSWORD_SENT; } } ?> <!DOCTYPE html > <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?> "> <title><?php
// Here we check to see if we have clicked on the Hide RadioButton and if so, set the Variable to -1 if (isset($_POST['notify']) && $_POST['notify'] == '-1') { // hide comment $customer_notified = '-1'; } // OK, we have our Customer Notified Status Number, now update the Order Status History Table update_status($oID, $status, $customer_notified, $comments); // Send E-Mail to Customer if they should be notified. Send comments if append comments is checked. if ($customer_notified == '1') { if (isset($_POST['notify_comments'])) { $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $_POST[comments]) . "\n\n"; } $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' <a href="' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . '">' . zen_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "</a>\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . zen_date_long($check_status->fields['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]); $html_msg['EMAIL_MESSAGE_HTML'] = str_replace(' ', '<br />', $email); zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $html_msg, NULL); } } // Update Products $RunningSubTotal = 0; $RunningTax = 0; $update_products = $_POST['update_products']; foreach ($update_products as $orders_products_id => $products_details) { $AddedOptionsPrice = 0; $AddedOptionsPrice_OneTime = 0; // Update orders_products Table //UPDATE_INVENTORY_QUANTITY_START############################################################################################################## #$order = zen_db_fetch_array($order_query); if ($products_details["qty"] != $order_query->fields['products_quantity']) { $differenza_quantita = $products_details["qty"] - $order_query->fields['products_quantity']; if (STOCK_LIMITED == "true") {
$send_to_name = preg_replace('/\\<[^*]*/', '', $send_to_array[$_POST['send_to']]); } else { //otherwise default to EMAIL_FROM and store name $send_to_email = EMAIL_FROM; $send_to_name = STORE_NAME; } // Prepare extra-info details $extra_info = email_collect_extra_info($name, $email_address, $customer_name, $customer_email); // Prepare Text-only portion of message $text_message = OFFICE_FROM . "\t" . $name . "\n" . OFFICE_EMAIL . "\t" . $email_address . "\n\n" . '------------------------------------------------------' . "\n\n" . strip_tags($_POST['enquiry']) . "\n\n" . '------------------------------------------------------' . "\n\n" . $extra_info['TEXT']; // Prepare HTML-portion of message $html_msg['EMAIL_MESSAGE_HTML'] = strip_tags($_POST['enquiry']); $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $email_address . ')'; $html_msg['EXTRA_INFO'] = $extra_info['HTML']; // Send message zen_mail($send_to_name, $send_to_email, EMAIL_SUBJECT, $text_message, $name, $email_address, $html_msg, 'contact_us'); zen_redirect(zen_href_link(FILENAME_CONTACT_US, 'action=success')); } else { $error = true; if (empty($name)) { $messageStack->add('contact', ENTRY_EMAIL_NAME_CHECK_ERROR); } if ($zc_validate_email == false) { $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR); } if (empty($enquiry)) { $messageStack->add('contact', ENTRY_EMAIL_CONTENT_CHECK_ERROR); } } } else { $error = true;
$html_msg['EMAIL_TEXT_NEW_STATUS'] = $orders_status_array[$status]; $html_msg['EMAIL_TEXT_STATUS_PLEASE_REPLY'] = str_replace('\\n', '', EMAIL_TEXT_STATUS_PLEASE_REPLY); $html_msg['EMAIL_PAYPAL_TRANSID'] = ''; zen_mail($check_status->fields['customers_name'], $check_status->fields['customers_email_address'], EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status'); $customer_notified = '1'; // PayPal Trans ID, if any $sql = "select txn_id, parent_txn_id from " . TABLE_PAYPAL . " where order_id = :orderID order by last_modified DESC, date_added DESC, parent_txn_id DESC, paypal_ipn_id DESC "; $sql = $db->bindVars($sql, ':orderID', $oID, 'integer'); $result = $db->Execute($sql); if ($result->RecordCount() > 0) { $message .= "\n\n" . ' PayPal Trans ID: ' . $result->fields['txn_id']; $html_msg['EMAIL_PAYPAL_TRANSID'] = $result->fields['txn_id']; } //send extra emails if (SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO != '') { zen_mail('', SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO, SEND_EXTRA_ORDERS_STATUS_ADMIN_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . ' #' . $oID, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'order_status_extra'); } } elseif (isset($_POST['notify']) && $_POST['notify'] == '-1') { // hide comment $customer_notified = '-1'; } $db->Execute("insert into " . TABLE_ORDERS_STATUS_HISTORY . "\n (orders_id, orders_status_id, date_added, customer_notified, comments)\n values ('" . (int) $oID . "',\n '" . zen_db_input($status) . "',\n now(),\n '" . zen_db_input($customer_notified) . "',\n '" . zen_db_input($comments) . "')"); $order_updated = true; } // trigger any appropriate updates which should be sent back to the payment gateway: $order = new order((int) $oID); if ($order->info['payment_module_code']) { if (file_exists(DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php')) { require_once DIR_FS_CATALOG_MODULES . 'payment/' . $order->info['payment_module_code'] . '.php'; require_once DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_module_code'] . '.php'; $module = new $order->info['payment_module_code']();
} else { $subscribe = true; // we generate a random confirmation code so we can use it as an // extra security measure to prevent spoofs/scams. $confirm_code = substr(base64_encode(crypt(str_shuffle(time()))), 4, 6); $db->Execute('insert into ' . TABLE_SUBSCRIBERS . ' (email_address, email_format, subscribed_date, confirmed) ' . "VALUES ('" . zen_db_input($email_address) . "', '" . zen_db_input($email_format) . "', now(), '" . $confirm_code . "')"); // Send confirmation request. // get the proper uri $confirm_uri = zen_href_link(FILENAME_SUBSCRIBE_CONFIRM, 'confirm=' . $confirm_code . '&email=' . $email_address, 'NONSSL'); // initial welcome $email_text .= EMAIL_WELCOME; $html_msg['EMAIL_WELCOME'] = str_replace('\\n', '', EMAIL_WELCOME); // add in regular email welcome text $email_text .= "\n\n" . EMAIL_TEXT . sprintf(EMAIL_CONFIRMATION_TEXT, $confirm_uri) . EMAIL_CONTACT . EMAIL_CLOSURE; $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT); $html_msg['EMAIL_CONFIRMATION_LINK'] = str_replace('\\n', '', sprintf(EMAIL_CONFIRMATION_TEXT, '<a href="' . $confirm_uri . '">' . $confirm_uri . '</a>')); $html_msg['EMAIL_CONTACT_OWNER'] = str_replace('\\n', '', EMAIL_CONTACT); $html_msg['EMAIL_CLOSURE'] = nl2br(EMAIL_CLOSURE); // include create-account-specific disclaimer $email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>'); // send welcome email zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletter_subscription'); if (defined('NEWSONLY_SUBSCRIPTION_CC_STATUS') && defined('NEWSONLY_SUBSCRIPTION_CC') && NEWSONLY_SUBSCRIPTION_CC_STATUS == 1 && strlen(NEWSONLY_SUBSCRIPTION_CC) > 4) { // send email to notify store owner of new subscriber $email_text = 'A Newsletter-Only Subscriber using the address ' . $email_address . "\n" . 'was added on ' . strftime(DATE_FORMAT_LONG) . '.'; mail(EMAIL_FROM, 'Subscriber Notification', $email_text, "From: " . STORE_NAME . "\r\nReply-to: " . EMAIL_FROM . "\r\n"); } } } $breadcrumb->add(NAVBAR_TITLE);
$attachment_file = $_POST['attachment_file']; $attachment_fname = basename($_POST['attachment_file']); $attachment_filetype = $_POST['attachment_filetype']; // demo active test if (zen_admin_demo()) { $_GET['action'] = ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to))); } //send message using the zen email function //echo'EOF-attachments_list='.$attachment_file.'->'.$attachment_filetype; $recip_count = 0; while (!$mail->EOF) { $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], $subject, $message, STORE_NAME, $from, $html_msg, 'direct_email', array('file' => $attachment_file, 'name' => basename($attachment_file), 'mime_type' => $attachment_filetype)); $recip_count++; $mail->MoveNext(); } if ($recip_count > 0) { $messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $mail_sent_to . ' (' . $recip_count . ')'), 'success'); } else { $messageStack->add_session(sprintf(NOTICE_EMAIL_FAILED_SEND, $mail_sent_to . ' (' . $recip_count . ')'), 'error'); } zen_redirect(zen_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to) . '&recip_count=' . $recip_count . (isset($_GET['origin']) ? '&origin=' . zen_output_string_protected($_GET['origin']) : '') . (isset($_GET['cID']) ? '&cID=' . (int) $_GET['cID'] : '') . (isset($_GET['customer']) ? '&customer=' . zen_output_string_protected($_GET['customer']) : ''))); } if (EMAIL_ATTACHMENTS_ENABLED && $action == 'preview') { // PROCESS UPLOAD ATTACHMENTS if (isset($_FILES['upload_file']) && zen_not_null($_FILES['upload_file']) && $_POST['upload_file'] != 'none') { if ($attachments_obj = new upload('upload_file')) { $attachments_obj->set_destination(DIR_WS_ADMIN_ATTACHMENTS . $_POST['attach_dir']);
<?php die; break; case 'list_addresses_done': $action = ''; zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int) $_GET['cID'] . '&page=' . $_GET['page'], 'NONSSL')); break; case 'status': if (isset($_POST['current']) && is_numeric($_POST['current'])) { if ($_POST['current'] == CUSTOMERS_APPROVAL_AUTHORIZATION) { $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization=0 where customers_id='" . (int) $customers_id . "'"; $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname\n from " . TABLE_CUSTOMERS . "\n where customers_id = '" . (int) $customers_id . "'"); if ((int) CUSTOMERS_APPROVAL_AUTHORIZATION > 0 && (int) $_POST['current'] > 0 && $custinfo->RecordCount() > 0) { $message = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE; $html_msg['EMAIL_MESSAGE_HTML'] = EMAIL_CUSTOMER_STATUS_CHANGE_MESSAGE; zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], EMAIL_CUSTOMER_STATUS_CHANGE_SUBJECT, $message, STORE_NAME, EMAIL_FROM, $html_msg, 'default'); } zen_record_admin_activity('Customer-approval-authorization set customer auth status to 0 for customer ID ' . (int) $customers_id, 'info'); } else { $sql = "update " . TABLE_CUSTOMERS . " set customers_authorization='" . CUSTOMERS_APPROVAL_AUTHORIZATION . "' where customers_id='" . (int) $customers_id . "'"; zen_record_admin_activity('Customer-approval-authorization set customer auth status to ' . CUSTOMERS_APPROVAL_AUTHORIZATION . ' for customer ID ' . (int) $customers_id, 'info'); } $db->Execute($sql); $action = ''; zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int) $customers_id . '&page=' . $_GET['page'], 'NONSSL')); } $action = ''; break; case 'update': $customers_firstname = zen_db_prepare_input(zen_sanitize_string($_POST['customers_firstname'])); $customers_lastname = zen_db_prepare_input(zen_sanitize_string($_POST['customers_lastname']));
$html_msg['GV_CODE_URL'] = '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'index.php?main_page=gv_redeem&gv_no=' . $id1 . '">' . TEXT_CLICK_TO_REDEEM . '</a>' . " "; } $message .= TEXT_OR_VISIT . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . TEXT_ENTER_CODE . "\n\n"; $html_msg['GV_CODE_URL'] .= TEXT_OR_VISIT . '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . '">' . STORE_NAME . '</a>' . 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_GV_ADMIN_EMAILS_TO_STATUS == '1' and SEND_EXTRA_GV_ADMIN_EMAILS_TO != '') { zen_mail('', SEND_EXTRA_GV_ADMIN_EMAILS_TO, SEND_EXTRA_GV_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 . "\n (coupon_code, coupon_type, coupon_amount, date_created)\n values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())"); $insert_id = $db->Insert_id(); $insert_query = $db->Execute("insert into " . TABLE_COUPON_EMAIL_TRACK . "\n (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent)\n values ('" . $insert_id . "', '0', 'Admin',\n '" . $_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) {
$email_text .= "\n\n" . sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; $html_msg['EMAIL_DISCLAIMER'] = sprintf(EMAIL_DISCLAIMER_NEW_CUSTOMER, '<a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">' . STORE_OWNER_EMAIL_ADDRESS . ' </a>'); // send welcome email if (trim(EMAIL_SUBJECT) != 'n/a') { zen_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_NAME, EMAIL_FROM, $html_msg, 'welcome'); } // send additional emails if (SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_STATUS == '1' and SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO != '') { if ($_SESSION['customer_id']) { $account_query = "select customers_firstname, customers_lastname, customers_email_address, customers_telephone, customers_fax\n from " . TABLE_CUSTOMERS . "\n where customers_id = '" . (int) $_SESSION['customer_id'] . "'"; $account = $db->Execute($account_query); } $extra_info = email_collect_extra_info($name, $email_address, $account->fields['customers_firstname'] . ' ' . $account->fields['customers_lastname'], $account->fields['customers_email_address'], $account->fields['customers_telephone'], $account->fields['customers_fax']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; if (trim(SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT) != 'n/a') { zen_mail('', SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO, SEND_EXTRA_CREATE_ACCOUNT_EMAILS_TO_SUBJECT . ' ' . EMAIL_SUBJECT, $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'welcome_extra'); } } //endif send extra emails } zen_redirect(zen_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL')); } //endif !error } /* * Set flags for template use: */ $selected_country = isset($_POST['zone_country_id']) && $_POST['zone_country_id'] != '' ? $country : SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY; $flag_show_pulldown_states = ($process == true || $entry_state_has_zones == true) && $zone_name == '' || ACCOUNT_STATE_DRAW_INITIAL_DROPDOWN == 'true' || $error_state_input ? true : false; $state = $flag_show_pulldown_states ? $state == '' ? ' ' : $state : $zone_name; $state_field_label = $flag_show_pulldown_states ? '' : ENTRY_STATE;
/** * Send transaction to gateway */ function _sendRequest($myorder) { $myorder["host"] = "secure.linkpt.net"; if (MODULE_PAYMENT_LINKPOINT_API_TRANSACTION_MODE == 'DevelopersTest') { $myorder["host"] = "staging.linkpt.net"; } $myorder["port"] = "1129"; $myorder["keyfile"] = DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/linkpoint_api/' . MODULE_PAYMENT_LINKPOINT_API_LOGIN . '.pem'; $myorder["configfile"] = MODULE_PAYMENT_LINKPOINT_API_LOGIN; // This is your store number // set to ECI and UNSPECIFIED for ecommerce transactions: $myorder["transactionorigin"] = "ECI"; $myorder["terminaltype"] = "UNSPECIFIED"; // debug - for testing communication only if (MODULE_PAYMENT_LINKPOINT_API_DEBUG != 'Off') { } if (MODULE_PAYMENT_LINKPOINT_API_CODE_DEBUG == 'debug') { $myorder["debugging"] = "true"; // for development only - not intended for production use $myorder["debug"] = "true"; // for development only - not intended for production use $myorder["webspace"] = "true"; // for development only - not intended for production use } include DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/linkpoint_api/class.linkpoint_api.php'; $mylphp = new lphp(); // Send transaction, using cURL $result = $mylphp->curl_process($myorder); // do debug output $errorMessage = date('M-d-Y h:i:s') . "\n=================================\n\n" . ($mylphp->commError != '' ? $mylphp->commError . "\n\n" : '') . 'Response Code: ' . $result["r_approved"] . ' ' . $result["r_error"] . "\n\n=================================\n\n" . 'Sending to Gateway: ' . "\n" . $mylphp->sendData . "\n\n" . 'Result: ' . substr(print_r($result, true), 5) . "\n\n"; if ($mylphp->commError != '') { $errorMessage .= $mylphp->commError . "\n" . 'CURL info: ' . print_r($mylphp->commInfo, true) . "\n"; } if (CURL_PROXY_REQUIRED == 'True') { $errorMessage .= 'Using CURL Proxy: [' . CURL_PROXY_SERVER_DETAILS . '] with Proxy Tunnel: ' . ($proxy_tunnel_flag ? 'On' : 'Off') . "\n"; } $failure = !is_array($result) || $result["r_approved"] != "APPROVED" ? true : false; // handle logging if (strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Log')) { $this->_log($errorMessage, $myorder["oid"] . ($failure ? '_FAILED' : '')); // $this->_log($errorMessage . print_r($myorder, true) . print_r($mylphp->xmlString, true), $myorder["oid"] . ($failure ? '_FAILED' : '')); } if (strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Email') || $failure && strstr(MODULE_PAYMENT_LINKPOINT_API_DEBUG, 'Alert')) { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'Linkpoint Debug Data' . ($failure ? ' - FAILURE' : ''), $errorMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($errorMessage)), 'debug'); } //DEBUG ONLY:$this->_log($errorMessage /*. print_r($myorder, true) . print_r($mylphp->xmlString, true)*/, $myorder["oid"]); if ($myorder['debugging'] == 'true') { exit; } return $result; }
header("Content-Length: " . (string) $downloadFilesize); } $disabled_funcs = @ini_get("disable_functions"); if (DOWNLOAD_IN_CHUNKS != 'true' && !strstr($disabled_funcs, 'readfile')) { $zco_notifier->notify('NOTIFY_DOWNLOAD_WITHOUT_REDIRECT___COMPLETED', $origin_filename); // This will work on all systems, but will need considerable resources readfile(DIR_FS_DOWNLOAD . $origin_filename); } else { // override PHP timeout to 25 minutes, if allowed @set_time_limit(1500); $zco_notifier->notify('NOTIFY_DOWNLOAD_IN_CHUNKS___COMPLETED', $origin_filename); // loop with fread($fp, xxxx) to allow streaming in chunk sizes below the PHP memory_limit $handle = @fopen(DIR_FS_DOWNLOAD . $origin_filename, "rb"); if ($handle) { while (!@feof($handle)) { echo fread($handle, 4096); @flush(); } fclose($handle); } else { // Throw error condition -- this should never happen! $messageStack->add_session('default', 'Please contact store owner. ERROR: Cannot read file: ' . $origin_filename, 'error'); zen_mail('', STORE_OWNER_EMAIL_ADDRESS, ERROR_CUSTOMER_DOWNLOAD_FAILURE, "Unable to open file '" . $origin_filename . " for reading. Check the file permissions.", STORE_NAME, EMAIL_FROM); } $zco_notifier->notify('NOTIFY_DOWNLOAD_WITHOUT_REDIRECT_VIA_CHUNKS___COMPLETED'); } } // This should be last line of the script: $zco_notifier->notify('NOTIFY_HEADER_END_DOWNLOAD'); // finally, upon completion of the download, the script should end here and not attempt to display any template components etc. zen_exit();
/** * Log the current transaction depending on the current log level. * * @access protected * * @param string $operation The operation called. * @param integer $elapsed Microseconds taken. * @param object $response The response. */ function _logTransaction($operation, $elapsed, $response, $errors) { $values = $this->_parseNameValueList($response); $token = isset($values['TOKEN']) ? $values['TOKEN'] : ''; $token = preg_replace('/[^0-9.A-Z\\-]/', '', urldecode($token)); switch ($this->_logLevel) { case PEAR_LOG_DEBUG: $message = date('Y-m-d h:i:s') . "\n-------------------\n"; $message .= '(' . $this->_server . ' transaction) --> ' . $this->_endpoints[$this->_server] . "\n"; $message .= 'Request Headers: ' . "\n" . $this->_sanitizeLog($this->lastHeaders) . "\n\n"; $message .= 'Request Parameters: {' . $operation . '} ' . "\n" . urldecode($this->_sanitizeLog($this->_parseNameValueList($this->lastParamList))) . "\n\n"; $message .= 'Response: ' . "\n" . urldecode($this->_sanitizeLog($values)) . $errors; $this->log($message, $token); // extra debug email: // if (MODULE_PAYMENT_PAYPALWPP_DEBUGGING == 'Log and Email') { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'PayPal Debug log - ' . $operation, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($message)), 'debug'); } case PEAR_LOG_INFO: $success = false; if ($response) { if (isset($values['RESULT']) && $values['RESULT'] == 0 || strstr($values['ACK'], 'Success') || strstr($values['ACK'], 'SuccessWithWarning')) { $success = true; } } $this->log($operation . ', Elapsed: ' . $elapsed . 'ms -- ' . (isset($values['ACK']) ? $values['ACK'] : ($success ? 'Succeeded' : 'Failed')) . $errors, $token); case PEAR_LOG_ERR: if (!$response) { $this->log('No response from server' . $errors, $token); } else { if (isset($values['RESULT']) && $values['RESULT'] != 0 || strstr($values['ACK'], 'Failure')) { $this->log($response . $errors, $token); } } } }
function send($newsletter_id) { global $_POST, $db; $audience = array(); if (isset($_POST['global']) && $_POST['global'] == 'true') { $products = $db->Execute("select distinct pn.customers_id, c.customers_firstname,\r\n c.customers_lastname, c.customers_email_address\r\n from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn\r\n where c.customers_id = pn.customers_id"); while (!$products->EOF) { $audience[$products->fields['customers_id']] = array('firstname' => $products->fields['customers_firstname'], 'lastname' => $products->fields['customers_lastname'], 'email_address' => $products->fields['customers_email_address']); $products->MoveNext(); } $customers = $db->Execute("select c.customers_id, c.customers_firstname, c.customers_lastname,\r\n c.customers_email_address\r\n from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci\r\n where c.customers_id = ci.customers_info_id\r\n and ci.global_product_notifications = '1'"); while (!$customers->EOF) { $audience[$customers->fields['customers_id']] = array('firstname' => $customers->fields['customers_firstname'], 'lastname' => $customers->fields['customers_lastname'], 'email_address' => $customers['customers_email_address']); $customers->MoveNext(); } } else { //not global==true; instead, process all selected products $chosen = $_POST['chosen']; $ids = implode(',', $chosen); $products = $db->Execute("select distinct pn.customers_id, c.customers_firstname,\r\n c.customers_lastname, c.customers_email_address\r\n from " . TABLE_CUSTOMERS . " c, " . TABLE_PRODUCTS_NOTIFICATIONS . " pn\r\n where c.customers_id = pn.customers_id\r\n and pn.products_id in (" . $ids . ")"); while (!$products->EOF) { $audience[$products->fields['customers_id']] = array('firstname' => $products->fields['customers_firstname'], 'lastname' => $products->fields['customers_lastname'], 'email_address' => $products->fields['customers_email_address']); $products->MoveNext(); } $customers = $db->Execute("select c.customers_id, c.customers_firstname, c.customers_lastname,\r\n c.customers_email_address\r\n from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_INFO . " ci\r\n where c.customers_id = ci.customers_info_id\r\n and ci.global_product_notifications = '1'"); while (!$customers->EOF) { $audience[$customers->fields['customers_id']] = array('firstname' => $customers->fields['customers_firstname'], 'lastname' => $customers->fields['customers_lastname'], 'email_address' => $customers->fields['customers_email_address']); $customers->MoveNext(); } } //send emails reset($audience); $i = 0; while (list($key, $value) = each($audience)) { $i++; $html_msg['EMAIL_FIRST_NAME'] = $value['firstname']; $html_msg['EMAIL_LAST_NAME'] = $value['lastname']; $html_msg['EMAIL_GREET'] = EMAIL_GREET; $html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html; zen_mail($value['firstname'] . ' ' . $value['lastname'], $value['email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'product_notification', ''); echo zen_image(DIR_WS_ICONS . 'tick.gif', $value['email_address']); //force output to the screen to show status indicator each time a message is sent... if (function_exists('ob_flush')) { @ob_flush(); } @flush(); } $newsletter_id = zen_db_prepare_input($newsletter_id); $db->Execute("update " . TABLE_NEWSLETTERS . "\r\n set date_sent = now(), status = '1'\r\n where newsletters_id = '" . zen_db_input($newsletter_id) . "'"); return $i; //return number of records processed whether successful or not }
$sql_data_array = array('links_id' => $links_id, 'language_id' => $language_id, 'links_title' => $links_title, 'links_description' => $links_description); zen_db_perform(TABLE_LINKS_DESCRIPTION, $sql_data_array); // build the message content $name = $links_contact_name; $email_text = sprintf(EMAIL_GREET_NONE, $name); $email_text .= EMAIL_WELCOME; $email_text .= EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING; $email_store_text = EMAIL_OWNER_TEXT . $links_title . "\n\n" . $links_url . "\n\n" . $links_description; // Prepare HTML-portion of message $html_msg['EMAIL_GREETING'] = str_replace('\\n', '', $email_text); $html_msg['EMAIL_WELCOME'] = str_replace('\\n', '', EMAIL_WELCOME); $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', EMAIL_TEXT); $html_msg['CONTACT_US_OFFICE_FROM'] = OFFICE_FROM . ' ' . $name . '<br />' . OFFICE_EMAIL . '(' . $links_contact_email . ')'; $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail($name, $links_contact_email, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $html_msg, 'Link Exchange'); zen_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_OWNER_SUBJECT, $email_store_text, $name, $links_contact_email, $html_msg, 'Link Exchange'); zen_redirect(zen_href_link(FILENAME_LINKS_SUBMIT, 'action=success')); } } // links breadcrumb if ($_SESSION['customer_id']) { $check_customer = $db->Execute("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . "'"); $email = $check_customer->fields['customers_email_address']; $name = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname']; } // include template specific file name defines $define_page = zen_define_page(FILENAME_DEFINE_LINKS_SUBMIT, false); $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_LINKS, '', 'NONSSL')); if (isset($GET['lPath'])) { $link_categories_value = $db->Execute("select * from " . TABLE_LINK_CATEGORIES_DESCRIPTION . " where link_categories_id = '" . (int) $GET['lPath'] . "' and language_id = '" . (int) $_SESSION['languages_id'] . "' "); $breadcrumb->add($link_categories_value->fields['link_categories_name'], zen_href_link(FILENAME_LINKS, 'lPath=' . $link_categories_value->fields['link_categories_id'], 'NONSSL'));
$_SESSION['login_attempt'] = 0; } $_SESSION['login_attempt']++; } // END SLAM PREVENTION $email_address = zen_db_prepare_input($_POST['email_address']); $check_customer_query = "SELECT customers_firstname, customers_lastname, customers_password, customers_id\n FROM " . TABLE_CUSTOMERS . "\n WHERE customers_email_address = :emailAddress"; $check_customer_query = $db->bindVars($check_customer_query, ':emailAddress', $email_address, 'string'); $check_customer = $db->Execute($check_customer_query); if ($check_customer->RecordCount() > 0) { $zco_notifier->notify('NOTIFY_PASSWORD_FORGOTTEN_VALIDATED'); $new_password = zen_create_PADSS_password(ENTRY_PASSWORD_MIN_LENGTH > 0 ? ENTRY_PASSWORD_MIN_LENGTH : 5); $crypted_password = zen_encrypt_password($new_password); $sql = "UPDATE " . TABLE_CUSTOMERS . "\n SET customers_password = :password\n WHERE customers_id = :customersID"; $sql = $db->bindVars($sql, ':password', $crypted_password, 'string'); $sql = $db->bindVars($sql, ':customersID', $check_customer->fields['customers_id'], 'integer'); $db->Execute($sql); $html_msg['EMAIL_CUSTOMERS_NAME'] = $check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname']; $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password); // send the email zen_mail($check_customer->fields['customers_firstname'] . ' ' . $check_customer->fields['customers_lastname'], $email_address, EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_NAME, EMAIL_FROM, $html_msg, 'password_forgotten'); $messageStack->add_session('login', SUCCESS_PASSWORD_SENT, 'success'); zen_redirect(zen_href_link(FILENAME_LOGIN, '', 'SSL')); } else { $messageStack->add('password_forgotten', TEXT_NO_EMAIL_ADDRESS_FOUND); } } $breadcrumb->add(NAVBAR_TITLE_1, zen_href_link(FILENAME_LOGIN, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2); // This should be last line of the script: $zco_notifier->notify('NOTIFY_HEADER_END_PASSWORD_FORGOTTEN');
$html_msg['EMAIL_LAST_NAME'] = $mail->fields['customers_lastname']; $html_msg['EMAIL_MESSAGE_HTML'] = zen_db_prepare_input($_POST['message_html']); $html_msg['COUPON_TEXT_TO_REDEEM'] = TEXT_TO_REDEEM; $html_msg['COUPON_TEXT_VOUCHER_IS'] = TEXT_VOUCHER_IS; $html_msg['COUPON_CODE'] = $coupon_result->fields['coupon_code'] . $html_coupon_help; $html_msg['COUPON_DESCRIPTION'] = !empty($coupon_name->fields['coupon_description']) ? $coupon_name->fields['coupon_description'] : ''; $html_msg['COUPON_TEXT_REMEMBER'] = TEXT_REMEMBER; $html_msg['COUPON_REDEEM_STORENAME_URL'] = sprintf(TEXT_VISIT, '<a href="' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . '">' . STORE_NAME . '</a>'); //Send the emails zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], $subject, $message, '', $from, $html_msg, 'coupon'); $recip_count++; $mail->MoveNext(); } // send one to Admin if enabled 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, $html_msg, 'coupon_extra'); } zen_redirect(zen_href_link(FILENAME_COUPON_ADMIN, 'mail_sent_to=' . urlencode($mail_sent_to) . '&recip_count=' . $recip_count)); } 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'] . '(' . $_GET['recip_count'] . ')'), 'success'); $_GET['mail_sent_to'] = ''; } switch ($_GET['action']) { case 'set_editor': // Reset will be done by init_html_editor.php. Now we simply redirect to refresh page properly. $action = '';
zen_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER_EMAIL_ADDRESS, TEXT_EMAIL_SUBJECT_ADMIN_SETTINGS_CHANGED, $msg, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => $msg), 'admin_settings_changed'); $result = $module->install(); } if ($result != 'failed') { zen_redirect(zen_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class . '&action=edit', 'NONSSL')); } break; case 'removeconfirm': $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); $class = basename($_POST['module']); if (file_exists($module_directory . $class . $file_extension)) { include $module_directory . $class . $file_extension; $module = new $class(); $msg = sprintf(TEXT_EMAIL_MESSAGE_ADMIN_MODULE_REMOVED, preg_replace('/[^\\d\\w]/', '*', $_POST['module']), $admname); zen_record_admin_activity($msg, 'warning'); zen_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER_EMAIL_ADDRESS, TEXT_EMAIL_SUBJECT_ADMIN_SETTINGS_CHANGED, $msg, STORE_NAME, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => $msg), 'admin_settings_changed'); $result = $module->remove(); } zen_redirect(zen_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $class, 'NONSSL')); break; } } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;
$rs = $db->Execute($sql); $insert_id = $db->Insert_ID(); $sql = "insert into " . TABLE_REVIEWS_DESCRIPTION . "\r\n (reviews_id, languages_id, reviews_text)\r\n values ('" . (int) $insert_id . "', '" . (int) $_SESSION['languages_id'] . "', '" . zen_db_input($review_text) . "')"; $db->Execute($sql); // send review-notification email to admin if (REVIEWS_APPROVAL == '1' && SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO_STATUS == '1' and defined('SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO') and SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO != '') { $email_text = sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name']) . "\n\n"; $email_text .= sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text) . "\n\n"; $email_subject = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']); $html_msg['EMAIL_SUBJECT'] = sprintf(EMAIL_REVIEW_PENDING_SUBJECT, $product_info->fields['products_name']); $html_msg['EMAIL_MESSAGE_HTML'] = str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_INTRO, $product_info->fields['products_name'])); $html_msg['EMAIL_MESSAGE_HTML'] .= '<br />'; $html_msg['EMAIL_MESSAGE_HTML'] .= str_replace('\\n', '', sprintf(EMAIL_PRODUCT_REVIEW_CONTENT_DETAILS, $review_text)); $extra_info = email_collect_extra_info($name, $email_address, $customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname'], $customer->fields['customers_email_address']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; zen_mail('', SEND_EXTRA_REVIEW_NOTIFICATION_EMAILS_TO, $email_subject, $email_text . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'reviews_extra'); } // end send email zen_redirect(zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params(array('action')))); } } $products_price = zen_get_products_display_price($product_info->fields['products_id']); $products_name = $product_info->fields['products_name']; if ($product_info->fields['products_model'] != '') { $products_model = '<br /><span class="smallText">[' . $product_info->fields['products_model'] . ']</span>'; } else { $products_model = ''; } // set image // $products_image = $product_info->fields['products_image']; if ($product_info->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
function send_order_email($zf_insert_id, $zf_mode = FALSE) { global $currencies, $order_totals; $this->notify('NOTIFY_ORDER_SEND_EMAIL_INITIALIZE', array(), $zf_insert_id, $order_totals, $zf_mode); if (!defined('ORDER_EMAIL_DATE_FORMAT')) { define('ORDER_EMAIL_DATE_FORMAT', 'M-d-Y h:iA'); } $this->send_low_stock_emails = TRUE; $this->notify('NOTIFY_ORDER_SEND_LOW_STOCK_EMAILS'); if ($this->send_low_stock_emails && $this->email_low_stock != '' && SEND_LOWSTOCK_EMAIL == '1') { $email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock; zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)), 'low_stock'); } // lets start with the email confirmation // make an array to store the html version $html_msg = array(); //intro area $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n"; $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER; $html_msg['EMAIL_TEXT_FROM'] = EMAIL_TEXT_FROM; $html_msg['INTRO_STORE_NAME'] = STORE_NAME; $html_msg['EMAIL_THANKS_FOR_SHOPPING'] = EMAIL_THANKS_FOR_SHOPPING; $html_msg['EMAIL_DETAILS_FOLLOW'] = EMAIL_DETAILS_FOLLOW; $html_msg['INTRO_ORDER_NUM_TITLE'] = EMAIL_TEXT_ORDER_NUMBER; $html_msg['INTRO_ORDER_NUMBER'] = $zf_insert_id; $html_msg['INTRO_DATE_TITLE'] = EMAIL_TEXT_DATE_ORDERED; $html_msg['INTRO_DATE_ORDERED'] = strftime(DATE_FORMAT_LONG); $html_msg['INTRO_URL_TEXT'] = EMAIL_TEXT_INVOICE_URL_CLICK; $html_msg['INTRO_URL_VALUE'] = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false); $html_msg['EMAIL_CUSTOMER_PHONE'] = $this->customer['telephone']; $html_msg['EMAIL_ORDER_DATE'] = date(ORDER_EMAIL_DATE_FORMAT); $invoiceInfo = EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n"; $htmlInvoiceURL = EMAIL_TEXT_INVOICE_URL_CLICK; $htmlInvoiceValue = zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false); $email_order = EMAIL_TEXT_HEADER . EMAIL_TEXT_FROM . STORE_NAME . "\n\n" . $this->customer['firstname'] . ' ' . $this->customer['lastname'] . "\n\n" . EMAIL_THANKS_FOR_SHOPPING . "\n" . EMAIL_DETAILS_FOLLOW . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $zf_insert_id . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $zf_insert_id, 'SSL', false) . "\n\n"; //comments area if ($this->info['comments']) { $email_order .= zen_db_output($this->info['comments']) . "\n\n"; $html_msg['ORDER_COMMENTS'] = nl2br(zen_db_output($this->info['comments'])); } else { $html_msg['ORDER_COMMENTS'] = ''; } $this->notify('NOTIFY_ORDER_EMAIL_BEFORE_PRODUCTS', array(), $email_order, $html_msg); //products area $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $this->products_ordered . EMAIL_SEPARATOR . "\n"; $html_msg['PRODUCTS_TITLE'] = EMAIL_TEXT_PRODUCTS; $html_msg['PRODUCTS_DETAIL'] = '<table class="product-details" border="0" width="100%" cellspacing="0" cellpadding="2">' . $this->products_ordered_html . '</table>'; //order totals area $html_ot = '<tr><td class="order-totals-text" align="right" width="100%">' . ' ' . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . '---------' . '</td> </tr>' . "\n"; for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) { $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n"; $html_ot .= '<tr><td class="order-totals-text" align="right" width="100%">' . $order_totals[$i]['title'] . '</td> ' . "\n" . '<td class="order-totals-num" align="right" nowrap="nowrap">' . $order_totals[$i]['text'] . '</td> </tr>' . "\n"; } $html_msg['ORDER_TOTALS'] = '<table border="0" width="100%" cellspacing="0" cellpadding="2"> ' . $html_ot . ' </table>'; //addresses area: Delivery $html_msg['HEADING_ADDRESS_INFORMATION'] = HEADING_ADDRESS_INFORMATION; $html_msg['ADDRESS_DELIVERY_TITLE'] = EMAIL_TEXT_DELIVERY_ADDRESS; $html_msg['ADDRESS_DELIVERY_DETAIL'] = $this->content_type != 'virtual' ? zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], true, '', "<br />") : 'n/a'; $html_msg['SHIPPING_METHOD_TITLE'] = HEADING_SHIPPING_METHOD; $html_msg['SHIPPING_METHOD_DETAIL'] = zen_not_null($this->info['shipping_method']) ? $this->info['shipping_method'] : 'n/a'; if ($this->content_type != 'virtual') { $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['sendto'], 0, '', "\n") . "\n"; } //addresses area: Billing $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], 0, '', "\n") . "\n\n"; $html_msg['ADDRESS_BILLING_TITLE'] = EMAIL_TEXT_BILLING_ADDRESS; $html_msg['ADDRESS_BILLING_DETAIL'] = zen_address_label($_SESSION['customer_id'], $_SESSION['billto'], true, '', "<br />"); if (is_object($GLOBALS[$_SESSION['payment']])) { $cc_num_display = isset($this->info['cc_number']) && $this->info['cc_number'] != '' ? str_repeat('X', strlen($this->info['cc_number']) - 8) . substr($this->info['cc_number'], -4) . "\n\n" : ''; $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $payment_class = $_SESSION['payment']; $email_order .= $GLOBALS[$payment_class]->title . "\n\n"; $email_order .= isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : ''; $email_order .= $GLOBALS[$payment_class]->email_footer ? $GLOBALS[$payment_class]->email_footer . "\n\n" : ''; } else { $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n"; $email_order .= PAYMENT_METHOD_GV . "\n\n"; } $html_msg['PAYMENT_METHOD_TITLE'] = EMAIL_TEXT_PAYMENT_METHOD; $html_msg['PAYMENT_METHOD_DETAIL'] = is_object($GLOBALS[$_SESSION['payment']]) ? $GLOBALS[$payment_class]->title : PAYMENT_METHOD_GV; $html_msg['PAYMENT_METHOD_FOOTER'] = is_object($GLOBALS[$_SESSION['payment']]) && $GLOBALS[$payment_class]->email_footer != '' ? nl2br($GLOBALS[$payment_class]->email_footer) : (isset($this->info['cc_type']) && $this->info['cc_type'] != '' ? $this->info['cc_type'] . ' ' . $cc_num_display . "\n\n" : ''); // include disclaimer if (defined('EMAIL_DISCLAIMER') && EMAIL_DISCLAIMER != '') { $email_order .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; } // include copyright if (defined('EMAIL_FOOTER_COPYRIGHT')) { $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n"; } $email_order = str_replace(' ', ' ', $email_order); $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname']; $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname']; // $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER; $html_msg['EXTRA_INFO'] = ''; $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg), $email_order, $html_msg); zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray); // send additional emails if (SEND_EXTRA_ORDER_EMAILS_TO != '') { $extra_info = email_collect_extra_info('', '', $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], $this->customer['telephone']); $html_msg['EXTRA_INFO'] = $extra_info['HTML']; // include authcode and transaction id in admin-copy of email if ($GLOBALS[$_SESSION['payment']]->auth_code || $GLOBALS[$_SESSION['payment']]->transaction_id) { $pmt_details = ($GLOBALS[$_SESSION['payment']]->auth_code != '' ? 'AuthCode: ' . $GLOBALS[$_SESSION['payment']]->auth_code . ' ' : '') . ($GLOBALS[$_SESSION['payment']]->transaction_id != '' ? 'TransID: ' . $GLOBALS[$_SESSION['payment']]->transaction_id : '') . "\n\n"; $email_order = $pmt_details . $email_order; $html_msg['EMAIL_TEXT_HEADER'] = nl2br($pmt_details) . $html_msg['EMAIL_TEXT_HEADER']; } // Add extra heading stuff via observer class $this->extra_header_text = ''; $this->notify('NOTIFY_ORDER_INVOICE_CONTENT_FOR_ADDITIONAL_EMAILS', $zf_insert_id, $email_order, $html_msg); $email_order = $this->extra_header_text . $email_order; $html_msg['EMAIL_TEXT_HEADER'] = nl2br($this->extra_header_text) . $html_msg['EMAIL_TEXT_HEADER']; zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray, $this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address']); } $this->notify('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL', $zf_insert_id, $email_order, $extra_info, $html_msg); }
/** * Used to do any debug logging / tracking / storage as required. */ function _debugActions($response, $order_time = '', $sessID = '') { global $db; if ($order_time == '') { $order_time = date("F j, Y, g:i a"); } // convert output to 1-based array for easier understanding: $resp_output = $response; array_unshift($resp_output, 'Response from gateway' . (isset($response['ErrorDetails']) ? ': ' . $response['ErrorDetails'] : '')); // DEBUG LOGGING $errorMessage = date('M-d-Y h:i:s') . "\n=================================\n\n" . ($this->commError != '' ? 'Comm results: ' . $this->commErrNo . ' ' . $this->commError . "\n\n" : '') . 'Response Code: ' . $response[0] . ".\nResponse Text: " . $response[3] . "\n\n" . 'Sending to Authorizenet: ' . print_r($this->reportable_submit_data, true) . "\n\n" . 'Results Received back from Authorizenet: ' . print_r($resp_output, true) . "\n\n" . 'CURL communication info: ' . print_r($this->commInfo, true) . "\n"; if (CURL_PROXY_REQUIRED == 'True') { $errorMessage .= 'Using CURL Proxy: [' . CURL_PROXY_SERVER_DETAILS . '] with Proxy Tunnel: ' . ($this->proxy_tunnel_flag ? 'On' : 'Off') . "\n"; } $errorMessage .= "\nRAW data received: \n" . $this->authorize . "\n\n"; if (strstr(MODULE_PAYMENT_AUTHORIZENET_ECHECK_DEBUGGING, 'Log') || strstr(MODULE_PAYMENT_AUTHORIZENET_ECHECK_DEBUGGING, 'All') || defined('AUTHORIZENET_DEVELOPER_MODE') && in_array(AUTHORIZENET_DEVELOPER_MODE, array('on', 'certify'))) { $key = $response[6] . '_' . time() . '_' . zen_create_random_value(4); $file = $this->_logDir . '/' . 'AuthNetECheck_Debug_' . $key . '.log'; if ($fp = @fopen($file, 'a')) { fwrite($fp, $errorMessage); fclose($fp); } } if ($response[0] != '1' && stristr(MODULE_PAYMENT_AUTHORIZENET_ECHECK_DEBUGGING, 'Alerts') || strstr(MODULE_PAYMENT_AUTHORIZENET_ECHECK_DEBUGGING, 'Email')) { zen_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, 'Authorizenet-eCheck Alert ' . $response[7] . ' ' . date('M-d-Y h:i:s') . ' ' . $response[6], $errorMessage, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, array('EMAIL_MESSAGE_HTML' => nl2br($errorMessage)), 'debug'); } // DATABASE SECTION // Insert the send and receive response data into the database. // This can be used for testing or for implementation in other applications // This can be turned on and off if the Admin Section if (MODULE_PAYMENT_AUTHORIZENET_ECHECK_STORE_DATA == 'True') { $db_response_text = $response[3] . ($this->commError != '' ? ' - Comm results: ' . $this->commErrNo . ' ' . $this->commError : ''); $db_response_text .= $response[0] == 2 && $response[2] == 4 ? ' NOTICE: Card should be picked up - possibly stolen ' : ''; $db_response_text .= $response[0] == 3 && $response[2] == 11 ? ' DUPLICATE TRANSACTION ATTEMPT ' : ''; // Insert the data into the database $sql = "insert into " . TABLE_AUTHORIZENET . " (id, customer_id, order_id, response_code, response_text, authorization_type, transaction_id, sent, received, time, session_id) values (NULL, :custID, :orderID, :respCode, :respText, :authType, :transID, :sentData, :recvData, :orderTime, :sessID )"; $sql = $db->bindVars($sql, ':custID', $_SESSION['customer_id'], 'integer'); $sql = $db->bindVars($sql, ':orderID', preg_replace('/[^0-9]/', '', $response[7]), 'integer'); $sql = $db->bindVars($sql, ':respCode', $response[0], 'integer'); $sql = $db->bindVars($sql, ':respText', $db_response_text, 'string'); $sql = $db->bindVars($sql, ':authType', $response[11], 'string'); $sql = $db->bindVars($sql, ':transID', $this->transaction_id, 'string'); $sql = $db->bindVars($sql, ':sentData', print_r($this->reportable_submit_data, true), 'string'); $sql = $db->bindVars($sql, ':recvData', print_r($response, true), 'string'); $sql = $db->bindVars($sql, ':orderTime', $order_time, 'string'); $sql = $db->bindVars($sql, ':sessID', $sessID, 'string'); $db->Execute($sql); } }