Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removed deprecate HTTP_XXX_VARS, precounting loops and foreach instea…

…d of while for performance on payment modules
  • Loading branch information...
commit 50394715bc22b0f36834d97499cd9c8165746c98 1 parent 4dba6f1
@acidvertigo acidvertigo authored
View
76 catalog/includes/modules/payment/paypal_pro_payflow_dp.php
@@ -118,10 +118,9 @@ function selection() {
function pre_confirmation_check() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') {
- global $HTTP_POST_VARS;
- if (!isset($HTTP_POST_VARS['cc_owner_firstname']) || empty($HTTP_POST_VARS['cc_owner_firstname']) || !isset($HTTP_POST_VARS['cc_owner_lastname']) || empty($HTTP_POST_VARS['cc_owner_lastname']) || (strlen($HTTP_POST_VARS['cc_owner_firstname'] . ' ' . $HTTP_POST_VARS['cc_owner_lastname']) < CC_OWNER_MIN_LENGTH) || !isset($HTTP_POST_VARS['cc_type']) || !isset($this->cc_types[$HTTP_POST_VARS['cc_type']]) || !isset($HTTP_POST_VARS['cc_number_nh-dns']) || empty($HTTP_POST_VARS['cc_number_nh-dns']) || (strlen($HTTP_POST_VARS['cc_number_nh-dns']) < CC_NUMBER_MIN_LENGTH)) {
- $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_ERROR_ALL_FIELDS_REQUIRED) . '&cc_owner_firstname=' . urlencode($HTTP_POST_VARS['cc_owner_firstname']) . '&cc_owner_lastname=' . urlencode($HTTP_POST_VARS['cc_owner_lastname']) . '&cc_starts_month=' . $HTTP_POST_VARS['cc_starts_month'] . '&cc_starts_year=' . $HTTP_POST_VARS['cc_starts_year'] . '&cc_expires_month=' . $HTTP_POST_VARS['cc_expires_month'] . '&cc_expires_year=' . $HTTP_POST_VARS['cc_expires_year'];
+ if (!isset($_POST['cc_owner_firstname']) || empty($_POST['cc_owner_firstname']) || !isset($_POST['cc_owner_lastname']) || empty($_POST['cc_owner_lastname']) || (strlen($_POST['cc_owner_firstname'] . ' ' . $_POST['cc_owner_lastname']) < CC_OWNER_MIN_LENGTH) || !isset($_POST['cc_type']) || !isset($this->cc_types[$_POST['cc_type']]) || !isset($_POST['cc_number_nh-dns']) || empty($_POST['cc_number_nh-dns']) || (strlen($_POST['cc_number_nh-dns']) < CC_NUMBER_MIN_LENGTH)) {
+ $payment_error_return = 'payment_error=' . $this->code . '&error=' . urlencode(MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_ERROR_ALL_FIELDS_REQUIRED) . '&cc_owner_firstname=' . urlencode($_POST['cc_owner_firstname']) . '&cc_owner_lastname=' . urlencode($_POST['cc_owner_lastname']) . '&cc_starts_month=' . $_POST['cc_starts_month'] . '&cc_starts_year=' . $_POST['cc_starts_year'] . '&cc_expires_month=' . $_POST['cc_expires_month'] . '&cc_expires_year=' . $_POST['cc_expires_year'];
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
}
@@ -134,24 +133,23 @@ function confirmation() {
$confirmation = array();
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') {
- global $HTTP_POST_VARS;
$confirmation['fields'] = array(array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_OWNER,
- 'field' => $HTTP_POST_VARS['cc_owner_firstname'] . ' ' . $HTTP_POST_VARS['cc_owner_lastname']),
+ 'field' => $_POST['cc_owner_firstname'] . ' ' . $_POST['cc_owner_lastname']),
array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_TYPE,
- 'field' => $this->cc_types[$HTTP_POST_VARS['cc_type']]),
+ 'field' => $this->cc_types[$_POST['cc_type']]),
array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_NUMBER,
- 'field' => str_repeat('X', strlen($HTTP_POST_VARS['cc_number_nh-dns']) - 4) . substr($HTTP_POST_VARS['cc_number_nh-dns'], -4)),
+ 'field' => str_repeat('X', strlen($_POST['cc_number_nh-dns']) - 4) . substr($_POST['cc_number_nh-dns'], -4)),
array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_VALID_FROM,
- 'field' => $HTTP_POST_VARS['cc_starts_month'] . '/' . $HTTP_POST_VARS['cc_starts_year']),
+ 'field' => $_POST['cc_starts_month'] . '/' . $_POST['cc_starts_year']),
array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_EXPIRES,
- 'field' => $HTTP_POST_VARS['cc_expires_month'] . '/' . $HTTP_POST_VARS['cc_expires_year']),
+ 'field' => $_POST['cc_expires_month'] . '/' . $_POST['cc_expires_year']),
array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_CVC,
- 'field' => $HTTP_POST_VARS['cc_cvc_nh-dns']));
+ 'field' => $_POST['cc_cvc_nh-dns']));
- if (isset($HTTP_POST_VARS['cc_issue_nh-dns']) && !empty($HTTP_POST_VARS['cc_issue_nh-dns'])) {
+ if (isset($_POST['cc_issue_nh-dns']) && !empty($_POST['cc_issue_nh-dns'])) {
$confirmation['fields'][] = array('title' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_ISSUE_NUMBER,
- 'field' => $HTTP_POST_VARS['cc_issue_nh-dns']);
+ 'field' => $_POST['cc_issue_nh-dns']);
}
} else {
global $order;
@@ -202,20 +200,19 @@ function confirmation() {
function process_button() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') {
- global $HTTP_POST_VARS;
-
- $process_button_string = tep_draw_hidden_field('cc_owner_firstname', $HTTP_POST_VARS['cc_owner_firstname']) .
- tep_draw_hidden_field('cc_owner_lastname', $HTTP_POST_VARS['cc_owner_lastname']) .
- tep_draw_hidden_field('cc_type', $HTTP_POST_VARS['cc_type']) .
- tep_draw_hidden_field('cc_number_nh-dns', $HTTP_POST_VARS['cc_number_nh-dns']) .
- tep_draw_hidden_field('cc_starts_month', $HTTP_POST_VARS['cc_starts_month']) .
- tep_draw_hidden_field('cc_starts_year', $HTTP_POST_VARS['cc_starts_year']) .
- tep_draw_hidden_field('cc_expires_month', $HTTP_POST_VARS['cc_expires_month']) .
- tep_draw_hidden_field('cc_expires_year', $HTTP_POST_VARS['cc_expires_year']) .
- tep_draw_hidden_field('cc_cvc_nh-dns', $HTTP_POST_VARS['cc_cvc_nh-dns']);
-
- if (isset($HTTP_POST_VARS['cc_issue_nh-dns']) && !empty($HTTP_POST_VARS['cc_issue_nh-dns'])) {
- $process_button_string .= tep_draw_hidden_field('cc_issue_nh-dns', $HTTP_POST_VARS['cc_issue_nh-dns']);
+
+ $process_button_string = tep_draw_hidden_field('cc_owner_firstname', $_POST['cc_owner_firstname']) .
+ tep_draw_hidden_field('cc_owner_lastname', $_POST['cc_owner_lastname']) .
+ tep_draw_hidden_field('cc_type', $_POST['cc_type']) .
+ tep_draw_hidden_field('cc_number_nh-dns', $_POST['cc_number_nh-dns']) .
+ tep_draw_hidden_field('cc_starts_month', $_POST['cc_starts_month']) .
+ tep_draw_hidden_field('cc_starts_year', $_POST['cc_starts_year']) .
+ tep_draw_hidden_field('cc_expires_month', $_POST['cc_expires_month']) .
+ tep_draw_hidden_field('cc_expires_year', $_POST['cc_expires_year']) .
+ tep_draw_hidden_field('cc_cvc_nh-dns', $_POST['cc_cvc_nh-dns']);
+
+ if (isset($_POST['cc_issue_nh-dns']) && !empty($_POST['cc_issue_nh-dns'])) {
+ $process_button_string .= tep_draw_hidden_field('cc_issue_nh-dns', $_POST['cc_issue_nh-dns']);
}
return $process_button_string;
@@ -225,16 +222,16 @@ function process_button() {
}
function before_process() {
- global $HTTP_POST_VARS, $order, $sendto;
+ global $order, $sendto;
- if (isset($HTTP_POST_VARS['cc_owner_firstname']) && !empty($HTTP_POST_VARS['cc_owner_firstname']) && isset($HTTP_POST_VARS['cc_owner_lastname']) && !empty($HTTP_POST_VARS['cc_owner_lastname']) && isset($HTTP_POST_VARS['cc_type']) && isset($this->cc_types[$HTTP_POST_VARS['cc_type']]) && isset($HTTP_POST_VARS['cc_number_nh-dns']) && !empty($HTTP_POST_VARS['cc_number_nh-dns'])) {
+ if (isset($_POST['cc_owner_firstname']) && !empty($_POST['cc_owner_firstname']) && isset($_POST['cc_owner_lastname']) && !empty($_POST['cc_owner_lastname']) && isset($_POST['cc_type']) && isset($this->cc_types[$_POST['cc_type']]) && isset($_POST['cc_number_nh-dns']) && !empty($_POST['cc_number_nh-dns'])) {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_SERVER == 'Live') {
$api_url = 'https://payflowpro.verisign.com/transaction';
} else {
$api_url = 'https://pilot-payflowpro.verisign.com/transaction';
}
- $name = explode(' ', $HTTP_POST_VARS['cc_owner'], 2);
+ $name = explode(' ', $_POST['cc_owner'], 2);
$params = array('USER' => (tep_not_null(MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_USERNAME) ? MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_USERNAME : MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_VENDOR),
'VENDOR' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_VENDOR,
@@ -244,8 +241,8 @@ function before_process() {
'TRXTYPE' => ((MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_METHOD == 'Sale') ? 'S' : 'A'),
'AMT' => $this->format_raw($order->info['total']),
'CURRENCY' => $order->info['currency'],
- 'FIRSTNAME' => $HTTP_POST_VARS['cc_owner_firstname'],
- 'LASTNAME' => $HTTP_POST_VARS['cc_owner_lastname'],
+ 'FIRSTNAME' => $_POST['cc_owner_firstname'],
+ 'LASTNAME' => $_POST['cc_owner_lastname'],
'STREET' => $order->billing['street_address'],
'CITY' => $order->billing['city'],
'STATE' => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']),
@@ -253,15 +250,15 @@ function before_process() {
'ZIP' => $order->billing['postcode'],
'CLIENTIP' => tep_get_ip_address(),
'EMAIL' => $order->customer['email_address'],
- 'ACCT' => $HTTP_POST_VARS['cc_number_nh-dns'],
- 'ACCTTYPE' => $HTTP_POST_VARS['cc_type'],
- 'CARDSTART' => $HTTP_POST_VARS['cc_starts_month'] . $HTTP_POST_VARS['cc_starts_year'],
- 'EXPDATE' => $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year'],
- 'CVV2' => $HTTP_POST_VARS['cc_cvc_nh-dns'],
+ 'ACCT' => $_POST['cc_number_nh-dns'],
+ 'ACCTTYPE' => $_POST['cc_type'],
+ 'CARDSTART' => $_POST['cc_starts_month'] . $_POST['cc_starts_year'],
+ 'EXPDATE' => $_POST['cc_expires_month'] . $_POST['cc_expires_year'],
+ 'CVV2' => $_POST['cc_cvc_nh-dns'],
'BUTTONSOURCE' => 'osCommerce22_Default_PRO2DP');
- if ( ($HTTP_POST_VARS['cc_type'] == '9') || ($HTTP_POST_VARS['cc_type'] == 'S') ) {
- $params['CARDISSUE'] = $HTTP_POST_VARS['cc_issue_nh-dns'];
+ if ( ($_POST['cc_type'] == '9') || ($_POST['cc_type'] == 'S') ) {
+ $params['CARDISSUE'] = $_POST['cc_issue_nh-dns'];
}
if (is_numeric($sendto) && ($sendto > 0)) {
@@ -324,9 +321,8 @@ function after_process() {
function get_error() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') {
- global $HTTP_GET_VARS;
- $error = array('error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));
+ $error = array('error' => stripslashes(urldecode($_GET['error'])));
return $error;
}
View
6 catalog/includes/modules/payment/paypal_pro_payflow_ec.php
@@ -107,11 +107,11 @@ function process_button() {
}
function before_process() {
- global $order, $sendto, $ppeuk_token, $ppeuk_payerid, $HTTP_POST_VARS, $comments;
+ global $order, $sendto, $ppeuk_token, $ppeuk_payerid, $comments;
if (empty($comments)) {
- if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) {
- $comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']);
+ if (isset($_POST['ppecomments']) && tep_not_null($_POST['ppecomments'])) {
+ $comments = tep_db_prepare_input($_POST['ppecomments']);
$order->info['comments'] = $comments;
}
View
21 catalog/includes/modules/payment/paypal_standard.php
@@ -139,7 +139,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'],
@@ -196,7 +197,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'],
@@ -207,7 +209,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'],
@@ -224,7 +227,8 @@ function confirmation() {
$attributes_exist = '0';
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
@@ -424,7 +428,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') {
@@ -468,7 +473,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
@@ -512,7 +518,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";
}
View
17 catalog/includes/modules/payment/paypoint_secpay.php
@@ -145,17 +145,16 @@ function process_button() {
}
function before_process() {
- global $HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_SERVER_VARS;
- if ( ($HTTP_GET_VARS['valid'] == 'true') && ($HTTP_GET_VARS['code'] == 'A') && !empty($HTTP_GET_VARS['auth_code']) && empty($HTTP_GET_VARS['resp_code']) && !empty($HTTP_GET_VARS[tep_session_name()]) ) {
+ if ( ($_GET['valid'] == 'true') && ($_GET['code'] == 'A') && !empty($_GET['auth_code']) && empty($_GET['resp_code']) && !empty($_GET[tep_session_name()]) ) {
$DIGEST_PASSWORD = MODULE_PAYMENT_PAYPOINT_SECPAY_READERS_DIGEST;
- list($REQUEST_URI, $CHECK_SUM) = split('hash=', $HTTP_SERVER_VARS['REQUEST_URI']);
+ list($REQUEST_URI, $CHECK_SUM) = split('hash=', $_SERVER['REQUEST_URI']);
- if ($HTTP_GET_VARS['hash'] != md5($REQUEST_URI . $DIGEST_PASSWORD)) {
- tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_GET_VARS[tep_session_name()] . '&payment_error=' . $this->code ."&detail=hash", 'SSL', false, false));
+ if ($_GET['hash'] != md5($REQUEST_URI . $DIGEST_PASSWORD)) {
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $_GET[tep_session_name()] . '&payment_error=' . $this->code ."&detail=hash", 'SSL', false, false));
}
} else {
- tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $HTTP_GET_VARS[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
+ tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, tep_session_name() . '=' . $_GET[tep_session_name()] . '&payment_error=' . $this->code, 'SSL', false, false));
}
}
@@ -164,11 +163,11 @@ function after_process() {
}
function get_error() {
- global $HTTP_GET_VARS;
+ global $_GET;
- if ($HTTP_GET_VARS['code'] == 'N') {
+ if ($_GET['code'] == 'N') {
$error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE_N;
- } elseif ($HTTP_GET_VARS['code'] == 'C') {
+ } elseif ($_GET['code'] == 'C') {
$error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE_C;
} else {
$error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE;
View
3  catalog/includes/modules/payment/pm2checkout.php
@@ -100,7 +100,8 @@ function process_button() {
tep_draw_hidden_field('ship_zip', $order->delivery['postcode']) .
tep_draw_hidden_field('ship_country', $order->delivery['country']['title']);
- for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
+ $n=sizeof($order->products);
+ for ($i=0; $i<$n; $i++) {
$process_button_string .= tep_draw_hidden_field('c_prod_' . ($i+1), (int)$order->products[$i]['id'] . ',' . (int)$order->products[$i]['qty']) .
tep_draw_hidden_field('c_name_' . ($i+1), $order->products[$i]['name']) .
tep_draw_hidden_field('c_description_' . ($i+1), $order->products[$i]['name']) .
View
3  catalog/includes/modules/payment/rbsworldpay_hosted.php
@@ -226,7 +226,8 @@ function confirmation() {
$attributes_exist = '0';
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
Please sign in to comment.
Something went wrong with that request. Please try again.