From a01964413350ecb1682aa98b4e665c7c298977ec Mon Sep 17 00:00:00 2001 From: Akred Date: Thu, 12 Nov 2015 23:33:28 +0100 Subject: [PATCH] Fix installation for PHP 5.3 min --- INSTALL/includes/class/db.class.php | 6 ++++-- .../class/processConfiguration.class.php | 21 ++++++++++++------- INSTALL/includes/class/view.class.php | 6 ++++-- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/INSTALL/includes/class/db.class.php b/INSTALL/includes/class/db.class.php index 87759fa1..2f9b00dd 100755 --- a/INSTALL/includes/class/db.class.php +++ b/INSTALL/includes/class/db.class.php @@ -55,8 +55,10 @@ public function load($databaseData = array()) { $databaseType = (isset($databaseData['db_type'])) ? $databaseData['db_type'] : 'MySQL'; - if (! is_file($classFile = 'includes/class/db/db'. $databaseType .'.class.php')) - throw new dbException(sprintf(i18n::getInstance()['UNKNOW_DATABASE_TYPE'], $databaseType)); + if (! is_file($classFile = 'includes/class/db/db'. $databaseType .'.class.php')) { + $i18n = i18n::getInstance(); + throw new dbException(sprintf($i18n['UNKNOW_DATABASE_TYPE'], $databaseType)); + } include_once $classFile; diff --git a/INSTALL/includes/class/processConfiguration.class.php b/INSTALL/includes/class/processConfiguration.class.php index e69d2dce..3b3f2b42 100755 --- a/INSTALL/includes/class/processConfiguration.class.php +++ b/INSTALL/includes/class/processConfiguration.class.php @@ -23,8 +23,10 @@ class processConfiguration { * - Load it */ public function __construct($session) { - if (! is_file('config.php')) - throw new Exception(sprintf(i18n::getInstance()['MISSING_FILE'], 'INSTALL/config.php')); + if (! is_file('config.php')) { + $i18n = i18n::getInstance(); + throw new Exception(sprintf($i18n['MISSING_FILE'], 'INSTALL/config.php')); + } $this->_load($session); } @@ -56,15 +58,18 @@ public function get() { private function _check() { $cfgStrKey = array('nkVersion', 'nkMinimumVersion', 'minimalPhpVersion', 'partnersKey'); $cfgArrayKey = array('phpExtension', 'uploadDir', 'changelog', 'infoList', 'deprecatedFiles'); + $i18n = i18n::getInstance(); foreach (array_merge($cfgStrKey, $cfgArrayKey) as $cfgKey) { - if (! array_key_exists($cfgKey, $this->_configuration)) - throw new Exception(sprintf(i18n::getInstance()['MISSING_CONFIG_KEY'], $cfgKey)); + if (! array_key_exists($cfgKey, $this->_configuration)) { + throw new Exception(sprintf($i18n['MISSING_CONFIG_KEY'], $cfgKey)); + } - if (in_array($cfgKey, $cfgStrKey) && (! is_string($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) - throw new Exception(sprintf(i18n::getInstance()['CONFIG_KEY_MUST_BE_STRING'], $cfgKey)); - elseif (in_array($cfgKey, $cfgArrayKey) && (! is_array($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) - throw new Exception(sprintf(i18n::getInstance()['CONFIG_KEY_MUST_BE_ARRAY'], $cfgKey)); + if (in_array($cfgKey, $cfgStrKey) && (! is_string($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) { + throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_STRING'], $cfgKey)); + } elseif (in_array($cfgKey, $cfgArrayKey) && (! is_array($this->_configuration[$cfgKey]) || empty($this->_configuration[$cfgKey]))) { + throw new Exception(sprintf($i18n['CONFIG_KEY_MUST_BE_ARRAY'], $cfgKey)); + } } } } diff --git a/INSTALL/includes/class/view.class.php b/INSTALL/includes/class/view.class.php index e05ab714..6fe3e6c4 100755 --- a/INSTALL/includes/class/view.class.php +++ b/INSTALL/includes/class/view.class.php @@ -28,8 +28,10 @@ class view { * - Set view filename */ public function __construct($view) { - if (! is_file($viewFile = 'views/'. $view .'.php')) - throw new Exception(sprintf(i18n::getInstance()['VIEW_NO_FOUND'], $viewFile)); + if (! is_file($viewFile = 'views/'. $view .'.php')) { + $i18n = i18n::getInstance(); + throw new Exception(sprintf($i18n['VIEW_NO_FOUND'], $viewFile)); + } $this->_viewFile = $viewFile; }