private function scan($path) { $modules = array(); $cnt = 0; if ($modDir = olivopendir($path)) { while ($file = readdir($modDir)) { if (olivis_dir($path . $file) and $file != "." and $file != "..") { $filePath = "{$file}/"; // get modules define.xml if (olivfile_exists($path . $filePath)) { // load module information $xml = olivxml_load_file($path . $filePath . "define.xml"); //------------------------------------------------------------------------------ // check for session directory $sessionDir = system::oliv_module_path() . $filePath; if (sessionfile_exists($sessionDir)) { $contentPath = $xml->content; $templatePath = $xml->template; // write directory permissions to module header $xml->content['permission'] = get_permission(session_path($sessionDir) . $contentPath); $xml->template['permission'] = get_permission(session_path($sessionDir) . $templatePath); } else { // session directory don't exist $xml->status = "NO_SESSION_DIR"; $xml->permission = 0; } //------------------------------------------------------------------------------ // save module metadata $modules[(string) $xml->name] = $xml; $cnt++; } } } closedir($modDir); system::set("modules", $modules); return $cnt; } else { OLIVError::fire("module::scan - directory {$path} not found"); } return FALSE; }
private static function scan($path) { global $_PLUGIN; // $_PLUGIN = new simpleXmlElement("<plugin></plugin>"); $_PLUGIN = new simpleXmlElement("<plugins></plugins>"); if ($pluginDir = olivopendir($path)) { $cnt = 0; while ($file = readdir($pluginDir)) { if (olivis_dir($path . $file) and $file != "." and $file != "..") { $file .= "/"; // get define.xml if (olivfile_exists($path . $file . "define.xml")) { $xml = olivxml_load_file($path . $file . "define.xml"); //TODO include plugin script // get type of plugin olivxml_insert($_PLUGIN, $xml, "ALL"); } } } closedir($pluginDir); return $cnt; } else { OLIVError::fire("plugin::scan - directory {$path} not found"); } return FALSE; }