// fix admin Language and Theme controller

This commit is contained in:
mMarinetti
2011-12-30 16:05:15 +00:00
parent 5671afe770
commit 9daeb45132
2 changed files with 134 additions and 22 deletions
@@ -486,6 +486,41 @@ class AdminLanguagesControllerCore extends AdminController
if (!$lang->active)
$this->_errors[] = Tools::displayError('You cannot set this language as default language because it\'s disabled');
}
public function ajaxProcessCheckLangPack()
{
$this->json = true;
if(empty($_GET['iso_lang']))
{
$this->status = 'error';
$this->_errors[] = '[TECHNICAL ERROR] iso_lang not set or empty';
}
if(empty($_GET['ps_version']))
{
$this->status = 'error';
$this->_errors[] = '[TECHNICAL ERROR] ps_version not set or empty';
}
if(@fsockopen('api.prestashop.com', 80))
{
// Get all iso code available
$lang_packs = Tools::file_get_contents('http://api.prestashop.com/download/lang_packs/get_language_pack.php?version='.(string)$_GET['ps_version'].'&iso_lang='.(string)$_GET['iso_lang']);
if ($lang_packs !== '' && Tools::jsonDecode($lang_packs) !== NULL)
{
$this->status = 'ok';
$this->content = $lang_packs;
}
else
{
$this->status = 'error';
$this->_errors[] = $this->l('wrong ISO code or lang pack unavailable');
}
}
else
{
$this->status = 'error';
$this->_errors[] = '[TECHNICAL ERROR] Server unreachable';
}
}
}