Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release
This commit is contained in:
@@ -292,54 +292,45 @@ class LocalizationPackCore
|
|||||||
foreach ($xml->languages->language as $data)
|
foreach ($xml->languages->language as $data)
|
||||||
{
|
{
|
||||||
$attributes = $data->attributes();
|
$attributes = $data->attributes();
|
||||||
if (Language::getIdByIso($attributes['iso_code']))
|
|
||||||
continue;
|
|
||||||
$native_lang = Language::getLanguages();
|
|
||||||
$native_iso_code = array();
|
|
||||||
foreach ($native_lang as $lang)
|
|
||||||
$native_iso_code[] = $lang['iso_code'];
|
|
||||||
// if we are not in an installation context or if the pack is not available in the local directory
|
// if we are not in an installation context or if the pack is not available in the local directory
|
||||||
if (!$install_mode || !in_array((string)$attributes['iso_code'], $native_iso_code))
|
if (Language::getIdByIso($attributes['iso_code']) && !$install_mode)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$errno = 0;
|
||||||
|
$errstr = '';
|
||||||
|
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code']))
|
||||||
|
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
||||||
|
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
|
||||||
|
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
||||||
|
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
||||||
{
|
{
|
||||||
$errno = 0;
|
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
||||||
$errstr = '';
|
if (file_put_contents($file, $content))
|
||||||
if (!@fsockopen('api.prestashop.com', 80, $errno, $errstr, 5))
|
|
||||||
$this->_errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
|
|
||||||
elseif (!($lang_pack = Tools::jsonDecode(Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='._PS_VERSION_.'&iso_lang='.$attributes['iso_code']))))
|
|
||||||
$this->_errors[] = Tools::displayError('Error occurred when language was checked according to your Prestashop version.');
|
|
||||||
elseif ($content = Tools::file_get_contents('http://translations.prestashop.com/download/lang_packs/gzip/'.$lang_pack->version.'/'.$attributes['iso_code'].'.gzip'))
|
|
||||||
{
|
{
|
||||||
$file = _PS_TRANSLATIONS_DIR_.$attributes['iso_code'].'.gzip';
|
$gz = new Archive_Tar($file, true);
|
||||||
if (file_put_contents($file, $content))
|
$files_list = $gz->listContent();
|
||||||
|
|
||||||
|
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
||||||
{
|
{
|
||||||
$gz = new Archive_Tar($file, true);
|
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
||||||
$files_list = $gz->listContent();
|
return false;
|
||||||
|
|
||||||
if (!$gz->extract(_PS_TRANSLATIONS_DIR_.'../', false))
|
|
||||||
{
|
|
||||||
$this->_errors[] = Tools::displayError('Cannot decompress the translation file for the following language: ').(string)$attributes['iso_code'];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AdminTranslationsController::checkAndAddMailsFiles($attributes['iso_code'], $files_list);
|
|
||||||
AdminTranslationsController::addNewTabs($attributes['iso_code'], $files_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
|
||||||
{
|
|
||||||
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@unlink($file);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
{
|
||||||
|
AdminTranslationsController::checkAndAddMailsFiles($attributes['iso_code'], $files_list);
|
||||||
|
AdminTranslationsController::addNewTabs($attributes['iso_code'], $files_list);
|
||||||
|
}
|
||||||
|
if (!Language::checkAndAddLanguage((string)$attributes['iso_code']))
|
||||||
|
{
|
||||||
|
$this->_errors[] = Tools::displayError('An error occurred while creating the language: ').(string)$attributes['iso_code'];
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@unlink($file);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$this->_errors[] = Tools::displayError('Server does not have permissions for writing.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// change the default language if there is only one language in the localization pack
|
// change the default language if there is only one language in the localization pack
|
||||||
if (!count($this->_errors) && $install_mode && isset($attributes['iso_code']) && count($xml->languages->language) == 1)
|
if (!count($this->_errors) && $install_mode && isset($attributes['iso_code']) && count($xml->languages->language) == 1)
|
||||||
$this->iso_code_lang = $attributes['iso_code'];
|
$this->iso_code_lang = $attributes['iso_code'];
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
|||||||
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
|
$minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
|
||||||
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
|
if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
|
||||||
return '<p class="warning">'.sprintf(
|
return '<p class="warning">'.sprintf(
|
||||||
Tools::displayError('A minimum purchase total of %d is required in order to validate your order.'),
|
Tools::displayError('A minimum purchase total of %s is required in order to validate your order.'),
|
||||||
Tools::displayPrice($minimalPurchase, $currency)
|
Tools::displayPrice($minimalPurchase, $currency)
|
||||||
).'</p>';
|
).'</p>';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user