diff --git a/composer.json b/composer.json index 74dfd85..f6692ba 100644 --- a/composer.json +++ b/composer.json @@ -5,6 +5,8 @@ "twig/extensions": "~1.5", "symfony/twig-bridge": "^3.3", "symfony/yaml": "^3.3", + "symfony/translation": "^3.3", + "symfony/config": "^3.3", "ddesrosiers/silex-annotation-provider": "~2.0", "doctrine/dbal": "~2.5", "mobiledetect/mobiledetectlib": "^2.8", diff --git a/src/Application/DbsProvider.php b/src/Application/DbsProvider.php index 39c63f2..bf49c29 100644 --- a/src/Application/DbsProvider.php +++ b/src/Application/DbsProvider.php @@ -17,10 +17,12 @@ class DbsProvider } $dbs = ConfigApplication::getTopInterval(); - foreach ($dbs as $key => $val) - { - $db[$key."statsfile"]['path'] = $val['statsfile']; - $db[$key."statsfile"]['driver'] = 'pdo_sqlite'; + if ( $dbs ) { + foreach ($dbs as $key => $val) + { + $db[$key."statsfile"]['path'] = $val['statsfile']; + $db[$key."statsfile"]['driver'] = 'pdo_sqlite'; + } } return $db; diff --git a/src/Controllers/Func.php b/src/Controllers/Func.php index 19099c8..0dcdf8b 100644 --- a/src/Controllers/Func.php +++ b/src/Controllers/Func.php @@ -150,21 +150,28 @@ class Func public function statsFileForHours($hours) { - foreach (ConfigApplication::getTopInterval() as $key => $interval) { - if ($interval['hours'] == $hours) { - return $key."statsfile"; - } - } + $top = ConfigApplication::getTopInterval(); + if ( $top ) { + foreach ($top as $key => $interval) { + if ($interval['hours'] == $hours) { + return $key."statsfile"; + } + } + } return "daystatsfile"; } public function statsLabelForHours($hours) { - foreach (ConfigApplication::getTopInterval() as $key => $interval) { - if ($interval['hours'] == $hours) { - return $interval['label']; - } - } - return (int)$hours . " hours"; + $top = ConfigApplication::getTopInterval(); + + if ( $top ) { + foreach ($top as $key => $interval) { + if ($interval['hours'] == $hours) { + return $interval['label']; + } + } + } + return (int)$hours . " hours"; } }