Browse files

Removed deprecated code and iproved performance with precount. Needs …

…testing on payment platform
  • Loading branch information...
1 parent c9da0bd commit d3908ff3598bf260d9659d936b87ea64ad21bd86 @acidvertigo acidvertigo committed Aug 16, 2011
View
10 catalog/includes/modules/payment/pm2checkout.php
@@ -78,7 +78,7 @@ function confirmation() {
}
function process_button() {
- global $HTTP_POST_VARS, $customer_id, $currencies, $currency, $order, $languages_id, $cartID;
+ global $customer_id, $currencies, $currency, $order, $languages_id, $cartID;
$process_button_string = tep_draw_hidden_field('sid', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('total', $this->format_raw($order->info['total'], MODULE_PAYMENT_2CHECKOUT_CURRENCY)) .
@@ -132,15 +132,15 @@ function process_button() {
}
function before_process() {
- global $HTTP_POST_VARS;
+ global $_POST;
- if ( ($HTTP_POST_VARS['credit_card_processed'] != 'Y') && ($HTTP_POST_VARS['credit_card_processed'] != 'K') ){
+ if ( ($_POST['credit_card_processed'] != 'Y') && ($_POST['credit_card_processed'] != 'K') ){
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code, 'SSL', true, false));
}
}
function after_process() {
- global $HTTP_POST_VARS, $order, $insert_id;
+ global $_POST, $order, $insert_id;
if (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') {
$sql_data_array = array('orders_id' => (int)$insert_id,
@@ -154,7 +154,7 @@ function after_process() {
// The KEY value returned from the gateway is intentionally broken for Test transactions so it is only checked in Production mode
if (tep_not_null(MODULE_PAYMENT_2CHECKOUT_SECRET_WORD) && (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Production')) {
- if (strtoupper(md5(MODULE_PAYMENT_2CHECKOUT_SECRET_WORD . MODULE_PAYMENT_2CHECKOUT_LOGIN . $HTTP_POST_VARS['order_number'] . $this->order_format($order->info['total'], MODULE_PAYMENT_2CHECKOUT_CURRENCY))) != strtoupper($HTTP_POST_VARS['key'])) {
+ if (strtoupper(md5(MODULE_PAYMENT_2CHECKOUT_SECRET_WORD . MODULE_PAYMENT_2CHECKOUT_LOGIN . $_POST['order_number'] . $this->order_format($order->info['total'], MODULE_PAYMENT_2CHECKOUT_CURRENCY))) != strtoupper($_POST['key'])) {
$sql_data_array = array('orders_id' => (int)$insert_id,
'orders_status_id' => (int)$order->info['order_status'],
'date_added' => 'now()',
View
30 catalog/includes/modules/payment/psigate.php
@@ -101,13 +101,12 @@ function selection() {
}
function pre_confirmation_check() {
- global $HTTP_POST_VARS;
-
+
if (MODULE_PAYMENT_PSIGATE_INPUT_MODE == 'Local') {
include(DIR_WS_CLASSES . 'cc_validation.php');
$cc_validation = new cc_validation();
- $result = $cc_validation->validate($HTTP_POST_VARS['psigate_cc_number'], $HTTP_POST_VARS['psigate_cc_expires_month'], $HTTP_POST_VARS['psigate_cc_expires_year']);
+ $result = $cc_validation->validate($_POST['psigate_cc_number'], $_POST['psigate_cc_expires_month'], $_POST['psigate_cc_expires_year']);
$error = '';
switch ($result) {
@@ -125,7 +124,7 @@ function pre_confirmation_check() {
}
if ( ($result == false) || ($result < 1) ) {
- $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&psigate_cc_owner=' . urlencode($HTTP_POST_VARS['psigate_cc_owner']) . '&psigate_cc_expires_month=' . $HTTP_POST_VARS['psigate_cc_expires_month'] . '&psigate_cc_expires_year=' . $HTTP_POST_VARS['psigate_cc_expires_year'];
+ $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode($error) . '&psigate_cc_owner=' . urlencode($_POST['psigate_cc_owner']) . '&psigate_cc_expires_month=' . $_POST['psigate_cc_expires_month'] . '&psigate_cc_expires_year=' . $_POST['psigate_cc_expires_year'];
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
}
@@ -140,7 +139,7 @@ function pre_confirmation_check() {
}
function confirmation() {
- global $HTTP_POST_VARS, $order;
+ global $order;
if (MODULE_PAYMENT_PSIGATE_INPUT_MODE == 'Local') {
$confirmation = array('title' => $this->title . ': ' . $this->cc_card_type,
@@ -149,7 +148,7 @@ function confirmation() {
array('title' => MODULE_PAYMENT_PSIGATE_TEXT_CREDIT_CARD_NUMBER,
'field' => substr($this->cc_card_number, 0, 4) . str_repeat('X', (strlen($this->cc_card_number) - 8)) . substr($this->cc_card_number, -4)),
array('title' => MODULE_PAYMENT_PSIGATE_TEXT_CREDIT_CARD_EXPIRES,
- 'field' => strftime('%B, %Y', mktime(0,0,0,$HTTP_POST_VARS['psigate_cc_expires_month'], 1, '20' . $HTTP_POST_VARS['psigate_cc_expires_year'])))));
+ 'field' => strftime('%B, %Y', mktime(0,0,0,$_POST['psigate_cc_expires_month'], 1, '20' . $_POST['psigate_cc_expires_year'])))));
return $confirmation;
} else {
@@ -158,7 +157,7 @@ function confirmation() {
}
function process_button() {
- global $HTTP_SERVER_VARS, $order, $currencies;
+ global $order, $currencies;
switch (MODULE_PAYMENT_PSIGATE_TRANSACTION_MODE) {
case 'Always Good':
@@ -218,7 +217,7 @@ function process_button() {
tep_draw_hidden_field('Scountry', $order->delivery['country']['iso_code_2']) .
tep_draw_hidden_field('ChargeType', $transaction_type) .
tep_draw_hidden_field('Result', $transaction_mode) .
- tep_draw_hidden_field('IP', $HTTP_SERVER_VARS['REMOTE_ADDR']);
+ tep_draw_hidden_field('IP', $_SERVER['REMOTE_ADDR']);
if (MODULE_PAYMENT_PSIGATE_INPUT_MODE == 'Local') {
$process_button_string .= tep_draw_hidden_field('CardNumber', $this->cc_card_number) .
@@ -238,14 +237,13 @@ function after_process() {
}
function get_error() {
- global $HTTP_GET_VARS;
-
- if (isset($HTTP_GET_VARS['ErrMsg']) && tep_not_null($HTTP_GET_VARS['ErrMsg'])) {
- $error = stripslashes(urldecode($HTTP_GET_VARS['ErrMsg']));
- } elseif (isset($HTTP_GET_VARS['Err']) && tep_not_null($HTTP_GET_VARS['Err'])) {
- $error = stripslashes(urldecode($HTTP_GET_VARS['Err']));
- } elseif (isset($HTTP_GET_VARS['error']) && tep_not_null($HTTP_GET_VARS['error'])) {
- $error = stripslashes(urldecode($HTTP_GET_VARS['error']));
+
+ if (isset($_GET['ErrMsg']) && tep_not_null($_GET['ErrMsg'])) {
+ $error = stripslashes($_GET['ErrMsg']);
+ } elseif (isset($_GET['Err']) && tep_not_null($_GET['Err'])) {
+ $error = stripslashes($_GET['Err']);
+ } elseif (isset($_GET['error']) && tep_not_null($_GET['error'])) {
+ $error = stripslashes($_GET['error']);
} else {
$error = MODULE_PAYMENT_PSIGATE_TEXT_ERROR_MESSAGE;
}
View
23 catalog/includes/modules/payment/rbsworldpay_hosted.php
@@ -138,7 +138,8 @@ function confirmation() {
while (list(, $value) = each($order_total_modules->modules)) {
$class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) {
- for ($i=0, $n=sizeof($GLOBALS[$class]->output); $i<$n; $i++) {
+ $n=sizeof($GLOBALS[$class]->output);
+ for ($i=0; $i<$n; $i++) {
if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
$order_totals[] = array('code' => $GLOBALS[$class]->code,
'title' => $GLOBALS[$class]->output[$i]['title'],
@@ -195,7 +196,8 @@ function confirmation() {
$insert_id = tep_db_insert_id();
- for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
+ $n=sizeof($order_totals);
+ for ($i=0; $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
'title' => $order_totals[$i]['title'],
'text' => $order_totals[$i]['text'],
@@ -206,7 +208,8 @@ function confirmation() {
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
}
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
+ $n=sizeof($order->products);
+ for ($i=0; $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'],
@@ -326,7 +329,7 @@ function before_process() {
if ($check['orders_status'] == MODULE_PAYMENT_RBSWORLDPAY_HOSTED_PREPARE_ORDER_STATUS_ID) {
$hash_result = false;
- if (isset($HTTP_GET_VARS['hash']) && !empty($HTTP_GET_VARS['hash']) && ($HTTP_GET_VARS['hash'] == md5(tep_session_name() . $customer_id . $order_id . $language . number_format($order->info['total'], 2) . MODULE_PAYMENT_RBSWORLDPAY_HOSTED_MD5_PASSWORD))) {
+ if (isset($_GET['hash']) && !empty($_GET['hash']) && ($_GET['hash'] == md5(tep_session_name() . $customer_id . $order_id . $language . number_format($order->info['total'], 2) . MODULE_PAYMENT_RBSWORLDPAY_HOSTED_MD5_PASSWORD))) {
$hash_result = true;
}
@@ -365,7 +368,8 @@ function before_process() {
$subtotal = 0;
$total_tax = 0;
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
+ $n=sizeof($order->products);
+ for ($i=0; $i<$n; $i++) {
// Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') {
@@ -409,7 +413,8 @@ function before_process() {
$products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1';
- for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
+ $n2=sizeof($order->products[$i]['attributes']);
+ for ($j=0; $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
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
@@ -453,7 +458,8 @@ function before_process() {
$products_ordered .
EMAIL_SEPARATOR . "\n";
- for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
+ $n=sizeof($order_totals);
+ for ($i=0; $i<$n; $i++) {
$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
}
@@ -528,7 +534,8 @@ function install() {
$languages = tep_get_languages();
- for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
+ $n=sizeof($languages);
+ for ($i=0; $i<$n; $i++) {
tep_db_query("insert into " . TABLE_ORDERS_STATUS . " (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $languages[$i]['id'] . "', 'Preparing [WorldPay]')");
}

0 comments on commit d3908ff

Please sign in to comment.