// fix admin Language and Theme controller

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11955 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mMarinetti
2011-12-30 16:05:15 +00:00
parent 97443c2591
commit 10f1da2bc9
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';
}
}
}