[-] BO : fixed error message in language form #PSCFV-8890
This commit is contained in:
@@ -1055,6 +1055,9 @@ class ValidateCore
|
|||||||
{
|
{
|
||||||
return (bool)(is_string($name) && preg_match('/^[0-9a-zA-Z-_]*$/u', $name));
|
return (bool)(is_string($name) && preg_match('/^[0-9a-zA-Z-_]*$/u', $name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public static function isPrestaShopVersion($version)
|
||||||
|
{
|
||||||
|
return (preg_match('/^[0-1]\.[0-9]{1,2}(\.[0-9]{1,2}){0,2}$/', $version) && ip2long($version));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -475,19 +475,21 @@ class AdminLanguagesControllerCore extends AdminController
|
|||||||
public function ajaxProcessCheckLangPack()
|
public function ajaxProcessCheckLangPack()
|
||||||
{
|
{
|
||||||
$this->json = true;
|
$this->json = true;
|
||||||
if (empty($_GET['iso_lang']))
|
if (!Tools::getValue('iso_lang') || !Validate::isLanguageIsoCode(Tools::getValue('iso_lang')))
|
||||||
{
|
{
|
||||||
$this->status = 'error';
|
$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->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
|
// 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);
|
$result = Tools::jsonDecode($lang_packs);
|
||||||
if ($lang_packs !== '' && $result && !isset($result->error))
|
if ($lang_packs !== '' && $result && !isset($result->error))
|
||||||
@@ -498,16 +500,13 @@ class AdminLanguagesControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->status = 'error';
|
$this->status = 'error';
|
||||||
$msg = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
|
$this->errors[] = $this->l('Wrong ISO code, or the selected language pack is unavailable.');
|
||||||
if ($result)
|
|
||||||
$msg = $result->msg;
|
|
||||||
$this->errors[] = $msg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->status = 'error';
|
$this->status = 'error';
|
||||||
$this->errors[] = '[TECHNICAL ERROR] Server unreachable';
|
$this->errors[] = $this->l('Technical Error: translation server unreachable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -498,7 +498,7 @@ select optgroup option {
|
|||||||
background: #FFBABA url(../img/admin/icon-cancel.png) no-repeat scroll 6px 6px;
|
background: #FFBABA url(../img/admin/icon-cancel.png) no-repeat scroll 6px 6px;
|
||||||
border: 1px solid #CC0000;
|
border: 1px solid #CC0000;
|
||||||
color:#D8000C;
|
color:#D8000C;
|
||||||
padding:20px;
|
padding:20px 40px;
|
||||||
position:fixed;
|
position:fixed;
|
||||||
bottom:0;
|
bottom:0;
|
||||||
width:100%;
|
width:100%;
|
||||||
|
|||||||
Reference in New Issue
Block a user