2001-03-10 11:07:52 +00:00
<?php
2000-12-23 15:20:10 +00:00
2001-02-04 22:09:38 +00:00
function module_help() {
?>
2001-04-30 17:13:08 +00:00
The module administration page provide you a list of all available modules. Moreover, it allows you to "rehash" modules. Whenever you install a new module or when an existing module has been changed or updated, it requires "rehashing": when you rehash a module, the module is registered to the engine and properly initialized.
2001-03-10 11:07:52 +00:00
<?php
2001-02-04 22:09:38 +00:00
}
2000-12-23 15:20:10 +00:00
function module_admin_rehash() {
$result = db_query("SELECT * FROM modules");
while ($module = db_fetch_object($result)) {
module_rehash($module->name);
}
2001-05-05 13:57:29 +00:00
foreach (module_list() as $name) {
2000-12-23 15:20:10 +00:00
module_rehash($name);
}
}
2001-05-05 13:57:29 +00:00
function module_admin_overview() {
2000-12-23 15:20:10 +00:00
$output .= "<FORM ACTION=\"admin.php?mod=module\" METHOD=\"post\">\n";
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>module</TH><TH COLSPAN=\"3\">operations</TH></TR>\n";
2001-01-26 13:38:46 +00:00
2001-05-05 13:57:29 +00:00
foreach (module_list() as $name) {
$output .= " <TR><TD>$name</TD><TD>". (module_hook($name, "page") ? "<A HREF=\"module.php?mod=$name\">view</A>" : " ") ."</TD><TD>". (module_hook($name, "admin") ? "<A HREF=\"admin.php?mod=$name\">admin</A>" : " ") ."</TD><TD><A HREF=\"admin.php?mod=module&op=rehash&name=$name\">rehash</A></TD></TR>\n";
}
2001-01-26 13:38:46 +00:00
2000-12-23 15:20:10 +00:00
$output .= "</TABLE>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Rehash modules\">\n";
$output .= "</FORM>\n";
print $output;
}
function module_admin() {
global $op, $name;
2001-01-26 13:38:46 +00:00
2001-02-04 22:09:38 +00:00
print "<SMALL><A HREF=\"admin.php?mod=module\">overview</A> | <A HREF=\"admin.php?mod=module&op=help\">help</A></SMALL><HR>\n";
2000-12-23 15:20:10 +00:00
switch ($op) {
2001-02-04 22:09:38 +00:00
case "help":
module_help();
2000-12-23 15:20:10 +00:00
break;
case "rehash":
module_rehash($name);
2001-05-05 13:57:29 +00:00
module_admin_overview();
2000-12-23 15:20:10 +00:00
break;
2001-02-04 22:09:38 +00:00
case "Rehash modules":
module_admin_rehash();
2001-05-05 13:57:29 +00:00
module_admin_overview();
2001-02-04 22:09:38 +00:00
break;
default:
2001-05-05 13:57:29 +00:00
module_admin_overview();
2000-12-23 15:20:10 +00:00
}
}
?>