Skip to content
Snippets Groups Projects
Commit 3b506cd6 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

fix i18n create file without permission behavior

parent 7196e413
3 merge requests!1896Master,!1870Master,!1869Hotline master
......@@ -61,7 +61,7 @@ class Class_I18n {
public function __construct() {
$destination = USERFILESPATH . self::BASE_PATH;
if (!file_exists($destination))
mkdir($destination);
@mkdir($destination);
}
/**
......@@ -99,10 +99,12 @@ class Class_I18n {
$this->_createFileFor($language);
ob_start();
$datas = include $this->_getFilePathFor($language);
$datas = @include $this->_getFilePathFor($language);
ob_end_clean();
return $datas;
return $datas
? $datas
: [];
}
/**
......@@ -205,8 +207,10 @@ return array(
* @param string $language
*/
protected function _createFileFor($language) {
if (file_exists($this->_getFilePathFor($language))
&& (!is_writable($this->_getFilePathFor($language))))
if (file_exists($this->_getFilePathFor($language)))
return;
if(!is_writable($this->_getFilePathFor($language)))
return ;
file_put_contents($this->_getFilePathFor($language),
......
......@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_I18nTranslator {
/** @var array */
......@@ -34,7 +34,6 @@ class Class_I18nTranslator {
*/
public static function getFor($language) {
$language = (string)$language;
if (!self::$_caching)
return new self(Class_I18n::getInstance()->read($language));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment