"admin", "system" => "system", "user" => "user", "watchdog" => "watchdog"); $result = db_query("SELECT name, filename, bootstrap FROM {system} WHERE type = 'module' AND status = '1' ORDER BY name"); while ($module = db_fetch_object($result)) { if (file_exists($module->filename)) { if ($bootstrap) { $list[$module->name] = array("name"=> $module->name, "bootstrap" => $module->bootstrap, "filename" => $module->filename); } else { $list[$module->name] = $module->name; include_once $module->filename; } } } natcasesort($list); } return $list; } // return 1 if module $name exists, 0 otherwise: function module_exist($name) { $list = module_list(); return isset($list[$name]) ? 1 : 0; } // return 1 if module $name implements hook $hook, 0 otherwise: function module_hook($name, $hook) { return function_exists($name ."_". $hook); } ?>