Skip to content

Commit

Permalink
Removed deprecate HTTP_XXX_VARS, precounting loops and foreach instea…
Browse files Browse the repository at this point in the history
…d of while for performance on payment modules
  • Loading branch information
acidvertigo committed Jan 2, 2012
1 parent 4dba6f1 commit 5039471
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 61 deletions.
76 changes: 36 additions & 40 deletions catalog/includes/modules/payment/paypal_pro_payflow_dp.php
Expand Up @@ -118,10 +118,9 @@ function selection() {


function pre_confirmation_check() { function pre_confirmation_check() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') { 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)) { 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($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']; $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)); tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));
} }
Expand All @@ -134,24 +133,23 @@ function confirmation() {
$confirmation = array(); $confirmation = array();


if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') { 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, $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, 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, 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, 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, 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, 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, $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 { } else {
global $order; global $order;
Expand Down Expand Up @@ -202,20 +200,19 @@ function confirmation() {


function process_button() { function process_button() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') { 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', $_POST['cc_owner_firstname']) .
$process_button_string = tep_draw_hidden_field('cc_owner_firstname', $HTTP_POST_VARS['cc_owner_firstname']) . tep_draw_hidden_field('cc_owner_lastname', $_POST['cc_owner_lastname']) .
tep_draw_hidden_field('cc_owner_lastname', $HTTP_POST_VARS['cc_owner_lastname']) . tep_draw_hidden_field('cc_type', $_POST['cc_type']) .
tep_draw_hidden_field('cc_type', $HTTP_POST_VARS['cc_type']) . tep_draw_hidden_field('cc_number_nh-dns', $_POST['cc_number_nh-dns']) .
tep_draw_hidden_field('cc_number_nh-dns', $HTTP_POST_VARS['cc_number_nh-dns']) . tep_draw_hidden_field('cc_starts_month', $_POST['cc_starts_month']) .
tep_draw_hidden_field('cc_starts_month', $HTTP_POST_VARS['cc_starts_month']) . tep_draw_hidden_field('cc_starts_year', $_POST['cc_starts_year']) .
tep_draw_hidden_field('cc_starts_year', $HTTP_POST_VARS['cc_starts_year']) . tep_draw_hidden_field('cc_expires_month', $_POST['cc_expires_month']) .
tep_draw_hidden_field('cc_expires_month', $HTTP_POST_VARS['cc_expires_month']) . tep_draw_hidden_field('cc_expires_year', $_POST['cc_expires_year']) .
tep_draw_hidden_field('cc_expires_year', $HTTP_POST_VARS['cc_expires_year']) . tep_draw_hidden_field('cc_cvc_nh-dns', $_POST['cc_cvc_nh-dns']);
tep_draw_hidden_field('cc_cvc_nh-dns', $HTTP_POST_VARS['cc_cvc_nh-dns']);

if (isset($_POST['cc_issue_nh-dns']) && !empty($_POST['cc_issue_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', $_POST['cc_issue_nh-dns']);
$process_button_string .= tep_draw_hidden_field('cc_issue_nh-dns', $HTTP_POST_VARS['cc_issue_nh-dns']);
} }


return $process_button_string; return $process_button_string;
Expand All @@ -225,16 +222,16 @@ function process_button() {
} }


function before_process() { 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') { if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_SERVER == 'Live') {
$api_url = 'https://payflowpro.verisign.com/transaction'; $api_url = 'https://payflowpro.verisign.com/transaction';
} else { } else {
$api_url = 'https://pilot-payflowpro.verisign.com/transaction'; $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), $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, 'VENDOR' => MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_VENDOR,
Expand All @@ -244,24 +241,24 @@ function before_process() {
'TRXTYPE' => ((MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_METHOD == 'Sale') ? 'S' : 'A'), 'TRXTYPE' => ((MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_TRANSACTION_METHOD == 'Sale') ? 'S' : 'A'),
'AMT' => $this->format_raw($order->info['total']), 'AMT' => $this->format_raw($order->info['total']),
'CURRENCY' => $order->info['currency'], 'CURRENCY' => $order->info['currency'],
'FIRSTNAME' => $HTTP_POST_VARS['cc_owner_firstname'], 'FIRSTNAME' => $_POST['cc_owner_firstname'],
'LASTNAME' => $HTTP_POST_VARS['cc_owner_lastname'], 'LASTNAME' => $_POST['cc_owner_lastname'],
'STREET' => $order->billing['street_address'], 'STREET' => $order->billing['street_address'],
'CITY' => $order->billing['city'], 'CITY' => $order->billing['city'],
'STATE' => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']), 'STATE' => tep_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['state']),
'COUNTRY' => $order->billing['country']['iso_code_2'], 'COUNTRY' => $order->billing['country']['iso_code_2'],
'ZIP' => $order->billing['postcode'], 'ZIP' => $order->billing['postcode'],
'CLIENTIP' => tep_get_ip_address(), 'CLIENTIP' => tep_get_ip_address(),
'EMAIL' => $order->customer['email_address'], 'EMAIL' => $order->customer['email_address'],
'ACCT' => $HTTP_POST_VARS['cc_number_nh-dns'], 'ACCT' => $_POST['cc_number_nh-dns'],
'ACCTTYPE' => $HTTP_POST_VARS['cc_type'], 'ACCTTYPE' => $_POST['cc_type'],
'CARDSTART' => $HTTP_POST_VARS['cc_starts_month'] . $HTTP_POST_VARS['cc_starts_year'], 'CARDSTART' => $_POST['cc_starts_month'] . $_POST['cc_starts_year'],
'EXPDATE' => $HTTP_POST_VARS['cc_expires_month'] . $HTTP_POST_VARS['cc_expires_year'], 'EXPDATE' => $_POST['cc_expires_month'] . $_POST['cc_expires_year'],
'CVV2' => $HTTP_POST_VARS['cc_cvc_nh-dns'], 'CVV2' => $_POST['cc_cvc_nh-dns'],
'BUTTONSOURCE' => 'osCommerce22_Default_PRO2DP'); 'BUTTONSOURCE' => 'osCommerce22_Default_PRO2DP');


if ( ($HTTP_POST_VARS['cc_type'] == '9') || ($HTTP_POST_VARS['cc_type'] == 'S') ) { if ( ($_POST['cc_type'] == '9') || ($_POST['cc_type'] == 'S') ) {
$params['CARDISSUE'] = $HTTP_POST_VARS['cc_issue_nh-dns']; $params['CARDISSUE'] = $_POST['cc_issue_nh-dns'];
} }


if (is_numeric($sendto) && ($sendto > 0)) { if (is_numeric($sendto) && ($sendto > 0)) {
Expand Down Expand Up @@ -324,9 +321,8 @@ function after_process() {


function get_error() { function get_error() {
if (MODULE_PAYMENT_PAYPAL_PRO_PAYFLOW_DP_CARD_INPUT_PAGE == 'Payment') { 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; return $error;
} }
Expand Down
6 changes: 3 additions & 3 deletions catalog/includes/modules/payment/paypal_pro_payflow_ec.php
Expand Up @@ -107,11 +107,11 @@ function process_button() {
} }


function before_process() { 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 (empty($comments)) {
if (isset($HTTP_POST_VARS['ppecomments']) && tep_not_null($HTTP_POST_VARS['ppecomments'])) { if (isset($_POST['ppecomments']) && tep_not_null($_POST['ppecomments'])) {
$comments = tep_db_prepare_input($HTTP_POST_VARS['ppecomments']); $comments = tep_db_prepare_input($_POST['ppecomments']);


$order->info['comments'] = $comments; $order->info['comments'] = $comments;
} }
Expand Down
21 changes: 14 additions & 7 deletions catalog/includes/modules/payment/paypal_standard.php
Expand Up @@ -139,7 +139,8 @@ function confirmation() {
while (list(, $value) = each($order_total_modules->modules)) { while (list(, $value) = each($order_total_modules->modules)) {
$class = substr($value, 0, strrpos($value, '.')); $class = substr($value, 0, strrpos($value, '.'));
if ($GLOBALS[$class]->enabled) { 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'])) { if (tep_not_null($GLOBALS[$class]->output[$i]['title']) && tep_not_null($GLOBALS[$class]->output[$i]['text'])) {
$order_totals[] = array('code' => $GLOBALS[$class]->code, $order_totals[] = array('code' => $GLOBALS[$class]->code,
'title' => $GLOBALS[$class]->output[$i]['title'], 'title' => $GLOBALS[$class]->output[$i]['title'],
Expand Down Expand Up @@ -196,7 +197,8 @@ function confirmation() {


$insert_id = tep_db_insert_id(); $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, $sql_data_array = array('orders_id' => $insert_id,
'title' => $order_totals[$i]['title'], 'title' => $order_totals[$i]['title'],
'text' => $order_totals[$i]['text'], 'text' => $order_totals[$i]['text'],
Expand All @@ -207,7 +209,8 @@ function confirmation() {
tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array); 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, $sql_data_array = array('orders_id' => $insert_id,
'products_id' => tep_get_prid($order->products[$i]['id']), 'products_id' => tep_get_prid($order->products[$i]['id']),
'products_model' => $order->products[$i]['model'], 'products_model' => $order->products[$i]['model'],
Expand All @@ -224,7 +227,8 @@ function confirmation() {
$attributes_exist = '0'; $attributes_exist = '0';
if (isset($order->products[$i]['attributes'])) { if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1'; $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') { 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 $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 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
Expand Down Expand Up @@ -424,7 +428,8 @@ function before_process() {
$subtotal = 0; $subtotal = 0;
$total_tax = 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 // Stock Update - Joao Correia
if (STOCK_LIMITED == 'true') { if (STOCK_LIMITED == 'true') {
if (DOWNLOAD_ENABLED == 'true') { if (DOWNLOAD_ENABLED == 'true') {
Expand Down Expand Up @@ -468,7 +473,8 @@ function before_process() {
$products_ordered_attributes = ''; $products_ordered_attributes = '';
if (isset($order->products[$i]['attributes'])) { if (isset($order->products[$i]['attributes'])) {
$attributes_exist = '1'; $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') { 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 $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 from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
Expand Down Expand Up @@ -512,7 +518,8 @@ function before_process() {
$products_ordered . $products_ordered .
EMAIL_SEPARATOR . "\n"; 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"; $email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";
} }


Expand Down
17 changes: 8 additions & 9 deletions catalog/includes/modules/payment/paypoint_secpay.php
Expand Up @@ -145,17 +145,16 @@ function process_button() {
} }


function before_process() { 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; $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)) { if ($_GET['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)); 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 { } 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));
} }
} }


Expand All @@ -164,11 +163,11 @@ function after_process() {
} }


function get_error() { 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; $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; $error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE_C;
} else { } else {
$error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE; $error = MODULE_PAYMENT_PAYPOINT_SECPAY_TEXT_ERROR_MESSAGE;
Expand Down
3 changes: 2 additions & 1 deletion catalog/includes/modules/payment/pm2checkout.php
Expand Up @@ -100,7 +100,8 @@ function process_button() {
tep_draw_hidden_field('ship_zip', $order->delivery['postcode']) . tep_draw_hidden_field('ship_zip', $order->delivery['postcode']) .
tep_draw_hidden_field('ship_country', $order->delivery['country']['title']); 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']) . $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_name_' . ($i+1), $order->products[$i]['name']) .
tep_draw_hidden_field('c_description_' . ($i+1), $order->products[$i]['name']) . tep_draw_hidden_field('c_description_' . ($i+1), $order->products[$i]['name']) .
Expand Down

0 comments on commit 5039471

Please sign in to comment.