Skip to content
This repository has been archived by the owner on Oct 7, 2023. It is now read-only.

Commit

Permalink
Fix installation for PHP 5.3 min
Browse files Browse the repository at this point in the history
  • Loading branch information
akred committed Nov 12, 2015
1 parent 7702c1e commit a019644
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 4 additions & 2 deletions INSTALL/includes/class/db.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
21 changes: 13 additions & 8 deletions INSTALL/includes/class/processConfiguration.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions INSTALL/includes/class/view.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a019644

Please sign in to comment.