Index: branches/RC/core/units/general/helpers/modules.php =================================================================== diff -u -N -r11623 -r11702 --- branches/RC/core/units/general/helpers/modules.php (.../modules.php) (revision 11623) +++ branches/RC/core/units/general/helpers/modules.php (.../modules.php) (revision 11702) @@ -2,11 +2,6 @@ class kModulesHelper extends kHelper { - function checkLogin() - { - return $this->_GetModules(); - } - function getWhereClause() { $where_clause = Array('Loaded = 1'); @@ -172,12 +167,40 @@ } } - // TODO: find a ways to make all modules auto-licensed except in-commerce & in-auction without scanning directory structure - array_push($modules, 'Core', 'In-Portal', 'In-Link', 'In-News', 'In-Bulletin', 'Custom'); + // all modules starting from "in-" doesn't require license + $base_modules = Array ('Core', 'In-Portal', 'Custom'); + $modules = array_merge($modules, $base_modules, $this->_getFreeModules()); + $modules = array_unique( array_map('strtolower', $modules) ); + return $modules; } /** + * Get all modules, that don't require licensing + * + * @return Array + */ + function _getFreeModules() + { + $skip_modules = Array ('.', '..', 'in-commerce', 'in-auction'); + $folder = dir(MODULES_PATH); + + $ret = Array (); + while (($entry = $folder->read()) !== false) { + $entry_lowercased = strtolower($entry); + if (!is_dir($folder->path . '/' . $entry) || in_array($entry_lowercased, $skip_modules) || (substr($entry_lowercased, 0, 3) != 'in-')) { + continue; + } + + $ret[] = $entry_lowercased; + } + + $folder->close(); + + return $ret; + } + + /** * Allows to determine if module is licensed * * @param string $name