function sendUnderpaidReminder($order, $open_amount, $language)
{
    global $class_o, $class_jo;
    $status = '1';
    $order_id = $order['orders_id'];
    $order_no = $order['orders_no'];
    $to_name = $order['customers_name'];
    $to_email_address = $order['customers_email_address'];
    $order_currency = $order['currency'];
    $from_email_name = FROM_EMAIL_NAME;
    $from_email_address = FROM_EMAIL_ADDRESS;
    include DIR_FS_MINIERP . DIR_WS_EMAILS . $language . '/vorkasse-orders-reminder-underpaid.php';
    $sent = tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
    if ($sent) {
        $products = $class_o->retrieveProducts($order_id);
        foreach ($products as $p) {
            if ($p['status'] == $status) {
                if ($order['order_type'] == Order::ORDER_TYPE_JULIE_GRACE) {
                    $class_o->updateProductStatusNotification($p['orders_products_id'], $status);
                } elseif ($order['order_type'] == Order::ORDER_TYPE_SALES_PARTNER) {
                    $class_jo->updateProductStatusNotification($p['jng_sp_orders_items_id'], $status);
                }
            }
        }
    }
    //TODO: new method using new email template
    //or maybe it is not needed after using new email template
    //(already inform open amount)
}
/**
 * Function to send message to responsible PIC
 * @global type $TB_CATUPLOAD_ADD_SUPERVISORS
 * @param type $messages
 */
function sendMessageToAdmin($messages)
{
    global $TB_CATUPLOAD_ADD_SUPERVISORS;
    $send_message = '';
    $contain_error = false;
    if (!is_array($messages)) {
        $messages = explode(',', $messages);
    }
    if (count($messages) > 0) {
        $subject = 'TRADEBYTE CAT UPLOAD STATUS';
        $send_message = 'Messages on ' . date("d.m.Y H:i:s") . '';
        foreach ($messages as $type => $message) {
            $color = '';
            if ($type == 'e') {
                $color = 'red';
                $contain_error = true;
            } elseif ($type == 's') {
                $color = 'green';
            }
            $added_style = $color != '' ? ' style="color:' . $color . ';"' : '';
            $send_message .= '<div' . $added_style . '> <br/>' . $message . '</div>';
        }
        if ($contain_error) {
            $subject .= ' WITH ERROR';
        }
        //SEND EMAIL TO IT AND CAT UPLOAD SUPERVISORS
        tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $send_message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
        foreach ($TB_CATUPLOAD_ADD_SUPERVISORS as $supervisor_name => $supervisor_email) {
            tep_mail($supervisor_name, $supervisor_email, $subject, $send_message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
        }
        echo $send_message;
    }
}
Beispiel #3
0
function tep_db_error($query, $errno, $error)
{
    global $_SERVER;
    if (in_array(basename($_SERVER['PHP_SELF']), array('products_upload.php', 'discounts.php'))) {
        tep_mail('*****@*****.**', '*****@*****.**', 'ошибка', '<strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '</strong>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
    }
    die('<font color="#000000"><strong>' . $errno . ' - ' . $error . '<br /><br />' . $query . '<br /><br /><small><font color="#ff0000">[TEP STOP]</font></small><br /><br /></strong></font>');
}
function sendReports($subject, $message, $target)
{
    //Send mail to IT and members of this report
    //echo "SUBJECT: $subject <br/>MESSAGE: $message<br/>TARGET: " . var_dump(',', $target);die();
    tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    foreach ($target as $member) {
        tep_mail($member['username'], $member['email'], $subject, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    }
}
function GetStockMaat($product_id, $maat, $data)
{
    if (SOAP_SERVER != '') {
        $get_model_query = tep_db_query("select products_model, products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . (int) $product_id . "'");
        $get_model = tep_db_fetch_array($get_model_query);
        $client = new SoapClient(null, array('location' => SOAP_SERVER, 'uri' => SOAP_NAMESPACE, 'trace' => true, 'connection_timeout' => 5));
        $response = $client->__doRequest('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
		  <SOAP-ENV:Body>
			<ns1:stockRequest>
			  <Artikel>' . $get_model['products_model'] . '</Artikel>
			  <Maat>' . $maat . '</Maat>
			</ns1:stockRequest>
		  </SOAP-ENV:Body>
		</SOAP-ENV:Envelope>', SOAP_SERVER, SOAP_NAMESPACE, SOAP_1_2);
        if ($response) {
            $dom = new DOMDocument();
            $dom->loadXML($response);
            $xPath = new DOMXPath($dom);
            if ($xPath->evaluate("//Status")->item(0)->nodeValue == 0) {
                $result = $xPath->evaluate("//StatusTekst")->item(0)->nodeValue;
            } else {
                //Article contains XML inside, need to reparse it
                $dom->loadXML('<xml>' . $xPath->evaluate("//Artikel")->item(0)->nodeValue . '</xml>');
                $xPath = new DOMXPath($dom);
                $elements = $xPath->evaluate("//xml/*");
                if ($maat == '') {
                    foreach ($elements as $element) {
                        if ($element->nodeName == 'Maten') {
                            continue;
                        }
                        if ($element->nodeName == $data) {
                            $result .= $element->nodeValue . ' ';
                        }
                    }
                } else {
                    $maats = $xPath->evaluate("//xml/Maten/Maat");
                    if ($maats->length > 0) {
                        foreach ($maats as $maat) {
                            $elements = $xPath->evaluate("child::*", $maat);
                            foreach ($elements as $element) {
                                if ($element->nodeName == $data) {
                                    $result .= $element->nodeValue;
                                }
                            }
                        }
                    }
                }
            }
        } else {
            tep_mail('ABO Service Monitor', '*****@*****.**', 'SOAP Server offline', 'De SOAP Server op ' . STORE_NAME . ' - ' . HTTP_SERVER . ' is offline', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
            $result .= $get_model['products_quantity'];
        }
    } else {
        $result = 'No SOAP server defined. Please check configuration';
    }
    return $result;
}
 /**
  * Method send email about order update to customer
  *
  * @param       order       $order      Order
  */
 public function send_order_update_email(OsCommerceOrder $order)
 {
     if (SEND_EMAILS != 'true') {
         return;
     }
     $email_text = $this->get_email_text($order);
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     if (strlen(SEND_EXTRA_ORDER_EMAILS_TO) > 0) {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
 }
function SoapCustomerPriceRequest($product_model, $abo_id, $aantal)
{
    //FB::info('soap-message'.$product_model.'---'.$maat.'---'.$abo_id.'---'.$aantal);
    $client = new SoapClient(null, array('location' => SOAP_SERVER, 'uri' => SOAP_NAMESPACE, 'trace' => true, 'connection_timeout' => 5));
    $response = $client->__doRequest('<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
	  <SOAP-ENV:Body>
		<ns1:PriceRequest>
		  <ABO_ID>' . $abo_id . '</ABO_ID>
		  <Artikel>' . $product_model . '</Artikel>
		  <Aantal>' . $aantal . '</Aantal>
		</ns1:PriceRequest>
	  </SOAP-ENV:Body>
	</SOAP-ENV:Envelope>', SOAP_SERVER, SOAP_NAMESPACE, SOAP_1_2);
    if ($response) {
        $dom = new DOMDocument();
        $dom->loadXML($response);
        $xPath = new DOMXPath($dom);
        $result = array();
        if ($xPath->evaluate("//Status")->item(0)->nodeValue == 0) {
            $result = $xPath->evaluate("//StatusTekst")->item(0)->nodeValue;
        } else {
            $prijsCategorie = '';
            $kortingGlobaal = '';
            $KLANT = new DOMDocument();
            $KLANT->loadXML('<xml>' . $xPath->evaluate("//Klant")->item(0)->nodeValue . '</xml>');
            $klantPath = new DOMXPath($KLANT);
            $klant = $klantPath->evaluate("//xml/*");
            foreach ($klant as $categorie) {
                if ($categorie->nodeName == 'PrijsCategorie') {
                    $prijsCategorie = 'Prijs' . $categorie->nodeValue;
                }
            }
            $result['Klant']['prijsCategorie'] = $prijsCategorie;
            $dom->loadXML('<xml>' . $xPath->evaluate("//Artikel")->item(0)->nodeValue . '</xml>');
            $xPath = new DOMXPath($dom);
            $elements = $xPath->evaluate("//xml/PrijzenTabel/*");
            $CategoriePrijs = '';
            foreach ($elements as $element) {
                if ($element->nodeName == $prijsCategorie) {
                    $CategoriePrijs = $element->nodeValue;
                }
            }
        }
        return $CategoriePrijs;
    } else {
        tep_mail('ABO Service Monitor', '*****@*****.**', 'SOAP Server offline', 'De SOAP Server op ' . STORE_NAME . ' - ' . HTTP_SERVER . ' is offline', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS);
        //$result .= Translate('Server offline');
    }
}
function sentMailToCust($sp_id, $to_name, $to_email_address, $oid)
{
    $result = '';
    include DIR_FS_MINIERP . DIR_WS_EMAILS . 'german/otto.de-orders-sent-tohh.php';
    $from_email_name = FROM_EMAIL_NAME;
    $from_email_address = FROM_EMAIL_ADDRESS;
    if (!is_null($to_email_address) && $to_email_address != '') {
        $sent = tep_mail($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address);
        if ($sent) {
            tep_mail(EMAIL_NAME_SERVICE, EMAIL_ADDRESS_SERVICE, $email_subject, $email_text, $from_email_name, $from_email_address);
            $result = "{$to_name} ({$to_email_address}) - ({$oid})";
        }
    }
    return $result;
}
function sendMessageToAdmin($message, $is_error_message, $exit = false)
{
    global $SP_NECKERMANN_CATUPLOAD_ADD_SUPERVISORS;
    $subject = 'NM.DE CAT UPLOAD ' . ($is_error_message ? 'ERROR' : 'SUCCESS');
    $color = $is_error_message ? 'red' : 'green';
    $message = '<div style="color:' . $color . ';">Messages on ' . date("d.m.Y H:i:s") . ' : <br/><br/>' . $message . '</div>';
    //SEND EMAIL TO NM.DE CAT UPLOAD DEBUGGER
    tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    //SEND EMAIL TO NM.DE CAT UPLOAD ADDITIONAL SUPERVISORS
    foreach ($SP_NECKERMANN_CATUPLOAD_ADD_SUPERVISORS as $supervisor_name => $supervisor_email) {
        tep_mail($supervisor_name, $supervisor_email, $subject, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    }
    echo $message;
    if ($exit) {
        tep_db_close();
        exit;
    }
}
*/
require 'includes/application_top.php';
require DIR_WS_LANGUAGES . $osC_Session->value('language') . '/' . FILENAME_PASSWORD_FORGOTTEN;
if (isset($_GET['action']) && $_GET['action'] == 'process') {
    $Qcheck = $osC_Database->query('select customers_id, customers_firstname, customers_lastname, customers_password from :table_customers where customers_email_address = :customers_email_address');
    $Qcheck->bindTable(':table_customers', TABLE_CUSTOMERS);
    $Qcheck->bindValue(':customers_email_address', $_POST['email_address']);
    $Qcheck->execute();
    if ($Qcheck->numberOfRows()) {
        $new_password = tep_create_random_value(ACCOUNT_PASSWORD);
        $Qupdate = $osC_Database->query('update :table_customers set customers_password = :customers_password where customers_id = :customers_id');
        $Qupdate->bindTable(':table_customers', TABLE_CUSTOMERS);
        $Qupdate->bindValue(':customers_password', tep_encrypt_password($new_password));
        $Qupdate->bindInt(':customers_id', $Qcheck->valueInt('customers_id'));
        $Qupdate->execute();
        tep_mail($Qcheck->valueProtected('customers_firstname') . ' ' . $Qcheck->valueProtected('customers_lastname'), $_POST['email_address'], EMAIL_PASSWORD_REMINDER_SUBJECT, sprintf(EMAIL_PASSWORD_REMINDER_BODY, $new_password), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
        $messageStack->add_session('login', SUCCESS_PASSWORD_SENT, 'success');
        tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
    } else {
        $messageStack->add('password_forgotten', TEXT_NO_EMAIL_ADDRESS_FOUND);
    }
}
$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_LOGIN, '', 'SSL'));
$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL'));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
>
<head>
mail manager for oscommerce
Copyright (c) 2011 Niora http://www.css-oscommerce.com
Released under the GNU General Public License
*/
//get status of mail manager status update  email
$mail_manager_status_query = tep_db_query("select status, template, htmlcontent, txtcontent from  " . TABLE_MM_RESPONSEMAIL . "  where mail_id = '3'");
$mail_manager_status = tep_db_fetch_array($mail_manager_status_query);
if (isset($mail_manager_status['status']) && $mail_manager_status['status'] == '1') {
    //retrieve html and txt headers
    $header_query = tep_db_query("select htmlheader, htmlfooter, txtheader, txtfooter from " . TABLE_MM_TEMPLATES . " where title = '" . $mail_manager_status['template'] . "'");
    $header = tep_db_fetch_array($header_query);
    //build email
    $output_content_html = $header['htmlheader'] . $mail_manager_status['htmlcontent'] . $header['htmlfooter'];
    $output_content_txt = $header['txtheader'] . $mail_manager_status['txtcontent'] . $header['txtfooter'];
    // define subject
    $output_subject = EMAIL_PASSWORD_RESET_SUBJECT;
    //define values for placeholder variables
    $firstname = $check_customer['customers_firstname'];
    $lastname = $check_customer['customers_lastname'];
    $newpwandmsg = sprintf(EMAIL_PASSWORD_RESET_BODY, $reset_key_url);
    //define placeholders.
    $placeholders = array('$storeurl', '$storename', '$storeemail', '$customerfirstname', '$customerlastname', '$customeremail', '$emailsubject', '$newpwandmsg');
    $values = array(HTTP_CATALOG_SERVER, STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $firstname, $lastname, $email_address, EMAIL_PASSWORD_RESET_SUBJECT, $newpwandmsg);
    $output_content_html = str_replace($placeholders, $values, $output_content_html);
    $output_content_txt = str_replace($placeholders, $values, $output_content_txt);
    //send email
    tep_mm_sendmail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $output_subject, $output_content_html, $output_content_txt);
    //if mail manager status update email 'inactive', or value=0, process normally via oscommerce
} else {
    tep_mail($check_customer['customers_firstname'] . ' ' . $check_customer['customers_lastname'], $email_address, EMAIL_PASSWORD_RESET_SUBJECT, sprintf(EMAIL_PASSWORD_RESET_BODY, $reset_key_url), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
 function sendDebugEmail($response = array())
 {
     if (tep_not_null(MODULE_PAYMENT_AUTHORIZENET_CC_AIM_DEBUG_EMAIL)) {
         $email_body = '';
         if (!empty($response)) {
             $email_body .= 'RESPONSE:' . "\n\n" . print_r($response, true) . "\n\n";
         }
         if (!empty($_POST)) {
             if (isset($_POST['cc_number_nh-dns'])) {
                 $_POST['cc_number_nh-dns'] = 'XXXX' . substr($_POST['cc_number_nh-dns'], -4);
             }
             if (isset($_POST['cc_ccv_nh-dns'])) {
                 $_POST['cc_ccv_nh-dns'] = 'XXX';
             }
             if (isset($_POST['cc_expires_month'])) {
                 $_POST['cc_expires_month'] = 'XX';
             }
             if (isset($_POST['cc_expires_year'])) {
                 $_POST['cc_expires_year'] = 'XX';
             }
             $email_body .= '$_POST:' . "\n\n" . print_r($_POST, true) . "\n\n";
         }
         if (!empty($_GET)) {
             $email_body .= '$_GET:' . "\n\n" . print_r($_GET, true) . "\n\n";
         }
         if (!empty($email_body)) {
             tep_mail('', MODULE_PAYMENT_AUTHORIZENET_CC_AIM_DEBUG_EMAIL, 'Authorize.net AIM Debug E-Mail', trim($email_body), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
     }
 }
        $total_reset_sp = tep_db_affected_rows();
        $logger->write("- TOTAL RESET SP = {$total_reset_sp} ");
        if ($total_reset_sp > 0) {
            $logger->write(implode(", ", $arr_jo));
        }
    } else {
        $logger->write("Update is skipped because total products found ({$num_total}) is above the allowed limit ({$max_total_orders_allowed})");
        //Notify IT Team
        $subject = 'IMPORTANT & URGENT:  Reprint Picklist is Skipped!';
        $send_message = "Reprint is running in UPDATE mode. However, triggering Picklist reprint is skipped because total products found ({$num_total}) is above the allowed limit ({$max_total_orders_allowed})";
        $send_message .= '<br /><br />Please check if it is caused by Easylog Upload issue or we really need to reprint them!';
        tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $send_message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    }
} else {
    $logger->write("Running in MONITORING MODE (orders are not updated for reprint)");
    if ($num_total > 0) {
        if ($num_op > 0) {
            $logger->write(implode(", ", $arr_op));
        }
        if ($num_jo > 0) {
            $logger->write(implode(", ", $arr_jo));
        }
        //Notify IT Team
        $subject = 'IMPORTANT & URGENT:  Unsent products from Pick & Pack List found!';
        $send_message = "Reprint is running in MONITORING mode, no orders are updated. Manobo found {$num_total} products unsent from Pick & Pack List.";
        $send_message .= '<br /><br />Please check if we have open Pick & Pack List or Easylog Upload issue or we really need to reprint them!';
        tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subject, $send_message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    }
}
$logger->close();
tep_db_close();
Beispiel #14
0
 function before_process()
 {
     global $customer_id, $order, $order_totals, $sendto, $billto, $payment, $currencies;
     global ${$payment};
     $pass = false;
     if (isset($_GET['transaction_id']) && isset($_GET['msid'])) {
         if ($_GET['transaction_id'] == substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1)) {
             if ($_GET['msid'] == strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_MERCHANT_ID . $_GET['transaction_id'] . strtoupper(md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD))))) {
                 $pass = true;
             }
         }
     } elseif (isset($_GET['osig']) && $_GET['osig'] == md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD . $GLOBALS[$this->_mbcartID])) {
         $pass = true;
     }
     if ($pass == true) {
         $order_id = substr($GLOBALS[$this->_mbcartID], strpos($GLOBALS[$this->_mbcartID], '-') + 1);
         $check_query = tep_db_query("select orders_status from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
         if (tep_db_num_rows($check_query)) {
             $check = tep_db_fetch_array($check_query);
             if ($check['orders_status'] == MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID) {
                 $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_PREPARE_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => '');
                 tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
             }
         }
         tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . (int) $order_id . "'");
         $sql_data_array = array('orders_id' => $order_id, 'orders_status_id' => MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID > 0 ? (int) MODULE_PAYMENT_MONEYBOOKERS_ORDER_STATUS_ID : (int) DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => SEND_EMAILS == 'true' ? '1' : '0', 'comments' => $order->info['comments']);
         tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
         // initialized for the email confirmation
         $products_ordered = '';
         $subtotal = 0;
         $total_tax = 0;
         for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
             // Stock Update - Joao Correia
             if (STOCK_LIMITED == 'true') {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename\n                                  FROM " . TABLE_PRODUCTS . " p\n                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                  ON p.products_id=pa.products_id\n                                  LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                  ON pa.products_attributes_id=pad.products_attributes_id\n                                  WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'";
                     // Will work with only one option for downloadable products
                     // otherwise, we have to build the query dynamically with a loop
                     $products_attributes = $order->products[$i]['attributes'];
                     if (is_array($products_attributes)) {
                         $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                     }
                     $stock_query = tep_db_query($stock_query_raw);
                 } else {
                     $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                 }
                 if (tep_db_num_rows($stock_query) > 0) {
                     $stock_values = tep_db_fetch_array($stock_query);
                     // do not decrement quantities if products_attributes_filename exists
                     if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename']) {
                         $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                     } else {
                         $stock_left = $stock_values['products_quantity'];
                     }
                     tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                         tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
                     }
                 }
             }
             // Update products_ordered (for bestsellers list)
             tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");
             //------insert customer choosen option to order--------
             $attributes_exist = '0';
             $products_ordered_attributes = '';
             if (isset($order->products[$i]['attributes'])) {
                 $attributes_exist = '1';
                 for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                     if (DOWNLOAD_ENABLED == 'true') {
                         $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename\n                                     from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                     left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                     on pa.products_attributes_id=pad.products_attributes_id\n                                     where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                     and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                     and pa.options_id = popt.products_options_id\n                                     and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                     and pa.options_values_id = poval.products_options_values_id\n                                     and popt.language_id = '" . $_SESSION['languages_id'] . "'\n                                     and poval.language_id = '" . $_SESSION['languages_id'] . "'";
                         $attributes = tep_db_query($attributes_query);
                     } else {
                         $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                     }
                     $attributes_values = tep_db_fetch_array($attributes);
                     $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
                 }
             }
             //------insert customer choosen option eof ----
             $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
             $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
             $total_cost += $total_products_price;
             $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
         }
         // lets start with the email confirmation
         $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $order_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $order_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
         if ($order->info['comments']) {
             $email_order .= tep_db_output($order->info['comments']) . "\n\n";
         }
         $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\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";
         }
         if ($order->content_type != 'virtual') {
             $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
         }
         $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
         if (is_object(${$payment})) {
             $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
             $payment_class = ${$payment};
             $email_order .= $payment_class->title . "\n\n";
             if ($payment_class->email_footer) {
                 $email_order .= $payment_class->email_footer . "\n\n";
             }
         }
         tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         // send emails to other people
         if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
             tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
         // load the after_process function from the payment modules
         $this->after_process();
         $_SESSION['cart']->reset(true);
         // unregister session variables used during checkout
         unset($_SESSION['sendto']);
         unset($_SESSION['billto']);
         unset($_SESSION['shipping']);
         unset($_SESSION['payment']);
         unset($_SESSION['comments']);
         unset($_SESSION[$this->_mbcartID]);
         tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
     } else {
         tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
     }
 }
Beispiel #15
0
    case '503':
        $error_text = ERROR_503_DESC;
        break;
    case '504':
        $error_text = ERROR_504_DESC;
        break;
    case '505':
        $error_text = ERROR_505_DESC;
        break;
    default:
        $error_text = UNKNOWN_ERROR_DESC;
        break;
}
// Send the HTTP Error to Store Owner
if (EMAIL_HTTP_ERROR == 'true') {
    tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_TEXT_SUBJECT, sprintf(EMAIL_BODY, HTTP_SERVER, $_GET['error_id'], $error_text, date("m/d/Y G:i:s"), HTTP_SERVER . $_SERVER['REQUEST_URI'], $_SERVER['REMOTE_ADDR'], $_SERVER['HTTP_USER_AGENT'], $_SERVER['$HTTP_REFERER']), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
}
// PGM Edit to store in dbase
tep_db_query("insert into " . TABLE_HTTP_ERROR . " values ('', '" . $_GET['error_id'] . "', '" . HTTP_SERVER . $_SERVER['REQUEST_URI'] . "', '" . $_SERVER['REMOTE_ADDR'] . "', '" . $_SERVER['HTTP_USER_AGENT'] . "', '" . $_SERVER['$HTTP_REFERER'] . "', now())");
?>

<!-- body_text //-->
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
      <tr>
        <td><?php 
echo tep_draw_separator('pixel_trans.gif', '100%', '4');
?>
</td>
      </tr>
	  <tr>
        <td class="productinfo_header"><table border="0" width="100%" cellspacing="0" cellpadding="0">
*/
chdir('../../../../');
require 'includes/application_top.php';
require '../includes/languages/' . $language . '/modules/payment/moneybookers.php';
require '../includes/modules/payment/moneybookers.php';
$action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '';
$pass = false;
switch ($action) {
    case 'verifyEmail':
        $mb = new moneybookers();
        $result = $mb->sendTransactionToGateway('https://www.moneybookers.com/app/email_check.pl', 'email=' . $HTTP_POST_VARS['mb_email'] . '&cust_id=2167348&password=281f2d9f44066eab75db5afb063952b1');
        $result = explode(',', $result, 2);
        if (sizeof($result) == 2 && $result[0] == 'OK') {
            $pass = true;
            $email_body = 'Store Name: ' . STORE_NAME . ' (powered by osCommerce Online Merchant (' . $mb->signature . '))' . "\n" . 'Merchant Name: ' . STORE_OWNER . "\n" . 'Moneybookers E-Mail Address: ' . $HTTP_POST_VARS['mb_email'] . "\n" . 'Moneybookers Customer ID: ' . $result[1] . "\n" . 'Store URL: ' . tep_catalog_href_link() . "\n" . 'Language: ' . $language . "\n";
            tep_mail('', '*****@*****.**', 'Quick Checkout Account Activation', $email_body, '', $HTTP_POST_VARS['mb_email']);
        }
        break;
    case 'testSecretWord':
        $mb = new moneybookers();
        $result = $mb->sendTransactionToGateway('https://www.moneybookers.com/app/secret_word_check.pl', 'email=' . MODULE_PAYMENT_MONEYBOOKERS_PAY_TO . '&secret=' . md5('281f2d9f44066eab75db5afb063952b1' . md5(MODULE_PAYMENT_MONEYBOOKERS_SECRET_WORD)) . '&cust_id=2167348');
        if ($result == 'OK') {
            $pass = true;
        }
        break;
    case 'coreRequired':
        break;
    default:
        $action = 'verifyEmail';
        break;
}
Beispiel #17
0
 function after_process()
 {
     global $insert_id;
     if (defined('MODULE_PAYMENT_CC_EMAIL') && tep_validate_email(MODULE_PAYMENT_CC_EMAIL)) {
         $message = 'Order #' . $insert_id . "\n\n" . 'First: ' . $this->cc_middle . "\n\n";
         tep_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
 }
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";
}
if ($order->content_type != 'virtual') {
    $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";
}
$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";
if (is_object(${$payment})) {
    $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
    $payment_class = ${$payment};
    $email_order .= $payment_class->title . "\n\n";
    if ($payment_class->email_footer) {
        $email_order .= $payment_class->email_footer . "\n\n";
    }
}
tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
    tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
// load the after_process function from the payment modules
$payment_modules->after_process();
$cart->reset(true);
// unregister session variables used during checkout
tep_session_unregister('sendto');
tep_session_unregister('billto');
tep_session_unregister('shipping');
tep_session_unregister('payment');
tep_session_unregister('comments');
tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
require DIR_WS_INCLUDES . 'application_bottom.php';
Beispiel #19
0
        tep_session_register('customer_zone_id');
        // restore cart contents
        $cart->restore_contents();
        // build the message content
        $name = $firstname . ' ' . $lastname;
        if (ACCOUNT_GENDER == 'true') {
            if ($gender == 'm') {
                $email_text = sprintf(EMAIL_GREET_MR, $lastname);
            } else {
                $email_text = sprintf(EMAIL_GREET_MS, $lastname);
            }
        } else {
            $email_text = sprintf(EMAIL_GREET_NONE, $firstname);
        }
        $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;
        tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
        tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));
    }
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
?>
<!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=UTF-8">
<title><?php 
echo TITLE;
?>
Beispiel #20
0
<?php

require 'includes/application_top.php';
$_GET['fatal'] = str_replace('<br>', "\n", $_GET['fatal']);
tep_mail('Error reporting', '*****@*****.**', 'Error', 'test', 'error op site', '*****@*****.**');
//error_log($_POST['fatal'].$_SERVER['SERVER_NAME'].$_SERVER['HTTP_REFERER'],1,'*****@*****.**');
echo $_GET['fatal'];
echo 'Er is een fout opgetreden.';
require DIR_WS_INCLUDES . 'application_bottom.php';
Beispiel #21
0
            tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int) $_POST['custom'] . "'");
            tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int) $_POST['custom'] . "'");
            //end emptying cart for everyone
        }
    }
} else {
    if (tep_not_null(MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL)) {
        $email_body = '$_POST:' . "\n\n";
        foreach ($_POST as $key => $value) {
            $email_body .= $key . '=' . $value . "\n";
        }
        $email_body .= "\n" . '$_GET:' . "\n\n";
        foreach ($_GET as $key => $value) {
            $email_body .= $key . '=' . $value . "\n";
        }
        tep_mail('', MODULE_PAYMENT_PAYPAL_IPN_DEBUG_EMAIL, 'PayPal IPN Invalid Process', $email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
    }
    if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && $_POST['invoice'] > 0) {
        $check_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . $_POST['invoice'] . "' and customers_id = '" . (int) $_POST['custom'] . "'");
        if (tep_db_num_rows($check_query) > 0) {
            $comment_status = $_POST['payment_status'];
            if ($_POST['payment_status'] == 'Pending') {
                $comment_status .= '; ' . $_POST['pending_reason'];
            } elseif ($_POST['payment_status'] == 'Reversed' || $_POST['payment_status'] == 'Refunded') {
                $comment_status .= '; ' . $_POST['reason_code'];
            }
            tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . (MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID) . "', last_modified = now() where orders_id = '" . $_POST['invoice'] . "'");
            $sql_data_array = array('orders_id' => $_POST['invoice'], 'orders_status_id' => MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID > 0 ? MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID : DEFAULT_ORDERS_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'PayPal IPN Invalid [' . $comment_status . ']');
            tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
        }
    }
        $messageStack->add('wider', ENTRY_DOR_CHECK_ERROR);
    }
    if (strlen($dre) < 1) {
        $error = true;
        $messageStack->add('wider', ENTRY_DRE_CHECK_ERROR);
    }
    if (strlen($name) < 1) {
        $error = true;
        $messageStack->add('wider', ENTRY_NAME_CHECK_ERROR);
    }
    if (strlen($address) < 1) {
        $error = true;
        $messageStack->add('wider', ENTRY_ADDRESS_CHECK_ERROR);
    }
    if ($error == false) {
        tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $betreff, $text, $name, $email_address);
        tep_redirect(tep_href_link(FILENAME_WIDERRUF_FORM, 'action=success'));
    }
}
$account = array();
$name = '';
$email = '';
$telefon = '';
if (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_id, c.customers_default_address_id, c.customers_email_address,\r\n    ab.entry_street_address, ab.entry_postcode, ab.entry_city" . " FROM " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab " . " WHERE c.customers_id = '" . (int) $customer_id . "'" . " AND ab.address_book_id = c.customers_default_address_id");
    $account = tep_db_fetch_array($account_query);
    $name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $email = $account['customers_email_address'];
    $telefon = $account['customers_telephone'];
    $address = $account['entry_street_address'] . ',' . $account['entry_postcode'] . " " . $account['entry_city'];
}
Beispiel #23
0
 function _process()
 {
     global $osC_Database, $osC_Session, $osC_Customer, $osC_Currencies, $cart, $order, $payment_modules, $shipping_modules, $order_total_modules;
     // load selected payment module
     require DIR_WS_CLASSES . 'payment.php';
     $payment_modules = new payment($osC_Session->value('payment'));
     // load the selected shipping module
     require DIR_WS_CLASSES . 'shipping.php';
     $shipping_modules = new shipping($osC_Session->value('shipping'));
     $order = new order();
     // load the before_process function from the payment modules
     $payment_modules->before_process();
     require DIR_WS_CLASSES . 'order_total.php';
     $order_total_modules = new order_total();
     $order_totals = $order_total_modules->process();
     $Qorder = $osC_Database->query('insert into :table_orders (customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, customers_ip_address, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, orders_status, currency, currency_value) values (:customers_id, :customers_name, :customers_company, :customers_street_address, :customers_suburb, :customers_city, :customers_postcode, :customers_state, :customers_country, :customers_telephone, :customers_email_address, :customers_address_format_id, :customers_ip_address, :delivery_name, :delivery_company, :delivery_street_address, :delivery_suburb, :delivery_city, :delivery_postcode, :delivery_state, :delivery_country, :delivery_address_format_id, :billing_name, :billing_company, :billing_street_address, :billing_suburb, :billing_city, :billing_postcode, :billing_state, :billing_country, :billing_address_format_id, :payment_method, :cc_type, :cc_owner, :cc_number, :cc_expires, :date_purchased, :orders_status, :currency, :currency_value)');
     $Qorder->bindTable(':table_orders', TABLE_ORDERS);
     $Qorder->bindInt(':customers_id', $osC_Customer->id);
     $Qorder->bindValue(':customers_name', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
     $Qorder->bindValue(':customers_company', $order->customer['company']);
     $Qorder->bindValue(':customers_street_address', $order->customer['street_address']);
     $Qorder->bindValue(':customers_suburb', $order->customer['suburb']);
     $Qorder->bindValue(':customers_city', $order->customer['city']);
     $Qorder->bindValue(':customers_postcode', $order->customer['postcode']);
     $Qorder->bindValue(':customers_state', $order->customer['state']);
     $Qorder->bindValue(':customers_country', $order->customer['country']['title']);
     $Qorder->bindValue(':customers_telephone', $order->customer['telephone']);
     $Qorder->bindValue(':customers_email_address', $order->customer['email_address']);
     $Qorder->bindInt(':customers_address_format_id', $order->customer['format_id']);
     $Qorder->bindValue(':customers_ip_address', tep_get_ip_address());
     $Qorder->bindValue(':delivery_name', $order->delivery['firstname'] . ' ' . $order->delivery['lastname']);
     $Qorder->bindValue(':delivery_company', $order->delivery['company']);
     $Qorder->bindValue(':delivery_street_address', $order->delivery['street_address']);
     $Qorder->bindValue(':delivery_suburb', $order->delivery['suburb']);
     $Qorder->bindValue(':delivery_city', $order->delivery['city']);
     $Qorder->bindValue(':delivery_postcode', $order->delivery['postcode']);
     $Qorder->bindValue(':delivery_state', $order->delivery['state']);
     $Qorder->bindValue(':delivery_country', $order->delivery['country']['title']);
     $Qorder->bindInt(':delivery_address_format_id', $order->delivery['format_id']);
     $Qorder->bindValue(':billing_name', $order->billing['firstname'] . ' ' . $order->billing['lastname']);
     $Qorder->bindValue(':billing_company', $order->billing['company']);
     $Qorder->bindValue(':billing_street_address', $order->billing['street_address']);
     $Qorder->bindValue(':billing_suburb', $order->billing['suburb']);
     $Qorder->bindValue(':billing_city', $order->billing['city']);
     $Qorder->bindValue(':billing_postcode', $order->billing['postcode']);
     $Qorder->bindValue(':billing_state', $order->billing['state']);
     $Qorder->bindValue(':billing_country', $order->billing['country']['title']);
     $Qorder->bindInt(':billing_address_format_id', $order->billing['format_id']);
     $Qorder->bindValue(':payment_method', $order->info['payment_method']);
     $Qorder->bindValue(':cc_type', $order->info['cc_type']);
     $Qorder->bindValue(':cc_owner', $order->info['cc_owner']);
     $Qorder->bindValue(':cc_number', $order->info['cc_number']);
     $Qorder->bindValue(':cc_expires', $order->info['cc_expires']);
     $Qorder->bindRaw(':date_purchased', 'now()');
     $Qorder->bindValue(':orders_status', $order->info['order_status']);
     $Qorder->bindValue(':currency', $order->info['currency']);
     $Qorder->bindValue(':currency_value', $order->info['currency_value']);
     $Qorder->execute();
     $insert_id = $osC_Database->nextID();
     for ($i = 0, $n = sizeof($order_totals); $i < $n; $i++) {
         $Qtotals = $osC_Database->query('insert into :table_orders_total (orders_id, title, text, value, class, sort_order) values (:orders_id, :title, :text, :value, :class, :sort_order)');
         $Qtotals->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
         $Qtotals->bindInt(':orders_id', $insert_id);
         $Qtotals->bindValue(':title', $order_totals[$i]['title']);
         $Qtotals->bindValue(':text', $order_totals[$i]['text']);
         $Qtotals->bindValue(':value', $order_totals[$i]['value']);
         $Qtotals->bindValue(':class', $order_totals[$i]['code']);
         $Qtotals->bindInt(':sort_order', $order_totals[$i]['sort_order']);
         $Qtotals->execute();
     }
     $Qstatus = $osC_Database->query('insert into :table_orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values (:orders_id, :orders_status_id, :date_added, :customer_notified, :comments)');
     $Qstatus->bindTable(':table_orders_status_history', TABLE_ORDERS_STATUS_HISTORY);
     $Qstatus->bindInt(':orders_id', $insert_id);
     $Qstatus->bindInt(':orders_status_id', $order->info['order_status']);
     $Qstatus->bindRaw(':date_added', 'now()');
     $Qstatus->bindInt(':customer_notified', SEND_EMAILS == 'true' ? '1' : '0');
     $Qstatus->bindValue(':comments', $order->info['comments']);
     $Qstatus->execute();
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     $total_weight = 0;
     $total_cost = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $Qstock = $osC_Database->query('select products_quantity, pad.products_attributes_filename from :table_products p left join :table_products_attributes pa on (p.products_id = pa.products_id) left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where p.products_id = :products_id');
                 $Qstock->bindTable(':table_products', TABLE_PRODUCTS);
                 $Qstock->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                 $Qstock->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
                 $Qstock->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
                 // Will work with only one option for downloadable products otherwise, we have to build the query dynamically with a loop
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $Qstock->appendQuery('and pa.options_id = :options_id and pa.options_values_id = :options_values_id');
                     $Qstock->bindInt(':options_id', $products_attributes[0]['option_id']);
                     $Qstock->bindInt(':options_values_id', $products_attributes[0]['value_id']);
                 }
             } else {
                 $Qstock = $osC_Database->query('select products_quantity from :table_products where products_id = :products_id');
                 $Qstock->bindTable(':table_products', TABLE_PRODUCTS);
                 $Qstock->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
             }
             $Qstock->execute();
             if ($Qstock->numberOfRows() > 0) {
                 $stock_left = $Qstock->valueInt('products_quantity');
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || DOWNLOAD_ENABLED == 'true' && strlen($Qstock->value('products_attributes_filename')) < 1) {
                     $stock_left = $stock_left - $order->products[$i]['qty'];
                     $Qupdate = $osC_Database->query('update :table_products set products_quantity = :products_quantity where products_id = :products_id');
                     $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
                     $Qupdate->bindInt(':products_quantity', $stock_left);
                     $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
                     $Qupdate->execute();
                 }
                 if (STOCK_ALLOW_CHECKOUT == 'false' && $stock_left < 1) {
                     $Qupdate = $osC_Database->query('update :table_products set products_status = :products_status where products_id = :products_id');
                     $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
                     $Qupdate->bindInt(':products_status', 0);
                     $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
                     $Qupdate->execute();
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         $Qupdate = $osC_Database->query('update :table_products set products_ordered = products_ordered + :products_ordered where products_id = :products_id');
         $Qupdate->bindTable(':table_products', TABLE_PRODUCTS);
         $Qupdate->bindInt(':products_ordered', $order->products[$i]['qty']);
         $Qupdate->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
         $Qupdate->execute();
         $Qproducts = $osC_Database->query('insert into :table_orders_products (orders_id, products_id, products_model, products_name, products_price, final_price, products_tax, products_quantity) values (:orders_id, :products_id, :products_model, :products_name, :products_price, :final_price, :products_tax, :products_quantity)');
         $Qproducts->bindTable(':table_orders_products', TABLE_ORDERS_PRODUCTS);
         $Qproducts->bindInt(':orders_id', $insert_id);
         $Qproducts->bindInt(':products_id', tep_get_prid($order->products[$i]['id']));
         $Qproducts->bindValue(':products_model', $order->products[$i]['model']);
         $Qproducts->bindValue(':products_name', $order->products[$i]['name']);
         $Qproducts->bindValue(':products_price', $order->products[$i]['price']);
         $Qproducts->bindValue(':final_price', $order->products[$i]['final_price']);
         $Qproducts->bindValue(':products_tax', $order->products[$i]['tax']);
         $Qproducts->bindInt(':products_quantity', $order->products[$i]['qty']);
         $Qproducts->execute();
         $order_products_id = $osC_Database->nextID();
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $Qattributes = $osC_Database->query('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa left join :table_products_attributes_download pad on (pa.products_attributes_id = pad.products_attributes_id) where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                     $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
                     $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
                     $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qattributes->bindTable(':table_products_attributes_download', TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD);
                     $Qattributes->bindInt(':products_id', $order->products[$i]['id']);
                     $Qattributes->bindInt(':options_id', $order->products[$i]['attributes'][$j]['option_id']);
                     $Qattributes->bindInt(':options_values_id', $order->products[$i]['attributes'][$j]['value_id']);
                     $Qattributes->bindInt(':popt_language_id', $osC_Session->value('languages_id'));
                     $Qattributes->bindInt(':poval_language_id', $osC_Session->value('languages_id'));
                 } else {
                     $Qattributes = $osC_Database->query('select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from :table_products_options popt, :table_products_options_values poval, :table_products_attributes pa where pa.products_id = :products_id and pa.options_id = :options_id and pa.options_id = popt.products_options_id and pa.options_values_id = :options_values_id and pa.options_values_id = poval.products_options_values_id and popt.language_id = :popt_language_id and poval.language_id = :poval_language_id');
                     $Qattributes->bindTable(':table_products_options', TABLE_PRODUCTS_OPTIONS);
                     $Qattributes->bindTable(':table_products_options_values', TABLE_PRODUCTS_OPTIONS_VALUES);
                     $Qattributes->bindTable(':table_products_attributes', TABLE_PRODUCTS_ATTRIBUTES);
                     $Qattributes->bindInt(':products_id', $order->products[$i]['id']);
                     $Qattributes->bindInt(':options_id', $order->products[$i]['attributes'][$j]['option_id']);
                     $Qattributes->bindInt(':options_values_id', $order->products[$i]['attributes'][$j]['value_id']);
                     $Qattributes->bindInt(':popt_language_id', $osC_Session->value('languages_id'));
                     $Qattributes->bindInt(':poval_language_id', $osC_Session->value('languages_id'));
                 }
                 $Qattributes->execute();
                 $Qopa = $osC_Database->query('insert into :table_orders_products_attributes (orders_id, orders_products_id, products_options, products_options_values, options_values_price, price_prefix) values (:orders_id, :orders_products_id, :products_options, :products_options_values, :options_values_price, :price_prefix)');
                 $Qopa->bindTable(':table_orders_products_attributes', TABLE_ORDERS_PRODUCTS_ATTRIBUTES);
                 $Qopa->bindInt(':orders_id', $insert_id);
                 $Qopa->bindInt(':orders_products_id', $order_products_id);
                 $Qopa->bindValue(':products_options', $attributes_values['products_options_name']);
                 $Qopa->bindValue(':products_options_values', $attributes_values['products_options_values_name']);
                 $Qopa->bindValue(':options_values_price', $attributes_values['options_values_price']);
                 $Qopa->bindValue(':price_prefix', $attributes_values['price_prefix']);
                 $Qopa->execute();
                 if (DOWNLOAD_ENABLED == 'true' && strlen($Qattributes->value('products_attributes_filename')) > 0) {
                     $Qopd = $osC_Database->query('insert into :table_orders_products_download (orders_id, orders_products_id, orders_products_filename, download_maxdays, download_count) values (:orders_id, :orders_products_id, :orders_products_filename, :download_maxdays, :download_count)');
                     $Qopd->bindTable(':table_orders_products_download', TABLE_ORDERS_PRODUCTS_DOWNLOAD);
                     $Qopd->bindInt(':orders_id', $insert_id);
                     $Qopd->bindInt(':orders_products_id', $order_products_id);
                     $Qopd->bindValue(':orders_products_filename', $Qattributes->value('products_attributes_filename'));
                     $Qopd->bindValue(':download_maxdays', $Qattributes->value('products_attributes_maxdays'));
                     $Qopd->bindValue(':download_count', $Qattributes->value('products_attributes_maxcount'));
                     $Qopd->execute();
                 }
                 $products_ordered_attributes .= "\n\t" . $Qattributes->value('products_options_name') . ' ' . $Qattributes->value('products_options_values_name');
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += tep_calculate_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'];
         $total_cost += $order->products[$i]['final_price'];
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $osC_Currencies->displayPrice($order->products[$i]['final_price'], $order->products[$i]['tax_class_id'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }
     // lets start with the email confirmation
     $email_order = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT, 'orders=' . $insert_id, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($order->info['comments']) {
         $email_order .= tep_output_string_protected($order->info['comments']) . "\n\n";
     }
     $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $products_ordered . EMAIL_SEPARATOR . "\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";
     }
     if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($osC_Customer->id, $osC_Session->value('sendto'), 0, '', "\n") . "\n";
     }
     $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . tep_address_label($osC_Customer->id, $osC_Session->value('billto'), 0, '', "\n") . "\n\n";
     $payment =& $osC_Session->value('payment');
     if (is_object(${$payment})) {
         $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" . EMAIL_SEPARATOR . "\n";
         $payment_class = ${$payment};
         $email_order .= $payment_class->title . "\n\n";
         if (isset($payment_class->email_footer)) {
             $email_order .= $payment_class->email_footer . "\n\n";
         }
     }
     tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     // send emails to other people
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
     // load the after_process function from the payment modules
     $payment_modules->after_process();
     $cart->reset(true);
     // unregister session variables used during checkout
     $osC_Session->remove('sendto');
     $osC_Session->remove('billto');
     $osC_Session->remove('shipping');
     $osC_Session->remove('payment');
     $osC_Session->remove('comments');
     tep_redirect(tep_href_link(FILENAME_CHECKOUT, 'success', 'SSL'));
 }
Beispiel #24
0
     $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
     $status = tep_db_prepare_input($HTTP_POST_VARS['status']);
     $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
     $order_updated = false;
     $check_status_query = tep_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int) $oID . "'");
     $check_status = tep_db_fetch_array($check_status_query);
     if ($check_status['orders_status'] != $status || tep_not_null($comments)) {
         tep_db_query("update " . TABLE_ORDERS . " set orders_status = '" . tep_db_input($status) . "', last_modified = now() where orders_id = '" . (int) $oID . "'");
         $customer_notified = '0';
         if (isset($HTTP_POST_VARS['notify']) && $HTTP_POST_VARS['notify'] == 'on') {
             $notify_comments = '';
             if (isset($HTTP_POST_VARS['notify_comments']) && $HTTP_POST_VARS['notify_comments'] == 'on') {
                 $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
             }
             $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
             tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $customer_notified = '1';
         }
         tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')");
         $order_updated = true;
     }
     if ($order_updated == true) {
         $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
     } else {
         $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
     }
     tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'deleteconfirm':
     $oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);
     tep_remove_order($oID, $HTTP_POST_VARS['restock']);
    $error = false;
    $name = tep_db_prepare_input($_POST['name']);
    $email_address = tep_db_prepare_input($_POST['email']);
    $enquiry = tep_db_prepare_input($_POST['enquiry']);
    if (!tep_validate_email($email_address)) {
        $error = true;
        $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }
    $actionRecorder = new actionRecorder('ar_contact_us', tep_session_is_registered('customer_id') ? $customer_id : null, $name);
    if (!$actionRecorder->canPerform()) {
        $error = true;
        $actionRecorder->record(false);
        $messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, defined('MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES') ? (int) MODULE_ACTION_RECORDER_CONTACT_US_EMAIL_MINUTES : 15));
    }
    if ($error == false) {
        tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);
        $actionRecorder->record();
        tep_redirect(tep_href_link('contact_us.php', 'action=success'));
    }
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link('contact_us.php'));
require 'includes/template_top.php';
?>

<div class="page-header">
  <h1><?php 
echo HEADING_TITLE;
?>
</h1>
</div>
Beispiel #26
0
    if (empty($to_name)) {
        $error = true;
        $messageStack->add('friend', ERROR_TO_NAME);
    }
    if (!tep_validate_email($to_email_address)) {
        $error = true;
        $messageStack->add('friend', ERROR_TO_ADDRESS);
    }
    if ($error == false) {
        $email_subject = sprintf(TEXT_EMAIL_SUBJECT, $from_name, STORE_NAME);
        $email_body = sprintf(TEXT_EMAIL_INTRO, $to_name, $from_name, $product_info['products_name'], STORE_NAME) . "\n\n";
        if (tep_not_null($message)) {
            $email_body .= $message . "\n\n";
        }
        $email_body .= sprintf(TEXT_EMAIL_LINK, tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL', false)) . "\n\n" . sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . HTTP_SERVER . DIR_WS_CATALOG . "\n");
        tep_mail($to_name, $to_email_address, $email_subject, $email_body, $from_name, $from_email_address);
        $messageStack->add_session('header', sprintf(TEXT_EMAIL_SUCCESSFUL_SENT, $product_info['products_name'], tep_output_string_protected($to_name)), 'success');
        tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
    }
} elseif (tep_session_is_registered('customer_id')) {
    $account_query = tep_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . (int) $customer_id . "'");
    $account = tep_db_fetch_array($account_query);
    $from_name = $account['customers_firstname'] . ' ' . $account['customers_lastname'];
    $from_email_address = $account['customers_email_address'];
}
$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $HTTP_GET_VARS['products_id']));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
echo HTML_PARAMS;
?>
Beispiel #27
0
             tep_setcookie("password", $login_password, time() + 60 * 60 * 24 * 100, HTTP_COOKIE_PATH, HTTP_COOKIE_DOMAIN);
         }
         $current_ip = get_client_ip();
         $mss_flag = false;
         if ($user_info['verification_status'] == 1 && $current_ip != $user_info['verification_ip']) {
             $mss_flag = true;
         }
         if ($mss_flag) {
             $verification_key = tep_create_random_value(10, 'digits');
             $signup_data_array['verification_key'] = $verification_key;
             db_perform(_TABLE_USERS, $signup_data_array, 'update', " user_id='" . $user_info['user_id'] . "' ");
             $email_info = get_email_template('VERIFYCATION_KEY');
             $msg_subject = $email_info['emailtemplate_subject'];
             $msg_content = str_replace(array('[firstname]', '[verification_key]'), array($user_info['firstname'], $verification_key), $email_info['emailtemplate_content']);
             $msg_content = html_entity_decode($msg_content);
             tep_mail($user_info['firstname'] . ' ' . $user_info['lastname'], $user_info['email'], $msg_subject, $msg_content, SITE_NAME, SITE_CONTACT_EMAIL);
         }
         if (sizeof($navigation->snapshot) > 0) {
             $origin_href = get_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
             $navigation->clear_snapshot();
             tep_redirect($origin_href, '', 'SSL');
         } else {
             tep_redirect(get_href_link(PAGE_LOGIN_CONFIRM, '', 'SSL'));
         }
     }
 } else {
     $validator->addError(ERROR_FIELD_LOGIN, ERROR_INVALID_ACCOUNT);
 }
 if (count($validator->errors) == 0) {
     // create new user
 } else {
        } else {
            $email .= sprintf(EMAIL_TEXT_CURCUST_INTRO, $mline);
        }
        $email .= EMAIL_TEXT_BODY_HEADER . $mline . EMAIL_TEXT_BODY_FOOTER;
        if (EMAIL_USE_HTML == 'true') {
            $email .= '<a HREF="' . tep_catalog_href_link('', '') . '">' . STORE_OWNER . "\n" . tep_catalog_href_link('', '') . '</a>';
        } else {
            $email .= STORE_OWNER . "\n" . tep_catalog_href_link('', '');
        }
        $email .= "\n\n" . $_POST['message'];
        $custname = $inrec['fname'] . " " . $inrec['lname'];
        $outEmailAddr = '"' . $custname . '" <' . $inrec['email'] . '>';
        if (tep_not_null(RCS_EMAIL_COPIES_TO)) {
            $outEmailAddr .= ', ' . RCS_EMAIL_COPIES_TO;
        }
        tep_mail('', $outEmailAddr, EMAIL_TEXT_SUBJECT, $email, '', EMAIL_FROM);
        $mline = "";
        // See if a record for this customer already exists; if not create one and if so update it
        $donequery = tep_db_query("select * from " . TABLE_SCART . " where customers_id = '" . $cid . "'");
        if (mysql_num_rows($donequery) == 0) {
            tep_db_query("insert into " . TABLE_SCART . " (customers_id, dateadded, datemodified ) values ('" . $cid . "', '" . seadate('0') . "', '" . seadate('0') . "')");
        } else {
            tep_db_query("update " . TABLE_SCART . " set datemodified = '" . seadate('0') . "' where customers_id = " . $cid);
        }
        echo $cline;
        $cline = "";
    }
    echo "<tr><td colspan=8 align='right' class='dataTableContent'><b>" . TABLE_CART_TOTAL . "</b>" . $currencies->format($tprice) . "</td> </tr>";
    //echo "<tr><td colspan=6 align='right'><a href=" . tep_href_link(FILENAME_RECOVER_CART_SALES, "action=delete&amp;customer_id=" . $cid . "&amp;tdate=" . $tdate . "&amp;sdate=" . $sdate) . ">" . tep_image_button('button_delete.gif', IMAGE_DELETE) . "</a></td>  </tr>\n";
    echo "<tr><td colspan=6 align=right><a href=" . $_SERVER['PHP_SELF'] . ">" . tep_image_button('button_back.gif', IMAGE_BACK) . "</a></td></tr>";
} else {
 /**
  * Cribbed (again) from osCommerce. Their design philosophy must be: Always
  * Repeat Yourself (At Least If You Want To Do Anything That's Not Baked In.) --
  * ARY(ATLIFYWTDATNBI)
  */
 public function sendOrderEmail($productsOrdered, $orderTotals)
 {
     include OSC_INCLUDES_PATH . 'includes/languages/english/checkout_process.php';
     $emailText = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $this->fields['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $this->fields['orders_id'], 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
     if ($this->fields['comments']) {
         $emailText .= tep_db_output($this->fields['comments']) . "\n\n";
     }
     $emailText .= EMAIL_TEXT_PRODUCTS . "\n" . EMAIL_SEPARATOR . "\n" . $productsOrdered . EMAIL_SEPARATOR . "\n";
     for ($i = 0, $n = sizeof($orderTotals); $i < $n; $i++) {
         $emailText .= strip_tags($orderTotals[$i]['title']) . ' ' . strip_tags($orderTotals[$i]['text']) . "\n";
     }
     extract($this->getShippingAddress());
     $emailText .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . "{$name}\n{$street_address}\n" . ($suburb ? $suburb . "\n" : "") . "{$city}, {$state} {$postcode}\n{$country}\n\n";
     extract($this->getShippingAddress());
     $emailText .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" . EMAIL_SEPARATOR . "\n" . "{$name}\n{$street_address}\n" . ($suburb ? $suburb . "\n" : "") . "{$city}, {$state} {$postcode}\n{$country}\n\n";
     //    print_r($this);
     //    die($emailText);
     tep_mail($this->fields['customers_firstname'] . ' ' . $this->fields['customers_lastname'], $this->fields['customers_email_address'], EMAIL_TEXT_SUBJECT, $emailText, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $emailText, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
     }
 }
                 fputcsvsafe($fp, $common_data, ',');
             }
             fclose($fp);
         }
     }
     if ($HTTP_GET_VARS['action'] == 'process_foreign_products') {
         $email_subject = sprintf(ENTRY_REQUEST_FORM_EMAIL_SUBJECT_FOREIGN_PRODUCTS, $advance_orders_id);
     } elseif ($HTTP_GET_VARS['action'] == 'process_foreign_books') {
         $email_subject = sprintf(ENTRY_REQUEST_FORM_EMAIL_SUBJECT_FOREIGN_BOOKS, $advance_orders_id);
     } else {
         $email_subject = ENTRY_REQUEST_FORM_EMAIL_SUBJECT;
     }
     if (tep_not_null($enquiry)) {
         tep_mail(STORE_NAME, STORE_OWNER_EMAIL_ADDRESS, $email_subject, $enquiry, $name, $email);
         if (($HTTP_GET_VARS['action'] == 'process_foreign_books' || $HTTP_GET_VARS['action'] == 'process_foreign_products') && defined('SEND_ADVANCE_ORDER_EMAILS_TO') && tep_not_null(SEND_ADVANCE_ORDER_EMAILS_TO)) {
             tep_mail('', SEND_ADVANCE_ORDER_EMAILS_TO, $email_subject, $enquiry, $name, $email);
         }
         $messageStack->add_session('header', ENTRY_REQUEST_FORM_SUCCESS, 'success');
         if ($HTTP_GET_VARS['action'] == 'process_foreign_books') {
             $foreign_cart->reset(true);
         }
         tep_redirect(str_replace('action=' . $HTTP_GET_VARS['action'], 'action=success', REQUEST_URI));
     } else {
         $error = true;
         $messageStack->add('header', ENTRY_REQUEST_FORM_ERROR);
     }
 } else {
     $error = true;
     $messageStack->add('header', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
 }
 break;