Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Commit

Permalink
Old order fix restored. Fixing code formating.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Weiler committed Feb 5, 2018
1 parent 9eefdae commit 6b2fa1c
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 295 deletions.
58 changes: 29 additions & 29 deletions app/code/local/Inchoo/PHP7/Model/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ class Inchoo_PHP7_Model_Crypt
* @return Varien_Crypt_Abstract
* @throws Varien_Exception
*/
static public function factory($method = 'auto')
{
/**
* Try to resolve best scenario:
* 1. mcrypt extension and it's not deprecated
* 2. mcrypt polyfill
* 3. openssl
*/
if($method == 'auto') {
static public function factory($method = 'auto')
{
/**
* Try to resolve best scenario:
* 1. mcrypt extension and it's not deprecated
* 2. mcrypt polyfill
* 3. openssl
*/
if($method == 'auto') {

$hasMcrypt = extension_loaded('mcrypt');
$hasMcryptPolyfill = !$hasMcrypt && function_exists('mcrypt_module_open');
$hasMcrypt = extension_loaded('mcrypt');
$hasMcryptPolyfill = !$hasMcrypt && function_exists('mcrypt_module_open');

if(($hasMcrypt && version_compare(PHP_VERSION, '7.1.0', '<')) || $hasMcryptPolyfill) {
$method = 'mcrypt';
} elseif (extension_loaded('openssl')) {
$method = 'openssl';
}
}
if(($hasMcrypt && version_compare(PHP_VERSION, '7.1.0', '<')) || $hasMcryptPolyfill) {
$method = 'mcrypt';
} elseif (extension_loaded('openssl')) {
$method = 'openssl';
}
}

switch ($method) {
case 'openssl':
$crypt = new Inchoo_PHP7_Model_Crypt_Openssl();
break;
case 'mcrypt':
$crypt = new Varien_Crypt_Mcrypt();
break;
default:
throw new Varien_Exception( 'Crypt adapter not available.' );
}
switch ($method) {
case 'openssl':
$crypt = new Inchoo_PHP7_Model_Crypt_Openssl();
break;
case 'mcrypt':
$crypt = new Varien_Crypt_Mcrypt();
break;
default:
throw new Varien_Exception( 'Crypt adapter not available.' );
}

return $crypt;
}
return $crypt;
}
}
12 changes: 6 additions & 6 deletions app/code/local/Inchoo/PHP7/Model/Crypt/Openssl.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ public function encrypt($data)
$data .= str_repeat("\0", $blockSize - $modus);
}

$openSslOptions = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
if(defined('OPENSSL_DONT_ZERO_PAD_KEY')) {
$openSslOptions |= OPENSSL_DONT_ZERO_PAD_KEY;
}
$openSslOptions = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
if(defined('OPENSSL_DONT_ZERO_PAD_KEY')) {
$openSslOptions |= OPENSSL_DONT_ZERO_PAD_KEY;
}

$encryptedData = openssl_encrypt(
$data,
Expand Down Expand Up @@ -158,9 +158,9 @@ public function decrypt($data)
return $data;
}

$openSslOptions = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
$openSslOptions = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
if(defined('OPENSSL_DONT_ZERO_PAD_KEY')) {
$openSslOptions |= OPENSSL_DONT_ZERO_PAD_KEY;
$openSslOptions |= OPENSSL_DONT_ZERO_PAD_KEY;
}

$decryptedData = openssl_decrypt(
Expand Down
14 changes: 14 additions & 0 deletions app/code/local/Inchoo/PHP7/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,19 @@
</rewrite>
</core>
</helpers>

<!-- Fix for incorrect sorting in the calculation of the discount -->
<sales>
<quote>
<totals>
<msrp>
<before>grand_total</before>
</msrp>
<shipping>
<after>subtotal,freeshipping,tax_subtotal,msrp</after>
</shipping>
</totals>
</quote>
</sales>
</global>
</config>
255 changes: 0 additions & 255 deletions app/code/local/Mage/Sales/Model/Config/Ordered.php

This file was deleted.

10 changes: 5 additions & 5 deletions app/code/local/Mage/Shipping/Model/Carrier/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ public function getMethodPrice($cost, $method = '')
*/
public function getFinalPriceWithHandlingFee($cost)
{
/**
* PHP 7.1 fix, casted to float to avoid warnings
*/
$handlingFee = (float) $this->getConfigData('handling_fee');
//
/**
* PHP 7.1 fix, casted to float to avoid warnings
*/
$handlingFee = (float) $this->getConfigData('handling_fee');
//

$handlingType = $this->getConfigData('handling_type');
if (!$handlingType) {
Expand Down

0 comments on commit 6b2fa1c

Please sign in to comment.