diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 562d3897..2ef6ab81 100755 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -134,31 +134,36 @@ class helper { * du nom réel * du numéro de version */ - public static function getModules() { - $dirs = array_diff(scandir('module'), array('..', '.')); + public static function getModules($folder = 'module') { + + $dirs = array_diff(scandir($folder), array('..', '.')); foreach ($dirs as $key => $value) { // Dossier non vide - if (file_exists('module/' . $value . '/' . $value . '.php')) { + if (file_exists($folder . '/' . $value . '/' . $value . '.php')) { // Lire les constantes - $class_reflex = new \ReflectionClass($value); - $class_constants = $class_reflex->getConstants(); - // Constante REALNAME - if (array_key_exists('REALNAME', $class_constants)) { - $realName = $value::REALNAME; - } else { - $realName = ucfirst($value); - } - // Constante VERSION - if (array_key_exists('VERSION', $class_constants)) { - $version = $value::VERSION; - } else { - $version = '0.0'; - } - // Affection - $modules [$value] = [ - 'realName' => $realName, - 'version' => $version - ]; + try { + $class_reflex = new \ReflectionClass($value); + $class_constants = $class_reflex->getConstants(); + // Constante REALNAME + if (array_key_exists('REALNAME', $class_constants)) { + $realName = $value::REALNAME; + } else { + $realName = ucfirst($value); + } + // Constante VERSION + if (array_key_exists('VERSION', $class_constants)) { + $version = $value::VERSION; + } else { + $version = '0.0'; + } + // Affection + $modules [$value] = [ + 'realName' => $realName, + 'version' => $version + ]; + } catch (Exception $e){ + // on ne fait rien + } } } return($modules); diff --git a/module/gps/gps.php b/module/gps/gps.php new file mode 100644 index 00000000..e69de29b