[-] BO : fixed error message in language form #PSCFV-8890
This commit is contained in:
@@ -475,19 +475,21 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
public function ajaxProcessCheckLangPack()
|
||||
{
|
||||
$this->json = true;
|
||||
if (empty($_GET['iso_lang']))
|
||||
if (!Tools::getValue('iso_lang') || !Validate::isLanguageIsoCode(Tools::getValue('iso_lang')))
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->errors[] = '[TECHNICAL ERROR] iso_lang not set or empty';
|
||||
$this->errors[] = $this->l('Iso code is not valid');
|
||||
return;
|
||||
}
|
||||
if (empty($_GET['ps_version']))
|
||||
if (!Tools::getValue('ps_version') || !Validate::isPrestaShopVersion(Tools::getValue('ps_version')))
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->errors[] = '[TECHNICAL ERROR] ps_version not set or empty';
|
||||
$this->errors[] = $this->l('Technical Error: ps_version is not valid');
|
||||
return;
|
||||
}
|
||||
|
||||
// Get all iso code available
|
||||
if($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.(string)$_GET['ps_version'].'&iso_lang='.(string)$_GET['iso_lang']))
|
||||
if ($lang_packs = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.Tools::getValue('ps_version').'&iso_lang='.Tools::getValue('iso_lang')))
|
||||
{
|
||||
$result = Tools::jsonDecode($lang_packs);
|
||||
if ($lang_packs !== '' && $result && !isset($result->error))
|
||||
@@ -498,16 +500,13 @@ class AdminLanguagesControllerCore extends AdminController
|
||||
else
|
||||
{
|
||||
$this->status = 'error';
|
||||
$msg = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
|
||||
if ($result)
|
||||
$msg = $result->msg;
|
||||
$this->errors[] = $msg;
|
||||
$this->errors[] = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->status = 'error';
|
||||
$this->errors[] = '[TECHNICAL ERROR] Server unreachable';
|
||||
$this->errors[] = $this->l('Technical Error: translation server unreachable');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user