diff --git a/admin-dev/themes/default/template/controllers/localization/content.tpl b/admin-dev/themes/default/template/controllers/localization/content.tpl
index 3fefc850d..4515293f5 100644
--- a/admin-dev/themes/default/template/controllers/localization/content.tpl
+++ b/admin-dev/themes/default/template/controllers/localization/content.tpl
@@ -24,9 +24,9 @@
*}
- {$localization_form}
+ {if isset($localization_form)}{$localization_form}{/if}
- {$localization_options}
+ {if isset($localization_options)}{$localization_options}{/if}
\ No newline at end of file
diff --git a/classes/Language.php b/classes/Language.php
index 786ed75a6..8aa65596d 100644
--- a/classes/Language.php
+++ b/classes/Language.php
@@ -111,18 +111,22 @@ class LanguageCore extends ObjectModel
$iso_code = $newIso ? $newIso : $this->iso_code;
if (!file_exists(_PS_TRANSLATIONS_DIR_.$iso_code))
- mkdir(_PS_TRANSLATIONS_DIR_.$iso_code);
+ {
+ if (@mkdir(_PS_TRANSLATIONS_DIR_.$iso_code))
+ @chmod(_PS_TRANSLATIONS_DIR_.$iso_code, 0777);
+ }
+
foreach ($this->translationsFilesAndVars as $file => $var)
{
$path_file = _PS_TRANSLATIONS_DIR_.$iso_code.'/'.$file.'.php';
if (!file_exists($path_file))
if ($file != 'tabs')
- file_put_contents($path_file, '');
else
- file_put_contents($path_file, '');
@@ -784,13 +788,22 @@ class LanguageCore extends ObjectModel
$lang_pack_ok = false;
$errors = array();
$file = _PS_TRANSLATIONS_DIR_.$iso.'.gzip';
+
if (!$lang_pack_link = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/get_language_pack.php?version='.$version.'&iso_lang='.Tools::strtolower($iso)))
$errors[] = Tools::displayError('Archive cannot be downloaded from prestashop.com.');
elseif (!$lang_pack = Tools::jsonDecode($lang_pack_link))
$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.'/'.Tools::strtolower($lang_pack->iso_code.'.gzip')))
if (!@file_put_contents($file, $content))
- $errors[] = Tools::displayError('Server does not have permissions for writing.');
+ {
+ if (is_writable(dirname($file)))
+ {
+ @unlink($file);
+ @file_put_contents($file, $content);
+ }
+ elseif (!is_writable($file))
+ $errors[] = Tools::displayError('Server does not have permissions for writing.').' ('.$file.')';
+ }
if (file_exists($file))
{
$gz = new Archive_Tar($file, true);
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index 0508ecaab..4064aca38 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -726,6 +726,8 @@ class AdminControllerCore extends Controller
*/
public function processAdd()
{
+ if (!isset($this->className) || empty($this->className))
+ return false;
/* Checking fields validity */
$this->validateRules();
if (count($this->errors) <= 0)
@@ -1142,6 +1144,8 @@ class AdminControllerCore extends Controller
*/
protected function loadObject($opt = false)
{
+ if (!isset($this->className) || empty($this->className))
+ return true;
$id = (int)Tools::getValue($this->identifier);
if ($id && Validate::isUnsignedId($id))
{
@@ -2400,7 +2404,7 @@ class AdminControllerCore extends Controller
public function getFieldValue($obj, $key, $id_lang = null)
{
if ($id_lang)
- $default_value = ($obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
+ $default_value = (isset($obj->id) && $obj->id && isset($obj->{$key}[$id_lang])) ? $obj->{$key}[$id_lang] : false;
else
$default_value = isset($obj->{$key}) ? $obj->{$key} : false;
diff --git a/controllers/admin/AdminLocalizationController.php b/controllers/admin/AdminLocalizationController.php
index c5158f9fa..882ad4e5e 100644
--- a/controllers/admin/AdminLocalizationController.php
+++ b/controllers/admin/AdminLocalizationController.php
@@ -28,9 +28,6 @@ class AdminLocalizationControllerCore extends AdminController
{
public function __construct()
{
- $this->className = 'Configuration';
- $this->table = 'configuration';
-
parent::__construct();
$this->fields_options = array(
diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php
index 9766e356b..52b178edc 100644
--- a/controllers/admin/AdminTranslationsController.php
+++ b/controllers/admin/AdminTranslationsController.php
@@ -581,7 +581,9 @@ class AdminTranslationsControllerCore extends AdminController
if (preg_match('#^translations\/'.$iso_code.'\/tabs.php#Ui', $file['filename'], $matches) && Validate::isLanguageIsoCode($iso_code))
{
// Include array width new translations tabs
- $tabs = include _PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename'];
+ $tabs = array();
+ if (Tools::file_exists_cache(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']))
+ $tabs = include_once(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.$file['filename']);
foreach ($tabs as $class_name => $translations)
{