diff --git a/modules/moneybookers/moneybookers.php b/modules/moneybookers/moneybookers.php
index bd5f9815a..34f97f70b 100644
--- a/modules/moneybookers/moneybookers.php
+++ b/modules/moneybookers/moneybookers.php
@@ -1,6 +1,6 @@
* @copyright 2007-2011 PrestaShop SA
-* @version Release: $Revision: 7091 $
+* @version Release: $Revision: 9702 $
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
@@ -29,7 +29,7 @@ if (!defined('_PS_VERSION_'))
exit;
class MoneyBookers extends PaymentModule
-{
+{
const LEFT_COLUMN = 0;
const RIGHT_COLUMN = 1;
const DISABLE = -1;
@@ -38,7 +38,7 @@ class MoneyBookers extends PaymentModule
{
$this->name = 'moneybookers';
$this->tab = 'payments_gateways';
- $this->version = '1.6.1';
+ $this->version = '1.6.2';
parent::__construct();
@@ -123,8 +123,8 @@ class MoneyBookers extends PaymentModule
public function install()
{
- if (!parent::install() OR
- !$this->registerHook('payment') OR
+ if (!parent::install() OR
+ !$this->registerHook('payment') OR
!$this->registerHook('paymentReturn'))
return false;
Configuration::updateValue('MB_HIDE_LOGIN', 1);
@@ -169,28 +169,28 @@ class MoneyBookers extends PaymentModule
'max_redirects' => 10,
'timeout' => $timeout,
'header' => array(
- 'Accept-language: en',
+ 'Accept-language: en',
'Cookie: foo=bar')));
-
+
if (is_callable('curl_init') && ($ch = curl_init()))
{
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
-
+
$content = curl_exec($ch);
curl_close($ch);
}
else
{
- // Check availability of the context options
+ // Check availability of the context options
if (!is_array($contextOptions) || !count($contextOptions))
$contextOptions = $defaultContextOptions;
-
+
// Create a stream context
$stream_context = @stream_context_create($contextOptions);
-
+
if (($fp = @fopen($url, $mode, false, $stream_context)))
{
$content = fgets($fp, 4096);
@@ -199,7 +199,7 @@ class MoneyBookers extends PaymentModule
else if (!($content = @file_get_contents($url, false, $stream_context)))
if (($fp = @fsockopen($url, 80, $errnom, $errstr, $timeout)))
{
- preg_match('@^(?:http://)?([^/]+)@i', $url, $matches);
+ preg_match('@^(?:http://)?([^/]+)@i', $url, $matches);
$host = $matches[1];
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: ".$host."\r\n";
@@ -221,17 +221,18 @@ class MoneyBookers extends PaymentModule
public function getContent()
{
+ global $cookie;
$errors = array();
$output = '
-

';
+ 
';
/* Validate account */
if (isset($_POST['SubmitValidation']))
if (isset($_POST['mb_email_to_validate']) &&
!empty($_POST['mb_email_to_validate']))
- {
- try
{
+ try
+ {
$url = 'http://moneybookers.prestashop.com/email_check.php?email='.$_POST['mb_email_to_validate'].'&url=http://'.$_SERVER['HTTP_HOST'].__PS_BASE_URI__;
$content = $this->_fetchWebContent($url);
$response = trim(strtolower($content));
@@ -243,19 +244,19 @@ class MoneyBookers extends PaymentModule
Configuration::updateValue('MB_PARAMETERS', 1);
$output .= '
-
- - '.$this->l('E-mail activation successful, you can now validate your secret word.').'
.')
-
';
+
+ - '.$this->l('E-mail activation successful, you can now validate your secret word.').'
.')
+
';
}
}
catch(Exception $e)
- {
+ {
$errors[] = $this->l('Unable to contact activation server, please try again later.');
+ }
}
- }
- else
+ else
$errors[] = $this->l('E-mail field is required');
-
+
/* Validate secret word */
if (isset($_POST['SubmitSecret']))
{
@@ -285,7 +286,7 @@ class MoneyBookers extends PaymentModule
catch(Exception $e)
{
$errors[] = $this->l('Unable to contact activation server, please try again later.');
- }
+ }
}
else
$errors[] = $this->l('Secret word field is required');
@@ -324,18 +325,18 @@ class MoneyBookers extends PaymentModule
Configuration::updateValue('MB_INTER_METHODS', $inter);
Configuration::updateValue('MB_DISPLAY_MODE', (int)($_POST['mb_display_mode']));
}
-
+
if (Tools::getValue('submitSettings'))
{
foreach(array('leftColumn', 'rightColumn') as $hookName)
if ($this->isRegisteredInHook($hookName))
- $this->unregisterHook(Hook::getIdByName($hookName));
+ $this->unregisterHook(Hook::get($hookName));
if (Tools::getValue('logo_position') == self::LEFT_COLUMN)
$this->registerHook('leftColumn');
else if (Tools::getValue('logo_position') == self::RIGHT_COLUMN)
$this->registerHook('rightColumn');
}
-
+
/* Display errors */
if (sizeof($errors))
{
@@ -345,9 +346,9 @@ class MoneyBookers extends PaymentModule
$output .= '';
}
- $lang = $this->context->language;
- $iso_img = $lang->id;
- if ($iso_img != 'fr' AND $iso_img != 'en')
+ $lang = new Language((int)($cookie->id_lang));
+ $iso_img = $lang->iso_code;
+ if ($lang->iso_code != 'fr' AND $lang->iso_code != 'en')
$iso_img = 'en';
$manual_links = array(
@@ -356,18 +357,18 @@ class MoneyBookers extends PaymentModule
'fr' => 'http://www.moneybookers.com/creatives/integrationmanual/MB-Prestashop-Integration_fr.pdf');
$iso_manual = $lang->iso_code;
- if (!array_key_exists($iso_manual, $manual_links))
+ if (!array_key_exists($lang->iso_code, $manual_links))
$iso_manual = 'en';
$blockPositionList = array(
self::DISABLE => $this->l('Disable'),
self::LEFT_COLUMN => $this->l('Left Column'),
self::RIGHT_COLUMN => $this->l('Right Column'));
+
+ $currentLogoBlockPosition = ($this->isRegisteredInHook('leftColumn')) ? self::LEFT_COLUMN :
+ (($this->isRegisteredInHook('rightColumn')) ? self::RIGHT_COLUMN : -1);
- $currentLogoBlockPosition = ($this->isRegisteredInHook('leftColumn')) ? self::LEFT_COLUMN :
- (($this->isRegisteredInHook('rightColumn')) ? self::RIGHT_COLUMN : -1);
-
- /* Display settings form */
+ /* Display settings form */
$output .= '
'.$this->l('About Moneybookers').'
'.
$this->l('Take advantage of the special fees offered by Moneybookers to PrestaShop merchants !').'
'.
@@ -375,26 +376,26 @@ class MoneyBookers extends PaymentModule
$this->l('With more than 17 million users and more than 15,000 new accounts created per day, Moneybookers also offers one of the biggest electronic wallet in the world. Your customers can also pay by using their e-mail and password thanks to the e-Wallet solution.').'
'.
$this->l('Moneybookers changes its name and becomes Skrill!').'
-
+