public static function Factory($default_page = null, $requireLogin = true) { $prefs = UserPreferences::Instance(EGS_USERNAME); $default_page = $prefs->getPreferenceValue('default_page', 'shared'); if ($default_page == null) { $ao = AccessObject::Instance(); $default_page = 'module,' . $ao->getDefaultModule(); } if (get_config('SETUP')) { if (defined('MODULE')) { $default_page = MODULE; } } $router = RouteParser::Instance(); $modules = array(); if (!$requireLogin || isLoggedIn()) { foreach ($router->getDispatch() as $key => $dispatch) { if (($key == 'group' || $key == 'module' || strstr($key, 'submodule')) && !empty($dispatch)) { $modules[$key] = $dispatch; } } if (empty($modules)) { // Default page contains permission type and permission name // i.e. type is group or module $array = explode(',', $default_page); $modules[$array[0]] = $array[1]; } } else { $modules['module'] = 'login'; } $al =& AutoLoader::Instance(); return $modules; }
function __autoload($var) { $autoloader = AutoLoader::Instance(); $autoloader->load($var); }
public static function references($module = null, $type = 'controller', $controller = null) { if (empty($module)) { return; } $system = System::Instance(); $scan_dirs = self::scanDirectories(PUBLIC_MODULES, $module, FALSE); switch (strtolower($type)) { case 'controller': $match = CONTROLLERS_NAME; break; case 'eglet': $match = 'eglets' . DIRECTORY_SEPARATOR; break; case 'model': $match = MODELS_NAME; break; case 'template': $match = 'templates' . DIRECTORY_SEPARATOR; foreach ($scan_dirs as $path) { if (strpos($path, $module . DIRECTORY_SEPARATOR . TEMPLATES_NAME . $controller) !== FALSE) { $system->templates[] = $path; } } return; default: return; } $autoloader =& AutoLoader::Instance(); foreach ($scan_dirs as $key => $path) { if (strpos($path, $match) !== FALSE) { $autoloader->addPath(array($key => $path)); } } }