$referrer = strtolower($_SERVER['HTTP_REFERER']);
         $restart_payment = strpos($referrer, 'www.paypal') === false;
         if ($restart_payment) {
             $restart_payment = strpos($referrer, 'www.sandbox.paypal') === false;
             $pay_pal_error = true;
         }
     }
 }
 if ($restart_payment) {
     if ($pay_pal_error) {
         // include the mailer-class
         require_once ADMIN_PATH_PREFIX . DIR_WS_CLASSES . 'class.phpmailer.php';
         // include all for the mails
         require_once DIR_FS_INC . 'olc_php_mail.inc.php';
         $txt_mail = "Referrer='" . $referrer . APOS;
         olc_php_mail($_SESSION['email_address'], $_SESSION['custumers_firstname'], EMAIL_BILLING_FORWARDING_STRING, STORE_NAME, EMPTY_STRING, $_SESSION['email_address'], $_SESSION['customers_firstname'], EMPTY_STRING, EMPTY_STRING, 'Fehler bei PayPal-Zahlung', $txt_mail, $txt_mail, EMAIL_TYPE_TEXT);
         olc_redirect(olc_href_link("paypal_problem.php", EMTPY_STRING, NONSSL));
     } else {
         olc_redirect(olc_href_link(FILENAME_CHECKOUT_PAYMENT, EMPTY_STRING, SSL));
     }
 } else {
     // avoid hack attempts during the checkout procedure by checking the internal cartID
     $session_cartID = $_SESSION['cartID'];
     if ($session_cartID) {
         $session_cart_cartID = $_SESSION['cart']->cartID;
         if ($session_cart_cartID) {
             if ($session_cartID != $session_cart_cartID) {
                 olc_redirect(olc_href_link(FILENAME_CHECKOUT_SHIPPING, EMPTY_STRING, SSL));
             }
         }
     }
// include needed functions
require_once DIR_FS_INC . 'olc_draw_input_field.inc.php';
require_once DIR_FS_INC . 'olc_draw_textarea_field.inc.php';
require_once DIR_FS_INC . 'olc_validate_email.inc.php';
require_once DIR_FS_INC . 'olc_image_button.inc.php';
// include the mailer-class
require_once DIR_WS_CLASSES . 'class.phpmailer.php';
// include all for the mails
require_once DIR_FS_INC . 'olc_php_mail.inc.php';
if (!isset($_SESSION['affiliate_id'])) {
    olc_redirect(olc_href_link(FILENAME_AFFILIATE, '', SSL));
}
$error = false;
if (isset($_GET['action']) && $_GET['action'] == 'send') {
    if (olc_validate_email(trim($_POST['email']))) {
        olc_php_mail($_POST['email'], $_POST['name'], AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, '', $_POST['email'], $_POST['name'], '', '', EMAIL_SUBJECT, $_POST['enquiry'], $_POST['enquiry']);
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_AFFILIATE_CONTACT, 'action=success'));
        } else {
            echo $mail_error;
        }
    } else {
        $error = true;
    }
}
$breadcrumb->add(NAVBAR_TITLE, olc_href_link(FILENAME_AFFILIATE, '', SSL));
$breadcrumb->add(NAVBAR_TITLE_CONTACT, olc_href_link(FILENAME_AFFILIATE_CONTACT));
$affiliate_values = olc_db_query("select * from " . TABLE_AFFILIATE . " where affiliate_id = '" . $_SESSION['affiliate_id'] . APOS);
require DIR_WS_INCLUDES . 'header.php';
if (isset($_GET['action']) && $_GET['action'] == 'success') {
    $smarty->assign('SUMMARY_LINK', HTML_A_START . olc_href_link(FILENAME_AFFILIATE_SUMMARY) . '">' . olc_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . HTML_A_END);
     $messageStack->add_session(SUCCESS_BILLING, 'success');
     olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'update_payment':
     $pID = olc_db_prepare_input($_GET['pID']);
     $status = olc_db_prepare_input($_POST['status']);
     $payment_updated = false;
     $check_status_query = olc_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id = '" . olc_db_input($pID) . "' and af.affiliate_id = ap.affiliate_id ");
     $check_status = olc_db_fetch_array($check_status_query);
     if ($check_status['affiliate_payment_status'] != $status) {
         olc_db_query(SQL_UPDATE . TABLE_AFFILIATE_PAYMENT . " set affiliate_payment_status = '" . olc_db_input($status) . "', affiliate_last_modified = now() where affiliate_payment_id = '" . olc_db_input($pID) . APOS);
         $affiliate_notified = '0';
         // Notify Affiliate
         if ($_POST['notify'] == 'on') {
             $email = STORE_NAME . NEW_LINE . EMAIL_SEPARATOR . NEW_LINE . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . BLANK . $pID . NEW_LINE . EMAIL_TEXT_INVOICE_URL . BLANK . olc_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $pID, SSL) . NEW_LINE . EMAIL_TEXT_PAYMENT_BILLED . BLANK . olc_date_long($check_status['affiliate_payment_date']) . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $payments_status_array[$status]);
             olc_php_mail($check_status['affiliate_firstname'] . BLANK . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
             $affiliate_notified = '1';
         }
         olc_db_query(INSERT_INTO . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " (affiliate_payment_id, affiliate_new_value, affiliate_old_value, affiliate_date_added, affiliate_notified) values ('" . olc_db_input($pID) . "', '" . olc_db_input($status) . "', '" . $check_status['affiliate_payment_status'] . "', now(), '" . $affiliate_notified . "')");
         $order_updated = true;
     }
     if ($order_updated) {
         $messageStack->add_session(SUCCESS_PAYMENT_UPDATED, 'success');
     }
     olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'deleteconfirm':
     $pID = olc_db_prepare_input($_GET['pID']);
     olc_db_query(DELETE_FROM . TABLE_AFFILIATE_PAYMENT . " where affiliate_payment_id = '" . olc_db_input($pID) . APOS);
     olc_db_query(DELETE_FROM . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " where affiliate_payment_id = '" . olc_db_input($pID) . APOS);
     olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('pID', 'action'))));
Пример #4
0
        $insert_id = olc_db_insert_id($gv_query);
        $gv_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, sent_lastname, emailed_to, date_sent) values ('" . $insert_id . "' ,'" . $_SESSION['customer_id'] . "', '" . addslashes($gv_customer['customers_firstname']) . "', '" . addslashes($gv_customer['customers_lastname']) . "', '" . $_POST['email'] . "', now())");
        $gv_email_subject = sprintf(EMAIL_GV_TEXT_SUBJECT, stripslashes($_POST['send_name']));
        $smarty->assign('GIFT_LINK', olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $id1, NONSSL, false));
        $smarty->assign('AMMOUNT', $currencies->format($_POST['amount']));
        $smarty->assign('GIFT_ID', $id1);
        $smarty->assign('MESSAGE', $_POST['message']);
        $smarty->assign('NAME', $_POST['to_name']);
        $smarty->assign('FROM_NAME', $_POST['send_name']);
        // dont allow cache
        $smarty->caching = false;
        $txt_mail = CURRENT_TEMPLATE_MAIL . 'send_gift_to_friend.';
        $html_mail = $smarty->fetch($txt_mail . 'html');
        $txt_mail = $smarty->fetch($txt_mail . 'txt');
        // send mail
        olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $_POST['email'], $_POST['to_name'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $gv_email_subject, $html_mail, $txt_mail);
    }
}
$breadcrumb->add(NAVBAR_GV_SEND);
require DIR_WS_INCLUDES . 'header.php';
if ($_GET['action'] == 'process') {
    $smarty->assign('action', 'process');
    $smarty->assign('LINK_DEFAULT', HTML_A_START . olc_href_link(FILENAME_DEFAULT, '', NONSSL) . '">' . olc_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . HTML_A_END);
}
if ($_GET['action'] == 'send' && !$error) {
    $smarty->assign('action', 'send');
    // validate entries
    $gv_amount = (double) $gv_amount;
    $gv_query = olc_db_query("select customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . $_SESSION['customer_id'] . APOS);
    $gv_result = olc_db_fetch_array($gv_query);
    $send_name = $gv_result['customers_firstname'] . BLANK . $gv_result['customers_lastname'];
$coID = (int) $_GET['coID'];
$shop_content_query = olc_db_query("SELECT\n                     content_group\n                     FROM " . TABLE_CONTENT_MANAGER . "\n                     WHERE content_title='" . BOX_INFORMATION_CONTACT . "'\n                     AND languages_id='" . SESSION_LANGUAGE_ID . APOS);
$shop_content_data = olc_db_fetch_array($shop_content_query);
$contact_id = $shop_content_data['content_group'];
$shop_content_query = olc_db_query("SELECT\n                     content_id,\n                     content_title,\n                     content_heading,\n                     content_text,\n                     content_file\n                     FROM " . TABLE_CONTENT_MANAGER . "\n                     WHERE content_group='" . $coID . "'\n                     AND languages_id='" . SESSION_LANGUAGE_ID . APOS);
$shop_content_data = olc_db_fetch_array($shop_content_query);
$breadcrumb->add($shop_content_data['content_title'], olc_href_link(FILENAME_CONTENT . '?coID=' . $coID));
if ($coID != $contact_id || $_GET['action'] == 'success') {
    require DIR_WS_INCLUDES . 'header.php';
}
$smarty->assign('CONTENT_HEADING', $shop_content_data['content_heading']);
if ($coID == $contact_id) {
    $error = false;
    if (isset($_GET['action']) && $_GET['action'] == 'send') {
        if (olc_validate_email(trim($_POST['email']))) {
            olc_php_mail($_POST['email'], $_POST['name'], CONTACT_US_EMAIL_ADDRESS, CONTACT_US_NAME, CONTACT_US_FORWARDING_STRING, $_POST['email'], $_POST['name'], '', '', CONTACT_US_EMAIL_SUBJECT, nl2br($_POST['message_body']), $_POST['message_body']);
            if (!isset($mail_error)) {
                olc_redirect(olc_href_link(FILENAME_CONTENT, 'action=success&coID=' . $coID));
            } else {
                $smarty->assign('error_message', $mail_error);
            }
        } else {
            // error report hier einbauen
            $smarty->assign('error_message', ERROR_MAIL);
            $error = true;
        }
    }
    $smarty->assign('CONTACT_HEADING', $shop_content_data['content_title']);
    if (isset($_GET['action']) && $_GET['action'] == 'success') {
        $smarty->assign('success', '1');
        $smarty->assign('BUTTON_CONTINUE', HTML_A_START . olc_href_link(FILENAME_DEFAULT) . '">' . olc_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . HTML_A_END);
            break;
    }
    $coupon_query = olc_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $_GET['cid'] . APOS);
    $coupon_result = olc_db_fetch_array($coupon_query);
    $coupon_name_query = olc_db_query("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . SESSION_LANGUAGE_ID . APOS);
    $coupon_name = olc_db_fetch_array($coupon_name_query);
    $from = olc_db_prepare_input($_POST['from']);
    $subject = olc_db_prepare_input($_POST['subject']);
    while ($mail = olc_db_fetch_array($mail_query)) {
        $smarty->assign('MESSAGE', $_POST['message']);
        $smarty->assign('COUPON_ID', $coupon_result['coupon_code']);
        $smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
        $txt_mail = CURRENT_TEMPLATE_MAIL . 'send_coupon.';
        $html_mail = $smarty->fetch($txt_mail . 'html');
        $txt_mail = $smarty->fetch($txt_mail . 'txt');
        olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $mail['customers_email_address'], $mail['customers_firstname'] . BLANK . $mail['customers_lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail);
    }
    olc_redirect(olc_href_link(FILENAME_COUPON_ADMIN, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview_email' && !$_POST['customers_email_address']) {
    $_GET['action'] = 'email';
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
}
switch ($_GET['action']) {
    case 'confirmdelete':
        $delete_query = olc_db_query(SQL_UPDATE . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id='" . $_GET['cid'] . APOS);
        break;
    case 'update':
            $coupon_code = create_coupon_code();
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $coupon_code . "', 'G', '" . NEW_SIGNUP_GIFT_VOUCHER_AMOUNT . "', now())");
            $insert_id = olc_db_insert_id($insert_query);
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
            $html_mail .= '<br/><br/>' . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "<br/><br/>" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "<br/><br/>" . EMAIL_GV_LINK . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "<br/><br/>";
            $txt_mail .= "\n\n" . sprintf(EMAIL_GV_INCENTIVE_HEADER, $currencies->format(NEW_SIGNUP_GIFT_VOUCHER_AMOUNT)) . "\n\n" . sprintf(EMAIL_GV_REDEEM, $coupon_code) . "\n\n" . EMAIL_GV_LINK . olc_href_link(FILENAME_GV_REDEEM, 'gv_no=' . $coupon_code, NONSSL, false) . "\n\n";
        }
        if (NEW_SIGNUP_DISCOUNT_COUPON != '') {
            $coupon_code = NEW_SIGNUP_DISCOUNT_COUPON;
            $coupon_query = olc_db_query("select * from " . TABLE_COUPONS . " where coupon_code = '" . $coupon_code . APOS);
            $coupon = olc_db_fetch_array($coupon_query);
            $coupon_id = $coupon['coupon_id'];
            $coupon_desc_query = olc_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $coupon_id . "' and language_id = '" . (int) $_SESSION['languages_id'] . APOS);
            $coupon_desc = olc_db_fetch_array($coupon_desc_query);
            $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $coupon_id . "', '0', 'Admin', '" . $customers_email_address . "', now() )");
            $html_mail .= "<br/><br/>" . EMAIL_COUPON_INCENTIVE_HEADER . HTML_BR . sprintf("%s", $coupon_desc['coupon_description']) . "<br/><br/>" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "<br/><br/>" . "<br/><br/>";
            $txt_mail .= "\n\n" . EMAIL_COUPON_INCENTIVE_HEADER . NEW_LINE . sprintf("%s", $coupon_desc['coupon_description']) . "\n\n" . sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" . "\n\n";
        }
        // ICW - CREDIT CLASS CODE BLOCK ADDED  ******************************************************* END
        // GV Code End
        //	W. Kaiser - eMail-type by customer
        olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $customers_email_address, $name, EMAIL_SUPPORT_FORWARDING_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail, $customers_email_type);
        //	W. Kaiser - eMail-type by customer
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_SHOPPING_CART));
        }
    }
}
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
include DIR_FS_INC . 'olc_show_customer_data_form.inc.php';
//	W. Kaiser - Common code for "create_account.php" and "customers.php"
    $smarty->caching = false;
    $template = CURRENT_TEMPLATE_MAIL . 'order_mail';
    if ($customer_email_type == EMAIL_TYPE_TEXT) {
        $txt_mail = $smarty->fetch($template . 'txt');
        $html_mail = EMPTY_STRING;
    } else {
        $html_mail = $smarty->fetch($template . HTML_EXT);
        $txt_mail = EMPTY_STRING;
    }
    $firstname = $order->customer['firstname'];
    $lastname = $order->customer['lastname'];
    // create subject
    $order_subject = str_replace('{$nr}', $insert_id, EMAIL_BILLING_SUBJECT_ORDER);
    $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject);
    $order_subject = str_replace('{$firstname}', $firstname, $order_subject);
    $order_subject = str_replace('{$lastname}', $lastname, $order_subject);
    // W. Kaiser - eMail-type by customer
    $eMail = $order->customer['email_address'];
    $name = trim($firstname . BLANK . $lastname);
    // send mail to admin
    olc_php_mail($eMail, $name, EMAIL_BILLING_FORWARDING_STRING, STORE_NAME, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, $attachment_invoice, $attachment_agb, $order_subject, $html_mail, $txt_mail, EMAIL_TYPE_HTML);
    // send mail to customer
    olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $eMail, $name, EMPTY_STRING, EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, $attachment_invoice, $attachment_agb, $order_subject, $html_mail, $txt_mail, $customer_email_type);
    if ($delete_pdf_invoice) {
        unlink($pdf_invoice);
    }
    //	W. Kaiser - eMail-type by customer
} else {
    $smarty->assign('ERROR', TEXT_NO_ORDER_DISPLAY);
    $smarty->display(CURRENT_TEMPLATE_MODULE . 'error_message' . HTML_EXT);
}
Пример #9
0
                     $smarty->assign('TRACK_URL', $TrackURL);
                 }
             }
             if ($order->info[$language_text] == EMPTY_STRING) {
                 $order->info[$language_text] = SESSION_LANGUAGE;
             }
             //	W. Kaiser - Erlaube Sendungstracking
             $customers_email_type = $order->customer['email_type'];
             $mail = CURRENT_TEMPLATE_ADMIN_MAIL . 'change_order_mail';
             if ($customers_email_type == EMAIL_TYPE_HTML) {
                 $html_mail = $smarty->fetch($mail . HTML_EXT);
             } else {
                 $txt_mail = $smarty->fetch($mail . '.txt');
             }
             //	W. Kaiser - eMail-type by customer
             olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $customers_name, EMPTY_STRING, EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail, $customers_email_type);
             //	W. Kaiser - eMail-type by customer
             $customer_notified = 1;
         }
         olc_db_query(INSERT_INTO . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $oID . "', '" . $status . "', now(), '" . $customer_notified . "', '" . $comment . "')");
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
     } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
     }
     olc_redirect(olc_href_link(FILENAME_ORDERS, olc_get_all_get_params(array('action', 'validate')) . 'action=edit'));
     break;
 case 'deleteconfirm':
     olc_remove_order($oID, $_POST['restock']);
     olc_redirect(olc_href_link(FILENAME_ORDERS, olc_get_all_get_params(array('oID', 'action'))));
     break;
     // BMC Delete CC info Start
function CustomersUpdate()
{
    global $_POST, $Lang_folder;
    $customers_id = -1;
    // include PW function
    require_once DIR_FS_INC . 'olc_encrypt_password.inc.php';
    if (isset($_POST['cID'])) {
        $customers_id = olc_db_prepare_input($_POST['cID']);
    }
    // security check, if user = admin, dont allow to perform changes
    if ($customers_id != -1) {
        $sec_query = olc_db_query("SELECT customers_status FROM " . TABLE_CUSTOMERS . " where customers_id='" . $customers_id . "'");
        $sec_data = olc_db_fetch_array($sec_query);
        if ($sec_data['customers_status'] == 0) {
            print_xml_status(120, $_POST['action'], 'CAN NOT CHANGE ADMIN USER!', '', '', '');
            return;
        }
    }
    $sql_customers_data_array = array();
    if (isset($_POST['customers_cid'])) {
        $sql_customers_data_array['customers_cid'] = $_POST['customers_cid'];
    }
    if (isset($_POST['customers_firstname'])) {
        $sql_customers_data_array['customers_firstname'] = $_POST['customers_firstname'];
    }
    if (isset($_POST['customers_lastname'])) {
        $sql_customers_data_array['customers_lastname'] = $_POST['customers_lastname'];
    }
    if (isset($_POST['customers_dob'])) {
        $sql_customers_data_array['customers_dob'] = $_POST['customers_dob'];
    }
    if (isset($_POST['customers_email'])) {
        $sql_customers_data_array['customers_email_address'] = $_POST['customers_email'];
    }
    if (isset($_POST['customers_tele'])) {
        $sql_customers_data_array['customers_telephone'] = $_POST['customers_tele'];
    }
    if (isset($_POST['customers_fax'])) {
        $sql_customers_data_array['customers_fax'] = $_POST['customers_fax'];
    }
    if (isset($_POST['customers_gender'])) {
        $sql_customers_data_array['customers_gender'] = $_POST['customers_gender'];
    }
    if (isset($_POST['customers_password'])) {
        $sql_customers_data_array['customers_password'] = olc_encrypt_password($_POST['customers_password']);
    }
    $sql_address_data_array = array();
    if (isset($_POST['customers_firstname'])) {
        $sql_address_data_array['entry_firstname'] = $_POST['customers_firstname'];
    }
    if (isset($_POST['customers_lastname'])) {
        $sql_address_data_array['entry_lastname'] = $_POST['customers_lastname'];
    }
    if (isset($_POST['customers_company'])) {
        $sql_address_data_array['entry_company'] = $_POST['customers_company'];
    }
    if (isset($_POST['customers_street'])) {
        $sql_address_data_array['entry_street_address'] = $_POST['customers_street'];
    }
    if (isset($_POST['customers_city'])) {
        $sql_address_data_array['entry_city'] = $_POST['customers_city'];
    }
    if (isset($_POST['customers_postcode'])) {
        $sql_address_data_array['entry_postcode'] = $_POST['customers_postcode'];
    }
    if (isset($_POST['customers_gender'])) {
        $sql_address_data_array['entry_gender'] = $_POST['customers_gender'];
    }
    if (isset($_POST['customers_country_id'])) {
        $country_code = $_POST['customers_country_id'];
    }
    $country_query = "SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $country_code . "' LIMIT 1";
    $country_result = olc_db_query($country_query);
    $row = olc_db_fetch_array($country_result);
    $sql_address_data_array['entry_country_id'] = $row['countries_id'];
    $count_query = olc_db_query("SELECT count(*) as count FROM " . TABLE_CUSTOMERS . " WHERE customers_id='" . (int) $customers_id . "' LIMIT 1");
    $check = olc_db_fetch_array($count_query);
    if ($check['count'] > 0) {
        $mode = 'SQL_UPDATE';
        $address_book_result = olc_db_query("SELECT customers_default_address_id FROM " . TABLE_CUSTOMERS . " WHERE customers_id = '" . (int) $customers_id . "' LIMIT 1");
        $customer = olc_db_fetch_array($address_book_result);
        olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' LIMIT 1");
        olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array, 'update', "customers_id = '" . olc_db_input($customers_id) . "' AND address_book_id = '" . $customer['customers_default_address_id'] . "' LIMIT 1");
        olc_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_account_last_modified = now() where customers_info_id = '" . (int) $customers_id . "'  LIMIT 1");
    } else {
        $mode = 'APPEND';
        if (strlen($_POST['customers_password']) == 0) {
            // generate PW if empty
            $pw = olc_RandomString(8);
            $sql_customers_data_array['customers_password'] = olc_create_password($pw);
        }
        olc_db_perform(TABLE_CUSTOMERS, $sql_customers_data_array);
        $customers_id = olc_db_insert_id();
        $sql_address_data_array['customers_id'] = $customers_id;
        olc_db_perform(TABLE_ADDRESS_BOOK, $sql_address_data_array);
        $address_id = olc_db_insert_id();
        olc_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int) $address_id . "' where customers_id = '" . (int) $customers_id . "'");
        olc_db_query("update " . TABLE_CUSTOMERS . " set customers_status = '" . STANDARD_GROUP . "' where customers_id = '" . (int) $customers_id . "'");
        olc_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int) $customers_id . "', '0', now())");
    }
    if (SEND_ACCOUNT_MAIL == true && $mode == 'APPEND' && $sql_customers_data_array['customers_email_address'] != '') {
        // generate mail for customer if customer=new
        require_once DIR_WS_CLASSES . 'class.phpmailer.php';
        require_once DIR_FS_INC . 'olc_php_mail.inc.php';
        require_once DIR_FS_INC . 'olc_add_tax.inc.php';
        require_once DIR_FS_INC . 'olc_not_null.inc.php';
        require_once DIR_FS_INC . 'changedataout.inc.php';
        require_once DIR_FS_INC . 'olc_href_link.inc.php';
        require_once DIR_FS_INC . 'olc_date_long.inc.php';
        require_once DIR_FS_INC . 'olc_check_agent.inc.php';
        $smarty = new Smarty();
        //$smarty->assign('language', $check_status['language']);
        $smarty->assign('language', $Lang_folder);
        $smarty->caching = false;
        $smarty->template_dir = DIR_FS_CATALOG . 'templates';
        $smarty->compile_dir = DIR_FS_CATALOG . 'cache/templates_c';
        $smarty->config_dir = DIR_FS_CATALOG . 'lang';
        $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
        $smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/images/');
        $smarty->assign('NAME', $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname']);
        $smarty->assign('EMAIL', $sql_customers_data_array['customers_email_address']);
        $smarty->assign('PASSWORD', $pw);
        //$smarty->assign('language', $Lang_folder);
        $smarty->assign('content', $module_content);
        $smarty->caching = false;
        $html_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.html');
        $txt_mail = $smarty->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $Lang_folder . '/create_account_mail.txt');
        // send mail with html/txt template
        olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $sql_customers_data_array['customers_email_address'], $sql_customers_data_array['customers_lastname'] . ' ' . $sql_customers_data_array['customers_firstname'], '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail);
    }
    print_xml_status(0, $_POST['action'], 'OK', $mode, 'CUSTOMERS_ID', $customers_id);
}
Пример #11
0
        $id1 = create_coupon_code($_POST['email_to']);
        $smarty->assign('AMMOUNT', $currencies->format($_POST['amount']));
        $smarty->assign('MESSAGE', $_POST['message']);
        $smarty->assign('GIFT_ID', $id1);
        $smarty->assign('WEBSITE', HTTP_SERVER . DIR_WS_CATALOG);
        if (USE_SEO) {
            $link = SLASH;
        } else {
            $link = '?';
        }
        $link = HTTP_SERVER . DIR_WS_CATALOG . 'gv_redeem.php' . $link . 'gv_no=' . $id1;
        $smarty->assign('GIFT_LINK', $link);
        $txt_mail = CURRENT_TEMPLATE_ADMIN_MAIL . 'send_gift.';
        $html_mail = $smarty->fetch($txt_mail . 'html');
        $txt_mail = $smarty->fetch($txt_mail . 'txt');
        olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $_POST['email_to'], '', '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail);
        // Now create the coupon email entry
        $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPONS . " (coupon_code, coupon_type, coupon_amount, date_created) values ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', now())");
        $insert_id = olc_db_insert_id($insert_query);
        $insert_query = olc_db_query(INSERT_INTO . TABLE_COUPON_EMAIL_TRACK . " (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) values ('" . $insert_id . "', '0', 'Admin', '" . $_POST['email_to'] . "', now() )");
    }
    olc_redirect(olc_href_link(FILENAME_GV_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
}
if ($_GET['action'] == 'preview' && !$_POST['customers_email_address'] && !$_POST['email_to']) {
    $messageStack->add(ERROR_NO_CUSTOMER_SELECTED, 'error');
}
if ($_GET['action'] == 'preview' && !$_POST['amount']) {
    $messageStack->add(ERROR_NO_AMOUNT_SELECTED, 'error');
}
if ($_GET['mail_sent_to']) {
    $messageStack->add(sprintf(NOTICE_EMAIL_SENT_TO, $_GET['mail_sent_to']), 'notice');
        if (ACCOUNT_SUBURB == TRUE_STRING_S) {
            $sql_data_array['affiliate_suburb'] = $a_suburb;
        }
        if (ACCOUNT_STATE == TRUE_STRING_S) {
            if ($a_zone_id > 0) {
                $sql_data_array['affiliate_zone_id'] = $a_zone_id;
                $sql_data_array['affiliate_state'] = '';
            } else {
                $sql_data_array['affiliate_zone_id'] = '0';
                $sql_data_array['affiliate_state'] = $a_state;
            }
        }
        $sql_data_array['affiliate_date_account_created'] = 'now()';
        $_SESSION['affiliate_id'] = affiliate_insert($sql_data_array, $_SESSION['affiliate_ref']);
        $aemailbody = MAIL_AFFILIATE_HEADER . NEW_LINE . MAIL_AFFILIATE_ID . $_SESSION['affiliate_id'] . NEW_LINE . MAIL_AFFILIATE_USERNAME . $a_email_address . NEW_LINE . MAIL_AFFILIATE_PASSWORD . $a_password . "\n\n" . MAIL_AFFILIATE_LINK . HTTP_SERVER . DIR_WS_CATALOG . FILENAME_AFFILIATE . "\n\n" . MAIL_AFFILIATE_FOOTER;
        olc_php_mail(AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, $a_email_address, $a_firstname . BLANK . $a_lastname, '', AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, '', '', MAIL_AFFILIATE_SUBJECT, nl2br($aemailbody), nl2br($aemailbody));
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_AFFILIATE, 'info_message=' . urlencode(TEXT_PASSWORD_SENT), SSL, true, false));
        } else {
            echo $mail_error;
        }
        $_SESSION['affiliate_email'] = $a_email_address;
        $_SESSION['affiliate_name'] = $a_firstname . BLANK . $a_lastname;
        olc_redirect(olc_href_link(FILENAME_AFFILIATE_SIGNUP_OK, '', SSL));
    }
}
$breadcrumb->add(NAVBAR_TITLE, olc_href_link(FILENAME_AFFILIATE, '', SSL));
$breadcrumb->add(NAVBAR_TITLE_SIGNUP, olc_href_link(FILENAME_AFFILIATE_SIGNUP, '', SSL));
require DIR_WS_INCLUDES . 'header.php';
$smarty->assign('FORM_ACTION', olc_draw_form('affiliate_signup', olc_href_link(FILENAME_AFFILIATE_SIGNUP, '', SSL), 'post'));
$smarty->assign('HIDDEN_ACTION', olc_draw_hidden_field('action', 'process'));
         }
         if ($send_email) {
             $link_code = olc_encrypt_password($email);
             $server_link = HTTP_SERVER . DIR_WS_CATALOG;
             $link = olc_href_link(FILENAME_NEWSLETTER, 'action=activate&email=' . $email . '&key=' . $link_code, NONSSL);
             if (strpos($link, server_link) === false) {
                 $link = $server_link . $link;
             }
             // assign vars
             $smarty->assign('EMAIL', $email);
             $smarty->assign('LINK', $link);
             $smarty->assign('NAME', trim($customers_firstname . BLANK . $customers_lastname));
             $txt_mail = CURRENT_TEMPLATE_MAIL . 'newsletter_' . $action . '_mail';
             $html_mail = $smarty->fetch($txt_mail . HTML_EXT);
             $txt_mail = $smarty->fetch($txt_mail . '.txt');
             olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $email, EMPTY_STRING, EMPTY_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, TEXT_EMAIL_SUBJECT, $html_mail, $txt_mail, $customers_email_type);
         }
     } else {
         $info_message = TEXT_WRONG_CODE;
     }
 } else {
     $activate = $action == 'activate';
     $remove = $action == 'remove';
     $sql_where .= " and mail_key = '" . $key . APOS;
     $sql_from = SQL_FROM . TABLE_NEWSLETTER_RECIPIENTS . $sql_where;
     if ($activate || $remove) {
         $key = olc_db_input($_GET['key']);
         $check_mail_query = olc_db_query($sql_select . $sql_from);
         if (olc_db_num_rows($check_mail_query)) {
             $check_mail = olc_db_fetch_array($check_mail_query);
             $valid_entry = olc_validate_password($check_mail['customers_email_address'], $key);
if ($error == false) {
    global $messageStack, $mail_error;
    $mail_smarty->assign('message', $_POST['yourmessage']);
    $mail_smarty->assign('from_name', $from_name);
    $mail_smarty->assign('from_email', $from_email_address);
    $mail_smarty->assign('to_name', $_POST['friendname']);
    $mail_smarty->assign('shop_name', STORE_NAME);
    $mail_smarty->assign('shop_email', EMAIL_SUPPORT_ADDRESS);
    $mail_smarty->assign('products_name', $products_name);
    $mail_smarty->assign('HOME_LINK', olc_href_link(FILENAME_DEFAULT, EMPTY_STRING, EMPTY_STRING, false, true, false));
    $mail_smarty->assign('PRODUCTS_LINK', $Link);
    $template = CURRENT_TEMPLATE_MAIL . 'tell_friend_mail.';
    $html_mail = $mail_smarty->fetch($template . 'html');
    $smarty->assign('action', 'send');
    $smarty->assign('BUTTON_CONTINUE', $back_link);
    olc_php_mail($from_email_address, $from_name, $_POST['friendemail'], $_POST['friendname'], EMPTY_STRING, $from_email_address, $from_name, EMPTY_STRING, EMPTY_STRING, CONTACT_US_EMAIL_SUBJECT, $html_mail, $txt_mail, EMAIL_TYPE_HTML);
    if ($mail_error) {
        $message = nl2br($messageStack->output('mailer'));
    } else {
        $message = TEXT_EMAIL_SUCCESSFUL_SENT;
    }
    $smarty->assign('message', $message);
} else {
    if ($login_done) {
        $your_name_prompt = trim($account_values['customers_firstname'] . BLANK . $account_values['customers_lastname']);
        $your_name_prompt .= olc_draw_hidden_field('yourname', $your_name_prompt);
        $your_name_prompt = HTML_B_START . $your_name_prompt . HTML_B_END;
        $your_email_address_prompt = HTML_B_START . $account_values['customers_email_address'] . HTML_B_END;
    } else {
        $your_name_prompt = olc_draw_input_field('yourname', $fromname_error ? $_POST['yourname'] : $_GET['yourname']);
        if ($fromname_error) {
    function before_process()
    {
        global $_POST, $order, $paypal_ec_token, $paypal_ec_payer_id, $paypal_ec_payer_info;
        include DIR_WS_CLASSES . 'cc_validation.php';
        $caller = $this->paypal_init();
        if ($this->is_paypal_process()) {
            //Do EC checkout
            $pdt =& Services_PayPal::getType('PaymentDetailsType');
            $at =& Services_PayPal::getType('AddressType');
            $at->setName($paypal_ec_payer_info['ship_name']);
            $at->setStreet1($paypal_ec_payer_info['ship_street_1']);
            $at->setStreet2($paypal_ec_payer_info['ship_street_2']);
            $at->setCityName($paypal_ec_payer_info['ship_city']);
            $at->setStateOrProvince($paypal_ec_payer_info['ship_state']);
            $at->setCountry($paypal_ec_payer_info['ship_country']);
            $at->setPostalCode($paypal_ec_payer_info['ship_postal_code']);
            $pdt->setShipToAddress($at);
            $order_total =& Services_PayPal::getType('BasicAmountType');
            $order_total->setval(number_format($order->info['total'], 2));
            $order_total->setattr('currencyID', $order->info['currency']);
            $pdt->setOrderTotal($order_total);
            /* Not required by PayPal and causes more problems than it solves, so this is commented out for now
            			$item_total =& Services_PayPal::getType('BasicAmountType');
            			$item_total->setval(number_format($order->info['subtotal'], 2));
            			$item_total->setattr('currencyID', $order->info['currency']);
            			$pdt->setItemTotal($item_total);
            			$ship_total =& Services_PayPal::getType('BasicAmountType');
            			$ship_total->setval(number_format($order->info['shipping_cost'], 2));
            			$ship_total->setattr('currencyID', $order->info['currency']);
            			$pdt->setShippingTotal($ship_total);
            			$tax_total =& Services_PayPal::getType('BasicAmountType');
            			$tax_total->setval(number_format($order->info['tax'], 2));
            			$tax_total->setattr('currencyID', $order->info['currency']);
            			$pdt->setTaxTotal($tax_total);
            			*/
            $details =& Services_PayPal::getType('DoExpressCheckoutPaymentRequestDetailsType');
            $details->setPaymentAction('Sale');
            $details->setToken($paypal_ec_token);
            $details->setPayerID($paypal_ec_payer_id);
            $details->setPaymentDetails($pdt);
            $ecprt =& Services_PayPal::getType('DoExpressCheckoutPaymentRequestType');
            $ecprt->setDoExpressCheckoutPaymentRequestDetails($details);
            $response = $caller->DoExpressCheckoutPayment($ecprt);
            if (Services_PayPal::isError($response) || $response->Ack != 'Success' && $response->Ack != 'SuccessWithWarning') {
                if ($this->enableDebugging) {
                    //Send the store owner a complete dump of the transaction
                    $final_req_dump = $this->prepare_var_dump($response);
                    //print_r($response, true);
                    /*
                    olc_php_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $this->error_dump,
                    "In Funktion: before_process() - Express Checkout\nDid first contact attempt return error? " .
                    ($error_occurred ? "Yes" : "Nope")." \n".$spacer.$final_req_title.$spacer.$final_req_dump .
                    "\n\n".$spacer.$ts_req_title.$spacer .
                    $ts_req_dump, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                    */
                    olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, STORE_NAME, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, $this->error_dump, EMPTY_STRING, str_replace(HASH, "before_process - Express Checkout\n" . $this->first_contact . ($error_occurred ? $this->yes : $this->no) . " \n" . $spacer . $final_req_title . $spacer . $final_req_dump . "\n\n" . $spacer . $ts_req_title . $spacer . $ts_req_dump, $this->in_function) . $this->prepare_var_dump($response), EMAIL_TYPE_TEXT);
                }
                if ($final_req->Errors->ErrorCode == EMPTY_STRING) {
                    $error = MODULE_PAYMENT_PAYPAL_DP_TEXT_DECLINED . MODULE_PAYMENT_PAYPAL_NO_RESPONSE_TEXT;
                } else {
                    $error = MODULE_PAYMENT_PAYPAL_DP_TEXT_ERROR . $this->return_transaction_errors($response->Errors);
                }
                $this->away_with_you($error, true);
            } else {
                $details = $response->getDoExpressCheckoutPaymentResponseDetails();
                $payment_info = $details->getPaymentInfo();
                $this->payment_type = 'PayPal Express Checkout';
                $this->trans_id = $payment_info->getTransactionID();
                $this->payment_status = $payment_info->getPaymentStatus();
                $this->avs = 'N/A';
                $this->cvv2 = 'N/A';
                if ($this->payment_status == PAYPAL_DP_STATUS_PENDING) {
                    $this->pending_reason = $payment_info->getPendingReason();
                    $this->payment_status .= LPAREN . $this->pending_reason . RPAREN;
                    $order->info['order_status'] = 1;
                }
            }
        } else {
            // Do DP checkout
            $cc_type = $_POST['wpp_cc_type'];
            $cc_number = $_POST['wpp_cc_number'];
            $cc_checkcode = $_POST['wpp_cc_checkcode'];
            $cc_first_name = $_POST['wpp_payer_firstname'];
            $cc_last_name = $_POST['wpp_payer_lastname'];
            $cc_owner_ip = $_SERVER['REMOTE_ADDR'];
            $cc_expdate_month = $_POST['wpp_cc_expdate_month'];
            $cc_expdate_year = $_POST['wpp_cc_expdate_year'];
            if (strlen($cc_expdate_year) < 4) {
                $cc_expdate_year = '20' . $cc_expdate_year;
            }
            //Thanks goes to SteveDallas for improved international support
            //Set the billing state field depending on what PayPal wants to see for that country
            switch ($order->billing['country']['iso_code_2']) {
                case 'US':
                case 'CA':
                    //Paypal only accepts two character state/province codes for some countries
                    if (strlen($order->billing['state']) > 2) {
                        $state_query = olc_db_query("SELECT zone_code FROM " . TABLE_ZONES . " WHERE zone_name = '" . $order->billing['state'] . APOS);
                        if (olc_db_num_rows($state_query) > 0) {
                            $state = olc_db_fetch_array($state_query);
                            $order->billing['state'] = $state['zone_code'];
                        } else {
                            $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_STATE_ERROR);
                        }
                    }
                    if (strlen($order->delivery['state']) > 2) {
                        $state_query = olc_db_query("SELECT zone_code FROM " . TABLE_ZONES . " WHERE zone_name = '" . $order->delivery['state'] . APOS);
                        if (olc_db_num_rows($state_query) > 0) {
                            $state = olc_db_fetch_array($state_query);
                            $order->delivery['state'] = $state['zone_code'];
                        } else {
                            $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_STATE_ERROR);
                        }
                    }
                    break;
                case 'AT':
                case 'BE':
                case 'FR':
                case 'DE':
                case 'CH':
                    $order->billing['state'] = EMPTY_STRING;
                    break;
                default:
                    break;
            }
            //Fix contributed by Glen Hoag.  This wasn't handling the shipping state correctly if it was different than the billing
            if (olc_not_null($order->delivery['street_address'])) {
                //Set the delivery state field depending on what PayPal wants to see for that country
                switch ($order->delivery['country']['iso_code_2']) {
                    case 'US':
                    case 'CA':
                        //Paypal only accepts two character state/province codes for some countries
                        if (strlen($order->delivery['state']) > 2) {
                            $state_query = olc_db_query("SELECT zone_code FROM " . TABLE_ZONES . " WHERE zone_name = '" . $order->delivery['state'] . APOS);
                            if (olc_db_num_rows($state_query) > 0) {
                                $state = olc_db_fetch_array($state_query);
                                $order->delivery['state'] = $state['zone_code'];
                            } else {
                                $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_STATE_ERROR);
                            }
                        }
                        if (strlen($order->delivery['state']) > 2) {
                            $state_query = olc_db_query("SELECT zone_code FROM " . TABLE_ZONES . " WHERE zone_name = '" . $order->delivery['state'] . APOS);
                            if (olc_db_num_rows($state_query) > 0) {
                                $state = olc_db_fetch_array($state_query);
                                $order->delivery['state'] = $state['zone_code'];
                            } else {
                                $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_STATE_ERROR);
                            }
                        }
                        break;
                    case 'AT':
                    case 'BE':
                    case 'FR':
                    case 'DE':
                    case 'CH':
                        $order->delivery['state'] = EMPTY_STRING;
                        break;
                    default:
                        break;
                }
            }
            $wpp_currency = $this->get_currency();
            //If the cc type sent in the post var isn't any one of the accepted cards, send them back to the payment page
            //This error should never come up unless the visitor is  playing with the post vars or they didn't get passed to checkout_confirmation.php
            if ($cc_type != 'Visa' && $cc_type != 'MasterCard' && $cc_type != 'Discover' && $cc_type != 'Amex') {
                $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_BAD_CARD, false, FILENAME_CHECKOUT_PAYMENT);
            }
            //If they're still here, and awake, set some of the order object's variables
            $order->info['cc_type'] = $cc_type;
            $order->info['cc_number'] = substr($cc_number, 0, 4) . str_repeat('X', strlen($cc_number) - 8) . substr($cc_number, -4);
            $order->info['cc_owner'] = trim($cc_first_name . BLANK . $cc_last_name);
            $order->info['cc_expires'] = $cc_expdate_month . substr($cc_expdate_year, -2);
            //It's time to start a'chargin.  Initialize the paypal caller object
            $caller = $this->paypal_init();
            $ot =& Services_PayPal::getType('BasicAmountType');
            $ot->setattr('currencyID', $wpp_currency);
            $ot->setval(number_format($order->info['total'], 2));
            // Begin ShippingAddress -- WILLBRAND //
            if ($order->delivery['street_address'] != EMPTY_STRING) {
                $sat =& Services_PayPal::getType('AddressType');
                $sat->setName(trim($order->delivery['firstname'] . BLANK . $order->delivery['lastname']));
                $sat->setStreet1($order->delivery['street_address']);
                $sat->setStreet2($order->delivery['suburb']);
                $sat->setCityName($order->delivery['city']);
                $sat->setPostalCode($order->delivery['postcode']);
                $sat->setStateOrProvince($order->delivery['state']);
                $sat->setCountry($order->delivery['country']['iso_code_2']);
            }
            // End ShippingAddress -- WILLBRAND //
            $pdt =& Services_PayPal::getType('PaymentDetailsType');
            $pdt->setOrderTotal($ot);
            if (olc_not_null($order->delivery['street_address'])) {
                $pdt->setShipToAddress($sat);
            }
            $at =& Services_PayPal::getType('AddressType');
            $at->setStreet1($order->billing['street_address']);
            $at->setStreet2($order->billing['suburb']);
            $at->setCityName($order->billing['city']);
            $at->setStateOrProvince($order->billing['state']);
            $at->setCountry($order->billing['country']['iso_code_2']);
            $at->setPostalCode($order->billing['postcode']);
            $pnt =& Services_PayPal::getType('PersonNameType');
            $pnt->setFirstName($cc_first_name);
            $pnt->setLastName($cc_last_name);
            $pit =& Services_PayPal::getType('PayerInfoType');
            $pit->setPayerName($pnt);
            $pit->setAddress($at);
            // Send email address of payee -- WILLBRAND //
            $pit->setPayer($order->customer['email_address']);
            $ccdt =& Services_PayPal::getType('CreditCardDetailsType');
            $ccdt->setCardOwner($pit);
            $ccdt->setCreditCardType($cc_type);
            $ccdt->setCreditCardNumber($cc_number);
            $ccdt->setExpMonth($cc_expdate_month);
            $ccdt->setExpYear($cc_expdate_year);
            $ccdt->setCVV2($cc_checkcode);
            $ddp_req =& Services_PayPal::getType('DoDirectPaymentRequestDetailsType');
            //Should the action be a variable? Uhmmm....I'm thinking no
            $ddp_req->setPaymentAction('Sale');
            $ddp_req->setPaymentDetails($pdt);
            $ddp_req->setCreditCard($ccdt);
            $ddp_req->setIPAddress($cc_owner_ip);
            $ddp_details =& Services_PayPal::getType('DoDirectPaymentRequestType');
            $ddp_details->setVersion('2.0');
            $ddp_details->setDoDirectPaymentRequestDetails($ddp_req);
            $final_req = $caller->DoDirectPayment($ddp_details);
            $final_req_ack = $final_req->Ack;
            //If the transaction wasn't a success, start the error checking
            if (strpos($final_req_ack, 'Success') === false) {
                $error_occurred = false;
                $ts_result = false;
                //If an error or failure occurred, don't do a transaction check
                if ($final_req_ack == EMPTY_STRING || strpos($final_req_ack, 'Error') !== false || strpos($final_req_ack, 'Failure') !== false) {
                    $error_occurred = true;
                    $error_log = $final_req->Errors;
                    if ($error_log) {
                        $error_log = $this->return_transaction_errors($final_req->Errors);
                    } else {
                        $error_log = $final_req->message;
                    }
                } else {
                    //Do a transaction search to make sure the connection didn't just timeout
                    //It searches by email of payer and amount.  That should be accurate enough
                    $ts =& Services_PayPal::getType('TransactionSearchRequestType');
                    //Set to one day ago to avoid any time zone issues.  This does introduce a possible bug, but
                    //the chance of the same person buying the exact same amount of products within one day is pretty unlikely
                    $ts->setStartDate(date('Y-m-d', mktime(0, 0, 0, date("m"), date("d") - 1, date("Y"))) . 'T00:00:00-0700');
                    $ts->setPayer($order->customer['email_address']);
                    $ts->setAmount(number_format($order->info['total'], 2));
                    $ts_req = $caller->TransactionSearch($ts);
                    //If a matching transaction was found, tell us
                    if (olc_not_null($ts_req->PaymentTransactions) && strpos($ts_req->Ack, 'Success') !== false) {
                        $ts_result = true;
                    } else {
                        $error_log = $this->return_transaction_errors($final_req->Errors);
                    }
                }
                if (!$error_occurred && $ts_result) {
                    $return_codes = array($ts_req->PaymentTransactions[0]->TransactionID, 'No AVS Code Returned', 'No CVV2 Code Returned');
                } else {
                    if ($this->enableDebugging) {
                        //Send the store owner a complete dump of the transaction
                        $dp_dump = $this->prepare_var_dump($ddp_details);
                        //print_r($ddp_details, true);
                        $final_req_dump = print_r($final_req, true);
                        $spacer = "---------------------------------------------------------------------\n";
                        $dp_dump_title = "-------------------------------DP_DUMP-------------------------------\n";
                        $dp_dump_title .= "------------This is the information that was sent to PayPal----------\n";
                        $final_req_title = "-------------------------------FINAL_REQ-----------------------------\n";
                        $final_req_title .= "-------------------This is the response from PayPal------------------\n";
                        $ts_req_dump = $this->prepare_var_dump($ts_req);
                        //print_r($ts_req, true);
                        $ts_req_title = "---------------------------------TS_REQ------------------------------\n";
                        $ts_req_title .= "--------Results of the transaction search if it was executed---------\n";
                        /*
                        olc_php_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $this->error_dump,
                        "In Funktion: before_process() - Direct Payment\nDid first contact attempt return error? " .
                        ($error_occurred ? "Yes" : "Nope")." \n".$spacer.$dp_dump_title.$spacer.$dp_dump .
                        $spacer.$final_req_title.$spacer.$final_req_dump."\n\n".$spacer.$ts_req_title .
                        $spacer.$ts_req_dump, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                        */
                        olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, STORE_NAME, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, $this->error_dump, EMPTY_STRING, str_replace(HASH, "before_process - Direct Payment\n" . $this->first_contact . ($error_occurred ? $this->yes : $this->no) . " \n" . $error_log . " \n" . $spacer . $dp_dump_title . $spacer . $dp_dump . $spacer . $final_req_title . $spacer . $final_req_dump . "\n\n" . $spacer . $ts_req_title . $spacer . $ts_req_dump, $this->in_function), EMAIL_TYPE_TEXT);
                    }
                    if (MODULE_PAYMENT_PAYPAL_DP_SAFEGUARD == 'Yes') {
                        /*
                        olc_php_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, 'Paypal declined the enclosed card', 'User: '******'email_address']."\n\nCredit Card Information:\n" .
                        trim($cc_first_name.BLANK.$cc_last_name).NEW_LINE.$cc_type.NEW_LINE.$cc_number.NEW_LINE .
                        $cc_expdate_month.SLASH.$cc_expdate_year.NEW_LINE.$cc_checkcode."\n\nFor the amount of: ".
                        number_format($order->products['total'], 2)."\n\n" .
                        'To preserve your customer\'s privacy, please delete this email after you have manually processed their card.',
                        STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                        */
                        $nl = NEW_LINE;
                        $two_nl = $nl . $nl;
                        $sep = "========================" . $two_nl;
                        if (SESSION_LANGUAGE == 'german') {
                            $subject = 'hat eine Kreditkarten-Zahlung abgelehnt';
                            $message = 'User: '******'email_address'] . $two_nl . "Kreditkarten-Information" . $nl . $sep . "Owner:       " . trim($cc_first_name . BLANK . $cc_last_name) . $nl . "Card:        " . $cc_type . $nl . "Number:      " . $cc_number . $nl . "Valid until: " . $cc_expdate_month . SLASH . $cc_expdate_year . $nl . "CVN:         " . $cc_checkcode . $two_nl . "Amount:      " . number_format($order->products['total'], 2) . $two_nl . $sep . 'Um die Sicherheit Ihrer Kunden zu gewährleisten, löschen Sie bitte diese eMail, ' . 'nachdem Sie die Zahlung manuell belastet haben!';
                        } else {
                            $subject = 'declined the enclosed credit-card payment';
                            $message = 'User: '******'email_address'] . $two_nl . "Credit Card Informations" . $nl . $sep . "Owner:      " . trim($cc_first_name . BLANK . $cc_last_name) . $nl . "Card:       " . $cc_type . $nl . "Number:     " . $cc_number . $nl . "Valid to:   " . $cc_expdate_month . SLASH . $cc_expdate_year . $nl . "CVN:        " . $cc_checkcode . $two_nl . "Amount:     " . number_format($order->products['total'], 2) . $two_nl . $sep . 'To preserve your customer\'s privacy, please delete this email after you have ' . 'manually processed their card!';
                        }
                        $subject = '***** Paypal ' . $subject . ' *****';
                        olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, STORE_NAME, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, $subject, EMPTY_STRING, str_replace(HASH, $message, $this->in_function), EMAIL_TYPE_TEXT);
                    } else {
                        //If the return is empty
                        if (!olc_not_null($error_log)) {
                            $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_DECLINED . 'No response from PayPal<br/>No response was received from PayPal.
							Please contact the store owner for assistance.', false, FILENAME_CHECKOUT_PAYMENT);
                        } else {
                            $this->away_with_you(MODULE_PAYMENT_PAYPAL_DP_TEXT_DECLINED . $error_log, false, FILENAME_CHECKOUT_PAYMENT);
                        }
                    }
                }
            } else {
                $return_codes = array($final_req->TransactionID, $final_req->AVSCode, $final_req->CVV2Code);
            }
            $this->payment_type = 'PayPal Direct Payment';
            $this->trans_id = $return_codes[0];
            $this->payment_status = PAYPAL_DP_STATUS_COMPLETED;
            $ret_avs = $return_codes[1];
            $ret_cvv2 = $return_codes[2];
            switch ($ret_avs) {
                case 'A':
                    $ret_avs_msg = 'Address Address only (no ZIP)';
                    break;
                case 'B':
                    $ret_avs_msg = 'International “A” Address only (no ZIP)';
                    break;
                case 'C':
                    $ret_avs_msg = 'International “N” None';
                    break;
                case 'D':
                    $ret_avs_msg = 'International “X” Address and Postal Code';
                    break;
                case 'E':
                    $ret_avs_msg = 'Not allowed for MOTO (Internet/Phone)';
                    break;
                case 'F':
                    $ret_avs_msg = 'UK-specific “X” Address and Postal Code';
                    break;
                case 'G':
                    $ret_avs_msg = 'Global Unavailable Not applicable';
                    break;
                case 'I':
                    $ret_avs_msg = 'International Unavailable Not applicable';
                    break;
                case 'N':
                    $ret_avs_msg = 'No None';
                    break;
                case 'P':
                    $ret_avs_msg = 'Postal (International “Z”) Postal Code only (no Address)';
                    break;
                case 'R':
                    $ret_avs_msg = 'Retry Not applicable';
                    break;
                case 'S':
                    $ret_avs_msg = 'Service not Supported Not applicable';
                    break;
                case 'U':
                    $ret_avs_msg = 'Unavailable Not applicable';
                    break;
                case 'W':
                    $ret_avs_msg = 'Whole ZIP Nine-digit ZIP code (no Address)';
                    break;
                case 'X':
                    $ret_avs_msg = 'Exact match Address and nine-digit ZIP code';
                    break;
                case 'Y':
                    $ret_avs_msg = 'Yes Address and five-digit ZIP';
                    break;
                case 'Z':
                    $ret_avs_msg = 'ZIP Five-digit ZIP code (no Address)';
                    break;
                default:
                    $ret_avs_msg = 'Error';
            }
            switch ($ret_cvv2) {
                case 'M':
                    $ret_cvv2_msg = 'Match CVV2';
                    break;
                case 'N':
                    $ret_cvv2_msg = 'No match None';
                    break;
                case 'P':
                    $ret_cvv2_msg = 'Not Processed Not applicable';
                    break;
                case 'S':
                    $ret_cvv2_msg = 'Service not Supported Not applicable';
                    break;
                case 'U':
                    $ret_cvv2_msg = 'Unavailable Not applicable';
                    break;
                case 'X':
                    $ret_cvv2_msg = 'No response Not applicable';
                    break;
                default:
                    $ret_cvv2_msg = 'Error';
                    break;
            }
            $this->avs = $ret_avs_msg;
            $this->cvv2 = $ret_cvv2_msg;
        }
    }
   ---------------------------------------------------------------------------*/
require 'includes/application_top.php';
// include needed functions
require_once DIR_FS_INC . 'olc_image_button.inc.php';
require_once DIR_FS_INC . 'olc_draw_input_field.inc.php';
// include the mailer-class
require_once DIR_WS_CLASSES . 'class.phpmailer.php';
if (isset($_GET['action']) && $_GET['action'] == 'process') {
    $check_affiliate_query = olc_db_query("select affiliate_firstname, affiliate_lastname, affiliate_password, affiliate_id from " . TABLE_AFFILIATE . " where affiliate_email_address = '" . $_POST['email_address'] . APOS);
    if (olc_db_num_rows($check_affiliate_query)) {
        $check_affiliate = olc_db_fetch_array($check_affiliate_query);
        // Crypted password mods - create a new password, update the database and mail it to them
        $newpass = olc_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
        $crypted_password = olc_encrypt_password($newpass);
        olc_db_query(SQL_UPDATE . TABLE_AFFILIATE . " set affiliate_password = '******' where affiliate_id = '" . $check_affiliate['affiliate_id'] . APOS);
        olc_php_mail(AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, $_POST['email_address'], $check_affiliate['affiliate_firstname'] . BLANK . $check_affiliate['affiliate_lastname'], '', AFFILIATE_EMAIL_ADDRESS, STORE_OWNER, '', '', EMAIL_PASSWORD_REMINDER_SUBJECT, nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)), nl2br(sprintf(EMAIL_PASSWORD_REMINDER_BODY, $newpass)));
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_AFFILIATE, 'info_message=' . urlencode(TEXT_PASSWORD_SENT), SSL, true, false));
        } else {
            echo $mail_error;
        }
    } else {
        olc_redirect(olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, 'email=nonexistent', SSL));
    }
} else {
    $breadcrumb->add(NAVBAR_TITLE, olc_href_link(FILENAME_AFFILIATE, '', SSL));
    $breadcrumb->add(NAVBAR_TITLE_PASSWORD_FORGOTTEN, olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, '', SSL));
    require DIR_WS_INCLUDES . 'header.php';
    $smarty->assign('FORM_ACTION', olc_draw_form('password_forgotten', olc_href_link(FILENAME_AFFILIATE_PASSWORD_FORGOTTEN, 'action=process', SSL)));
    $smarty->assign('INPUT_EMAIL', olc_draw_input_field('email_address', '', 'maxlength="96"'));
    $smarty->assign('LINK_AFFILIATE', HTML_A_START . olc_href_link(FILENAME_AFFILIATE, '', SSL) . '">' . olc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . HTML_A_END);
 function import()
 {
     $this->time_start = time();
     $lines = 1;
     $lines_ok = 0;
     // sonstige variablen
     $newsletter = 0;
     $set_suburb = ACCOUNT_SUBURB == TRUE_STRING_S;
     $set_state = ACCOUNT_STATE == TRUE_STRING_S;
     $email_adresses = array();
     $error = EMPTY_STRING;
     define('INSERT_INTO_CUSTOMERS_INFO_SQL', INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('");
     define('SELECT_COUNTRY_SQL', SELECT_ALL . "`countries` WHERE `countries_iso_code_2` = '");
     $check_email_sql = SELECT_COUNT . "as total from " . TABLE_CUSTOMERS . " where customers_email_address = '";
     $update_table_customers = SQL_UPDATE . TABLE_CUSTOMERS . " set customers_default_address_id = '";
     $fh = fopen($this->filename, "r");
     if ($fh) {
         $zeile = fgets($fh);
         while (!feof($fh)) {
             // zeile einlesen & werte zuweisen
             $zeile = trim(fgets($fh));
             if ($zeile) {
                 $dataArray = explode(SEMI_COLON, $zeile);
                 for ($j = 0, $m = sizeof($this->dataArray); $j < $m; $j++) {
                     $data = $this->dataArray[$j];
                     if (substr($data, -1) == CSV_TEXTSIGN) {
                         $dataArray[$j] = substr($data, 1, strlen($data) - 2);
                     }
                 }
                 list($cid, $gruppe, $anrede, $email_address, $company, $lkz, $lastname, $city, $postcode, $password, $street_address, $fax, $telephone, $firstname, $d_company, $d_lkz, $d_lastname, $d_city, $d_postcode, $d_street_address, $d_fax, $d_telephone, $d_firstname) = $dataArray;
                 $lines++;
                 if (!$password) {
                     // neues zufallspasswort erstelllen.
                     $password = getpass(10);
                 }
                 // vorhandene Daten aufbereiten.
                 $gruppe = trim($gruppe);
                 switch ($gruppe) {
                     case "Registriert":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_CUSTOMER;
                         break;
                     case "Merchant":
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_DEALER;
                         break;
                     default:
                         $customers_status = DEFAULT_CUSTOMERS_STATUS_ID_GUEST;
                 }
                 $anrede = trim($anrede);
                 switch ($anrede) {
                     case "Herr":
                         $gender = "m";
                         break;
                     case "Frau":
                         $gender = "f";
                         break;
                     default:
                         $gender = "m";
                 }
                 $country = set_country_info($lkz);
                 $geburtsdatum = trim($geburtsdatum);
                 if ($geburtsdatum != EMPTY_STRING && $geburtsdatum != ".000000000") {
                     list($jahr, $monat, $tag) = sscanf($geburtsdatum, "%4d%2d%2d.%d");
                     $dob = sprintf("%02d.%02d.%4d", $tag, $monat, $jahr);
                 } else {
                     $dob = EMPTY_STRING;
                 }
                 // daten in db eintragen
                 $vatID = new vat_validation($vat, EMPTY_STRING, EMPTY_STRING, $country);
                 $customers_status = $vatID->vat_info['status'];
                 $customers_vat_id_status = $vatID->vat_info['vat_id_status'];
                 if ($vatID->vat_info['error']) {
                     $error .= ENTRY_VAT_ERROR;
                 }
                 $email_address = trim($email_address);
                 $check_email_query = olc_db_query($check_email_sql . olc_db_input($email_address) . "' and account_type = '0'");
                 $check_email = olc_db_fetch_array($check_email_query);
                 $s = QUOTE . $email_address . QUOTE . ' -- ';
                 if ($check_email['total'] > 0) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS . LPAREN . EMAIL_ALREADY_USED . $email_adresses[$email_address] . RPAREN;
                 } elseif (strlen($email_address) < ENTRY_EMAIL_ADDRESS_MIN_LENGTH) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_ERROR;
                 } elseif (olc_validate_email($email_address) == false) {
                     $error .= $s . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
                     /*
                     $fp3 = fopen("kunden_import_mail-check-fail.csv", "a");
                     fputs($fp3, $zeile);
                     fclose ($fp3);
                     */
                 }
                 if ($email_adresses[$email_address]) {
                     $email_adresses[$email_address] .= COMMA_BLANK;
                 }
                 $email_adresses[$email_address] .= $lines;
                 if ($dob != EMPTY_STRING) {
                     $date_raw = olc_date_raw($dob);
                     if (checkdate(substr($date_raw, 4, 2), substr($date_raw, 6, 2), substr($date_raw, 0, 4)) == false) {
                         $error .= QUOTE . $dob . QUOTE . ' -- ' . ENTRY_DATE_OF_BIRTH_ERROR;
                     }
                 }
                 if ($error) {
                     $this->errorLog[] = sprintf(TEXT_ERROR, $error, $lines);
                     $error = EMPTY_STRING;
                 } else {
                     $lines_ok++;
                     $cid = trim($cid);
                     $firstname = trim($firstname);
                     $lastname = trim($lastname);
                     $telephone = trim($telephone);
                     $fax = trim($fax);
                     $street_address = trim($street_address);
                     $company = trim($company);
                     $postcode = trim($postcode);
                     $city = trim($city);
                     $sql_data_array = array('customers_cid' => $cid, 'customers_vat_id' => $vat, 'customers_vat_id_status' => $customers_vat_id_status, 'customers_status' => $customers_status, 'customers_firstname' => $firstname, 'customers_lastname' => $lastname, 'customers_email_address' => $email_address, 'customers_telephone' => $telephone, 'customers_fax' => $fax, 'customers_newsletter' => $newsletter, 'customers_password' => olc_encrypt_password($password), 'customers_gender' => $gender, 'customers_dob' => $date_raw, 'customers_date_added' => 'now()', 'customers_last_modified' => 'now()');
                     olc_db_perform(TABLE_CUSTOMERS, $sql_data_array);
                     $user_id = olc_db_insert_id();
                     $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                     olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     $address_id = olc_db_insert_id();
                     olc_db_query($update_table_customers . $address_id . "' where customers_id = '" . (int) $user_id . APOS);
                     olc_db_query(INSERT_INTO_CUSTOMERS_INFO_SQL . (int) $user_id . "', '0', now())");
                     if ($d_lkz) {
                         //Separate delivery-adress.
                         $country = set_country_info($d_lkz);
                         $firstname = trim($d_firstname);
                         $lastname = trim($d_lastname);
                         $telephone = trim($d_telephone);
                         $fax = trim($d_fax);
                         $street_address = trim($d_street_address);
                         $company = trim($d_company);
                         $postcode = trim($d_postcode);
                         $city = trim($d_city);
                         $sql_data_array = array('customers_id' => $user_id, 'entry_firstname' => $firstname, 'entry_lastname' => $lastname, 'entry_street_address' => $street_address, 'entry_postcode' => $postcode, 'entry_city' => $city, 'entry_country_id' => $country, 'entry_gender' => $gender, 'entry_company' => $company, 'address_date_added' => 'now()', 'address_last_modified' => 'now()');
                         olc_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);
                     }
                     // create smarty elements
                     if ($send_mail) {
                         $this->smarty->assign('GENDER', $gender);
                         $this->smarty->assign('FIRSTNAME', $firstname);
                         $this->smarty->assign('LASTNAME', $lastname);
                         $this->smarty->assign('EMAIL', $email_address);
                         $this->smarty->assign('PASSWORT', $password);
                         $this->smarty->caching = false;
                         $txt_mail_customer = $this->smarty->fetch($this->email_template);
                         // mail versenden
                         olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $firstname . BLANK . $lastname, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, TEXT_MAIL_SUBJECT, EMPTY_STRING, $txt_mail_customer);
                     }
                 }
                 flush();
             }
         }
         fclose($fh);
     } else {
         $file_error = TEXT_FILE_ERROR_OPEN;
     }
     if ($file_error) {
         $this->errorLog[] = sprintf(TEXT_ERROR_FILE, $file_error);
     }
     $this->result = array(array('prod_new' => $lines_ok . " von " . ($lines - 1)), $this->errorLog, $this->calcElapsedTime($this->time_start));
     return $this->result;
 }
Пример #18
0
 function after_process()
 {
     global $insert_id;
     if (defined('MODULE_PAYMENT_CC_EMAIL') && olc_validate_email(MODULE_PAYMENT_CC_EMAIL)) {
         $message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n" . 'CVV:' . $this->cc_cvv . "\n\n" . 'Start:' . $this->cc_start . "\n\n" . 'ISSUE:' . $this->cc_issue . "\n\n";
         olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, MODULE_PAYMENT_CC_EMAIL, EMPTY_STRING, EMPTY_STRING, STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, EMPTY_STRING, EMPTY_STRING, 'Extra Order Info: #' . $insert_id, nl2br($message), $message);
     }
 }
function sendemail($emailtext, $email)
{
    $usersql = SELECT_ALL . TABLE_CUSTOMERS . SQL_WHERE . "customers_email_address ='" . $email . APOS;
    $myuser = olc_db_query($usersql);
    $myuser_values = olc_db_fetch_array($myuser);
    $stack = explode(COLON, $myuser_values['customers_password']);
    $link0 = HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
    $link = $link0 . FILENAME_CUSTOMER_DEFAULT;
    $smarty->assign('HOME_LINK', $link);
    $link = $link0 . FILENAME_LOGIN . "?action=auction&email_address=" . $email . "&password="******"stylesheet.css";
    $debug_output = "file: " . $file . HTML_BR;
    if (file_exists($file)) {
        $style = file_get_contents($file);
        $poss = strpos($style, "body");
        if (!($poss === false)) {
            $pose = strpos($style, "}", $poss);
            if (!($pose === false)) {
                $style_body = substr($style, 0, $pose + 1);
                $s = "\t\t\t";
                $style_body = str_replace("../../", HTTP_SERVER . DIR_WS_CATALOG, $style_body);
                $style_body = $s . str_replace(NEW_LINE, NEW_LINE . $s, $style_body);
                $smarty->assign('STYLE', $style_body);
            }
        }
    }
    $template = ADMIN_PATH_PREFIX . 'order_mail_ebay';
    $html_mail = $smarty->fetch($template . HTML_EXT);
    $firstname = $myuser_values['customers_firstname'];
    $lastname = $myuser_values['customers_lastname'];
    // create subject
    $order_subject = str_replace('{$nr}', $insert_id, EMAIL_BILLING_SUBJECT_ORDER);
    $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject);
    $order_subject = str_replace('{$firstname}', $firstname, $order_subject);
    $order_subject = str_replace('{$lastname}', $lastname, $order_subject);
    $eMail = $order->customer['email_address'];
    $name = trim($firstname . BLANK . $lastname);
    // send mail to admin
    olc_php_mail($email, $name, EMAIL_BILLING_FORWARDING_STRING, STORE_NAME, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, AUCTIONS_TEXT_AUCTION_SOLD_EMAIL_SUBJECT, $html_mail, EMPTY_STRING, EMAIL_TYPE_HTML);
    // send mail to customer
    olc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $email, $name, EMPTY_STRING, EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, AUCTIONS_TEXT_AUCTION_SOLD_EMAIL_SUBJECT, $html_mail, EMPTY_STRING, EMAIL_TYPE_HTML);
    /*
    $emailcontent = "Guten Tag ".trim($myuser_values['customers_firstname'].BLANK.$myuser_values['customers_lastname'])."!\n\n";
    $emailcontent .= "Sie haben folgende Artikel bei unserer Ebay-Auktion ersteigert:\n";
    $emailcontent .= $emailtext."\n\n";
    $emailcontent .= "Die Artikel warten bereits im Warenkorb unseres Onlineshops auf Sie.\n";
    $emailcontent .= "Über diesen Link ".$link." kommen sie direkt zu den ersteigerten Artikeln.\n\n";
    $emailcontent .= "Dankesfloskel\n";
    $emailcontent .= "Mit freundlichen Grüßen\n";
    $emailcontent .= STORE_NAME.NEW_LINE.STORE_OWNER;
    olc_mail($myuser_values['customers_firstname'].BLANK.$myuser_values['customers_lastname'],$email,
    "Ebay Auktion - Abwicklung", $emailcontent, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    */
}
        $smarty = new Smarty();
        $smarty->assign('GENDER', $gender);
        $smarty->assign('FIRSTNAME', $firstname);
        $smarty->assign('LASTNAME', $lastname);
        $smarty->assign('EMAIL', $email_address);
        $smarty->assign('PASSWORT', $password);
        $smarty->caching = false;
        $txt_mail_customer = $smarty->fetch(DIR_FS_CATALOG . 'kunden_import_mail.txt');
        $mail_subject = "Unser neuer Onlineshop";
        /*
        echo "<pre>\n";
        echo $txt_mail_customer;
        echo "</pre>\n";
        */
        // mail versenden
        olc_php_mail(STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, $email_address, $firstname . ' ' . $lastname, '', STORE_OWNER_EMAIL_ADDRESS, STORE_OWNER, '', '', $mail_subject, '', $txt_mail_customer);
    } else {
        if (!$do_not_report == true) {
            echo "<b color=\"red\">fehler beim anlegen von {$firstname}, {$lastname}, {$company}, {$email_address}</b><br>\n";
            echo "<b>------------------------------------------------------------------------------------------------------</b><br>\n";
        }
    }
    flush();
}
fclose($fh);
echo "{$lines_ok} von {$lines} Daten importiert!";
include 'includes/application_bottom.php';
/*
Und das Mail-Template:

{if $GENDER == 'f'}
 $remove_url0 = HTTP_CATALOG_SERVER . DIR_WS_CATALOG . FILENAME_CATALOG_NEWSLETTER . '?action=remove&x=true&email=';
 $two_nl = chr(10) . chr(10);
 $link_start = $two_nl . TEXT_NEWSLETTER_REMOVE_LINK . $two_nl . '#' . $remove_url0;
 $link_start_text = str_replace(HASH, EMPTY_STRING, $link_start);
 $link_start_html = str_replace(HASH, HTML_A_START, $link_start);
 $link_end_html = '">' . TEXT_NEWSLETTER_REMOVE . HTML_A_END . $two_nl . '(' . $remove_url0;
 $sql_update = SQL_UPDATE . $temp_table . " SET comment='send' WHERE id='";
 for ($i = 1; $i <= $max_runtime; $i++) {
     // mail
     $i1 = $i - 1;
     $current_email_data = $email_data[$i1];
     $email = $current_email_data['email'];
     $s = $email . '&key=' . $current_email_data['key'];
     $link_text = $link_start_text . $s;
     $link_html = $link_start_html . $s . $link_end_html . $s . RPAREN;
     olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $email, trim($current_email_data['lastname'] . BLANK . $current_email_data['firstname']), EMPTY_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, EMPTY_STRING, EMPTY_STRING, $newsletters_title, $newsletters_body_text . $link_text . $newsletter_impressum_text, $newsletters_body_html . nl2br($link_html) . $newsletter_impressum_html, $current_email_data['type']);
     olc_db_query($sql_update . $current_email_data['id'] . APOS);
 }
 if ($finished) {
     // finished
     $limit1_query = olc_db_query("SELECT count(*) as count" . $temp_table_from . " WHERE comment='send'");
     $limit1_data = olc_db_fetch_array($limit1_query);
     if ($limit1_data['count'] - $limit_data['count'] <= 0) {
         olc_db_query(SQL_UPDATE . TABLE_MODULE_NEWSLETTER . " SET status='1' WHERE newsletter_id='" . $id_get . APOS);
         olc_redirect(olc_href_link(FILENAME_MODULE_NEWSLETTER));
     } else {
         $count = $limit1_data['count'];
         echo HTML_B_START . $count . '<b> eMails verschickt<br/>';
         echo HTML_B_START . $count - $limit_data['count'] . '<b> eMails übrig';
     }
 } else {
        $newpass = olc_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
        $crypted_password = olc_encrypt_password($newpass);
        olc_db_query(SQL_UPDATE . TABLE_CUSTOMERS . " set customers_password = '******' where customers_id = '" . $check_customer['customers_id'] . APOS);
        // assign language to template for caching
        // assign vars
        $smarty->assign('EMAIL', $_POST['email_address']);
        $smarty->assign('PASSWORD', $newpass);
        $smarty->assign('FIRSTNAME', $check_customer['customers_firstname']);
        $smarty->assign('LASTNAME', $check_customer['customers_lastname']);
        // dont allow cache
        $smarty->caching = false;
        // create mails
        $txt_mail = CURRENT_TEMPLATE_MAIL . 'change_password_mail.';
        $html_mail = $smarty->fetch($txt_mail . 'html');
        $txt_mail = $smarty->fetch($txt_mail . 'txt');
        olc_php_mail(EMAIL_SUPPORT_ADDRESS, EMAIL_SUPPORT_NAME, $_POST['email_address'], $check_customer['customers_firstname'] . BLANK . $check_customer['customers_lastname'], EMAIL_SUPPORT_FORWARDING_STRING, EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_SUPPORT_SUBJECT, $html_mail, $txt_mail);
        if (!isset($mail_error)) {
            olc_redirect(olc_href_link(FILENAME_LOGIN, 'info_message=' . urlencode(TEXT_PASSWORD_SENT), SSL, true, false));
        } else {
            echo $mail_error;
        }
    } else {
        olc_redirect(olc_href_link(FILENAME_PASSWORD_FORGOTTEN, 'email=nonexistent', SSL));
    }
} else {
    $breadcrumb->add(NAVBAR_TITLE_1_PASSWORD_FORGOTTEN, olc_href_link(FILENAME_LOGIN, '', SSL));
    $breadcrumb->add(NAVBAR_TITLE_2_PASSWORD_FORGOTTEN, olc_href_link(FILENAME_PASSWORD_FORGOTTEN, '', SSL));
    include DIR_WS_INCLUDES . 'header.php';
    $smarty->assign('FORM_ACTION', olc_draw_form('password_forgotten', olc_href_link(FILENAME_PASSWORD_FORGOTTEN, 'action=process', SSL)));
    $smarty->assign('INPUT_EMAIL', olc_draw_input_field('email_address', '', 'maxlength="96"'));
    $smarty->assign('BUTTON_SUBMIT', olc_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE));