summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-05 13:57:29 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-05 13:57:29 +0000
commitbe8e898d23a3f9ca515f59fbcc8d82e112ed7ee8 (patch)
treecf0d05f6b767f36e7feb09a3bc59cbc9a01e459b /modules
parent16818777616eadeb8a4670324e099b95c8d53e3b (diff)
downloadbrdo-be8e898d23a3f9ca515f59fbcc8d82e112ed7ee8.tar.gz
brdo-be8e898d23a3f9ca515f59fbcc8d82e112ed7ee8.tar.bz2
- Uhm. Rewrote the module system: less code clutter, less run-time
overhead, and a lot better (simpler) module API. I had to edit a LOT of files to get this refactored but I'm sure it was worth the effort. For module writers / maintainers: None of the hooks changed, so 95% of the old modules should still work. You can remove some code instead as "$module = array(...)" just became obsolete. Also - and let's thank God for this - the global variable "$repository" has been eliminated to avoid modules relying on, and poking in drupal's internal data structures. Take a look at include/module.inc to investigate the details/changes. - Improved design of the content modules "story", "book" and "node" (to aid smooth integration of permisions + moderate.module). I'm still working on the permissions but I got side tracked for which I "Oops!".
Diffstat (limited to 'modules')
-rw-r--r--modules/account.module8
-rw-r--r--modules/block.module10
-rw-r--r--modules/block/block.module10
-rw-r--r--modules/book.module23
-rw-r--r--modules/book/book.module23
-rw-r--r--modules/box.module8
-rw-r--r--modules/calendar.class2
-rw-r--r--modules/calendar.module2
-rw-r--r--modules/comment.module3
-rw-r--r--modules/comment/comment.module3
-rw-r--r--modules/cron.module6
-rw-r--r--modules/cvs.module4
-rw-r--r--modules/diary.module10
-rw-r--r--modules/drupal.module2
-rw-r--r--modules/drupal/drupal.module2
-rw-r--r--modules/forum.module3
-rw-r--r--modules/forum/forum.module3
-rw-r--r--modules/headline.module11
-rw-r--r--modules/headlineRSS10.module7
-rw-r--r--modules/help.module11
-rw-r--r--modules/help/help.module11
-rw-r--r--modules/locale.module4
-rw-r--r--modules/locale/locale.module4
-rw-r--r--modules/moderate.module31
-rw-r--r--modules/module.module29
-rw-r--r--modules/node.module11
-rw-r--r--modules/node/node.module11
-rw-r--r--modules/page.module2
-rw-r--r--modules/page/page.module2
-rw-r--r--modules/queue.module3
-rw-r--r--modules/rating.module5
-rw-r--r--modules/settings.module8
-rw-r--r--modules/story.module14
-rw-r--r--modules/story/story.module14
-rw-r--r--modules/structure.module6
-rw-r--r--modules/watchdog.module4
-rw-r--r--modules/watchdog/watchdog.module4
37 files changed, 82 insertions, 232 deletions
diff --git a/modules/account.module b/modules/account.module
index aeb1f3fc2..8480e540f 100644
--- a/modules/account.module
+++ b/modules/account.module
@@ -1,9 +1,5 @@
<?php
-$module = array("help" => "account_help",
- "find" => "account_find",
- "admin" => "account_admin");
-
function account_help() {
?>
<P>The account-module is responsible for maintaining the user database. It automatically handles tasks like registration, authentication, access control, password retrieval, user settings and much more.</P>
@@ -153,9 +149,9 @@ function account_edit_save($name, $edit) {
function account_edit($name) {
global $access, $account;
- function access($name, $module) {
+ function access($name) {
global $access, $account;
- if ($module["admin"]) $access .= "<OPTION VALUE=\"$name\"". (user_access($account, $name) ? " SELECTED" : "") .">$name</OPTION>";
+ if (module_hook($name, "admin")) $access .= "<OPTION VALUE=\"$name\"". (user_access($account, $name) ? " SELECTED" : "") .">$name</OPTION>";
}
$status = array("blocked", "not confirmed", "open");
diff --git a/modules/block.module b/modules/block.module
index c2b53240b..b37c8fb89 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -1,9 +1,5 @@
<?php
-$module = array("page" => "block_page",
- "help" => "block_help",
- "admin" => "block_admin");
-
function block_help() {
?>
<P>Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the engine or by any of the active modules. To really get your teeth into a drupal website, you are going to have to deal with blocks and administering blocks in a fairly sophisticated fashion. This means you will need to understand how the block placement strategy works.</P>
@@ -23,7 +19,7 @@ function block_page() {
while ($block = db_fetch_object($result)) {
if ($state % 3 == 0) print " <TR>\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
- $blocks = module_execute($block->module, "block");
+ $blocks = module_invoke($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
@@ -40,8 +36,6 @@ function block_admin_save($edit) {
}
function block_admin_display() {
- global $repository;
-
$result = db_query("SELECT * FROM blocks ORDER BY module");
// Generate output:
@@ -50,7 +44,7 @@ function block_admin_display() {
$output .= " <TR><TH>block</TH><TH>module</TH><TH>status</TH><TH>weight</TH><TH>region</TH></TR>\n";
while ($block = db_fetch_object($result)) {
- $module = ($repository[$block->module]["admin"]) ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
+ $module = module_hook($block->module, "admin") ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
$status .= "<SELECT NAME=\"edit[$block->name][status]\">\n";
$status .= " <OPTION VALUE=\"2\"". (($block->status == 2) ? " SELECTED" : "") .">enabled: always</OPTION>\n";
diff --git a/modules/block/block.module b/modules/block/block.module
index c2b53240b..b37c8fb89 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -1,9 +1,5 @@
<?php
-$module = array("page" => "block_page",
- "help" => "block_help",
- "admin" => "block_admin");
-
function block_help() {
?>
<P>Blocks are the boxes visible in the side bars on the left- and right-hand side of the website. They are either exported by the engine or by any of the active modules. To really get your teeth into a drupal website, you are going to have to deal with blocks and administering blocks in a fairly sophisticated fashion. This means you will need to understand how the block placement strategy works.</P>
@@ -23,7 +19,7 @@ function block_page() {
while ($block = db_fetch_object($result)) {
if ($state % 3 == 0) print " <TR>\n";
print " <TD ALIGN=\"center\" VALIGN=\"top\" WIDTH=\"33%\">\n";
- $blocks = module_execute($block->module, "block");
+ $blocks = module_invoke($block->module, "block");
$theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]);
print " </TD>\n";
if ($state % 3 == 2) print " </TR>\n";
@@ -40,8 +36,6 @@ function block_admin_save($edit) {
}
function block_admin_display() {
- global $repository;
-
$result = db_query("SELECT * FROM blocks ORDER BY module");
// Generate output:
@@ -50,7 +44,7 @@ function block_admin_display() {
$output .= " <TR><TH>block</TH><TH>module</TH><TH>status</TH><TH>weight</TH><TH>region</TH></TR>\n";
while ($block = db_fetch_object($result)) {
- $module = ($repository[$block->module]["admin"]) ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
+ $module = module_hook($block->module, "admin") ? "<A HREF=\"admin.php?mod=$block->module\">$block->module</A>" : $block->module;
$status .= "<SELECT NAME=\"edit[$block->name][status]\">\n";
$status .= " <OPTION VALUE=\"2\"". (($block->status == 2) ? " SELECTED" : "") .">enabled: always</OPTION>\n";
diff --git a/modules/book.module b/modules/book.module
index f0e9d4c44..550da76a9 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -1,20 +1,11 @@
<?php
-$module = array("find" => "book_find",
- "page" => "book_page",
- "user" => "book_user",
- "admin" => "book_admin",
- "export" => "book_export");
-
class Book {
- function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) {
- $this->nid = $nid;
- $this->userid = $userid;
- $this->title = $title;
- $this->body = $body;
- $this->parent = $parent;
- $this->weight = $weight;
- $this->timestamp = $timestamp;
+ function Book($book) {
+ $this = new Node($book);
+ $this->body = $book[body];
+ $this->parent = $book[parent];
+ $this->weight = $book[weight];
}
}
@@ -184,7 +175,7 @@ function book_admin() {
print book_tree();
break;
case t("Preview"):
- book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
+ book_view(new Book($edit));
print book_form($edit);
break;
case t("Submit"):
@@ -235,7 +226,7 @@ function book_user() {
$theme->box($title, book_update($id));
break;
case t("Preview"):
- book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
+ book_view(new Book($edit));
$theme->box($title, book_form($edit));
break;
case t("Submit"):
diff --git a/modules/book/book.module b/modules/book/book.module
index f0e9d4c44..550da76a9 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -1,20 +1,11 @@
<?php
-$module = array("find" => "book_find",
- "page" => "book_page",
- "user" => "book_user",
- "admin" => "book_admin",
- "export" => "book_export");
-
class Book {
- function Book($nid, $userid, $title, $body, $parent, $weight, $timestamp) {
- $this->nid = $nid;
- $this->userid = $userid;
- $this->title = $title;
- $this->body = $body;
- $this->parent = $parent;
- $this->weight = $weight;
- $this->timestamp = $timestamp;
+ function Book($book) {
+ $this = new Node($book);
+ $this->body = $book[body];
+ $this->parent = $book[parent];
+ $this->weight = $book[weight];
}
}
@@ -184,7 +175,7 @@ function book_admin() {
print book_tree();
break;
case t("Preview"):
- book_view(new Book(($edit[nid] ? $edit[nid] : -1), ($edit[userid] ? $edit[userid] : $user->userid), $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
+ book_view(new Book($edit));
print book_form($edit);
break;
case t("Submit"):
@@ -235,7 +226,7 @@ function book_user() {
$theme->box($title, book_update($id));
break;
case t("Preview"):
- book_view(new Book(($edit[nid] ? $edit[nid] : -1), $user->userid, $edit[title], $edit[body], $edit[parent], $edit[weight], ($edit[timestamp] ? $edit[timestamp] : time())));
+ book_view(new Book($edit));
$theme->box($title, book_form($edit));
break;
case t("Submit"):
diff --git a/modules/box.module b/modules/box.module
index 789185cc5..5edc748ac 100644
--- a/modules/box.module
+++ b/modules/box.module
@@ -1,10 +1,5 @@
<?php
-$module = array("help" => "box_help",
- "block" => "box_block",
- "admin" => "box_admin");
-
-
function box_help() {
?>
<P>The content of the site can be almost entirely altered through <I>boxes</I>. Simply put, boxes are small bits of text, HTML or PHP code which will get plugged into the site just like any other block. Boxes are typically used to add custom blocks to the site.</P>
@@ -96,8 +91,7 @@ function box_admin_delete($id) {
}
function box_admin_rehash() {
- global $repository;
- module_rehash_blocks("box", $repository["box"]);
+ module_rehash_blocks("box");
}
function box_admin_edit($id) {
diff --git a/modules/calendar.class b/modules/calendar.class
index 340b62139..b6595b360 100644
--- a/modules/calendar.class
+++ b/modules/calendar.class
@@ -1,7 +1,5 @@
<?php
-$module = array();
-
class Calendar {
var $date;
diff --git a/modules/calendar.module b/modules/calendar.module
index 145fc7de0..23b600793 100644
--- a/modules/calendar.module
+++ b/modules/calendar.module
@@ -1,7 +1,5 @@
<?php
-$module = array("block" => "calendar_block");
-
function calendar_block() {
global $date;
diff --git a/modules/comment.module b/modules/comment.module
index c8f14006f..9af8d04e8 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1,8 +1,5 @@
<?php
-$module = array("find" => "comment_find",
- "admin" => "comment_admin");
-
function comment_find($keys) {
global $user;
$find = array();
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index c8f14006f..9af8d04e8 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1,8 +1,5 @@
<?php
-$module = array("find" => "comment_find",
- "admin" => "comment_admin");
-
function comment_find($keys) {
global $user;
$find = array();
diff --git a/modules/cron.module b/modules/cron.module
index d34a2f291..97b59a10e 100644
--- a/modules/cron.module
+++ b/modules/cron.module
@@ -1,8 +1,5 @@
<?php
-$module = array("help" => "cron_help",
- "admin" => "cron_admin");
-
function cron_help() {
?>
<P>Cron (which stands for chronograph) is a periodic command scheduler: it executes commands at intervals specified in seconds. It can be used to control the execution of daily, weekly and monthly jobs (or anything with a period of <i>n</i> seconds). Automating tasks is one of the best ways to keep a system running smoothly, and if most of your administration does not require your direct involvement, cron is an ideal solution.</P>
@@ -18,9 +15,8 @@ function cron_save($edit) {
}
function cron_execute($name) {
- global $repository;
watchdog("message", "cron: executed '". $name ."_cron()'");
- $repository[$name]["cron"]();
+ module_invoke($name, "cron");
db_query("UPDATE crons SET timestamp = ". time() ." WHERE module = '$name'");
}
diff --git a/modules/cvs.module b/modules/cvs.module
index 701a377ee..71e7b5ce4 100644
--- a/modules/cvs.module
+++ b/modules/cvs.module
@@ -1,9 +1,5 @@
<?php
-$module = array("cron" => "cvs_cron",
- "conf" => "cvs_conf",
- "page" => "cvs_page");
-
function cvs_cron() {
$result = db_query("SELECT * FROM cvs WHERE status = '0' ORDER BY timestamp DESC LIMIT 50");
diff --git a/modules/diary.module b/modules/diary.module
index a3b757d79..ef7d81cca 100644
--- a/modules/diary.module
+++ b/modules/diary.module
@@ -1,15 +1,5 @@
<?php
-$module = array("find" => "diary_find",
- "help" => "diary_help",
- "menu" => "diary_menu",
- "page" => "diary_page",
- "admin" => "diary_admin",
- "block" => "diary_block",
- "export" => "diary_export");
-
-include_once "includes/common.inc";
-
function diary_find($keys) {
global $user;
$find = array();
diff --git a/modules/drupal.module b/modules/drupal.module
index 293c3a9bc..eb9d0bd92 100644
--- a/modules/drupal.module
+++ b/modules/drupal.module
@@ -1,7 +1,5 @@
<?php
-$module = array("page" => "drupal_page");
-
function drupal_page() {
global $theme, $user;
diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module
index 293c3a9bc..eb9d0bd92 100644
--- a/modules/drupal/drupal.module
+++ b/modules/drupal/drupal.module
@@ -1,7 +1,5 @@
<?php
-$module = array("page" => "drupal_page");
-
function drupal_page() {
global $theme, $user;
diff --git a/modules/forum.module b/modules/forum.module
index 0e7c6cce7..a414a47a0 100644
--- a/modules/forum.module
+++ b/modules/forum.module
@@ -1,8 +1,5 @@
<?php
-$module = array("page" => "forum_page",
- "admin" => "forum_admin");
-
$format = array(0 => HTML, 1 => PHP, 2 => text);
function forum_status() {
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index 0e7c6cce7..a414a47a0 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -1,8 +1,5 @@
<?php
-$module = array("page" => "forum_page",
- "admin" => "forum_admin");
-
$format = array(0 => HTML, 1 => PHP, 2 => text);
function forum_status() {
diff --git a/modules/headline.module b/modules/headline.module
index ac216c53c..91425e3fb 100644
--- a/modules/headline.module
+++ b/modules/headline.module
@@ -1,13 +1,5 @@
<?php
-$module = array("page" => "headline_page",
- "cron" => "headline_cron",
- "help" => "headline_help",
- "block" => "headline_block",
- "admin" => "headline_admin",
- "export" => "headline_export");
-
-include_once "includes/common.inc";
include_once "modules/backend.class";
function headline_blocks() {
@@ -151,8 +143,7 @@ function headline_admin_add() {
}
function headline_admin_rehash() {
- global $repository;
- module_rehash_blocks("headline", $repository["headline"]);
+ module_rehash_blocks("headline");
}
function headline_admin() {
diff --git a/modules/headlineRSS10.module b/modules/headlineRSS10.module
index f24b31e42..00940fa54 100644
--- a/modules/headlineRSS10.module
+++ b/modules/headlineRSS10.module
@@ -1,12 +1,5 @@
<?php
-// RSS 1.0 headline exporter (v0.1)
-//
-// Kristjan Jansen -- kika@sloleht.ee
-
-$module = array("export" => "headlineRSS10_export");
-
-include_once "includes/common.inc";
include_once "modules/backend.class";
function headlineRSS10_export($uri) {
diff --git a/modules/help.module b/modules/help.module
index 9aae72a3c..8d92d9611 100644
--- a/modules/help.module
+++ b/modules/help.module
@@ -1,11 +1,10 @@
<?php
-$module = array("admin" => "help_admin");
-
-function help_module($name, $module) {
- print "<H2><A NAME=\"$name\">". ucfirst($name) ." module</A></H2>";
- if ($module["help"]) $module["help"]();
- else print "<I>No documentation available for module '$name'.</I>";
+function help_module($name) {
+ if (module_hook($name, "help")) {
+ print "<H2><A NAME=\"$name\">". ucfirst($name) ." module</A></H2>";
+ print module_invoke($name, "help");
+ }
}
function help_admin() {
diff --git a/modules/help/help.module b/modules/help/help.module
index 9aae72a3c..8d92d9611 100644
--- a/modules/help/help.module
+++ b/modules/help/help.module
@@ -1,11 +1,10 @@
<?php
-$module = array("admin" => "help_admin");
-
-function help_module($name, $module) {
- print "<H2><A NAME=\"$name\">". ucfirst($name) ." module</A></H2>";
- if ($module["help"]) $module["help"]();
- else print "<I>No documentation available for module '$name'.</I>";
+function help_module($name) {
+ if (module_hook($name, "help")) {
+ print "<H2><A NAME=\"$name\">". ucfirst($name) ." module</A></H2>";
+ print module_invoke($name, "help");
+ }
}
function help_admin() {
diff --git a/modules/locale.module b/modules/locale.module
index 1ddde9a7c..deb802b29 100644
--- a/modules/locale.module
+++ b/modules/locale.module
@@ -1,9 +1,5 @@
<?php
-$module = array("help" => "locale_help",
- "admin" => "locale_admin",
- "locale" => "locale_locale");
-
function locale_help() {
?>
<P>Normally programs are written and documented in English, and use English to interact with users. This is true for a great deal of websites. However, most people are less comfortable with English than with their own native language, and would prefer to use their mother tongue as much as possible. Many people love see their website showing a lot less of English, and far more of their own language.</P>
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 1ddde9a7c..deb802b29 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -1,9 +1,5 @@
<?php
-$module = array("help" => "locale_help",
- "admin" => "locale_admin",
- "locale" => "locale_locale");
-
function locale_help() {
?>
<P>Normally programs are written and documented in English, and use English to interact with users. This is true for a great deal of websites. However, most people are less comfortable with English than with their own native language, and would prefer to use their mother tongue as much as possible. Many people love see their website showing a lot less of English, and far more of their own language.</P>
diff --git a/modules/moderate.module b/modules/moderate.module
index 5ce6d6d3a..821a588ca 100644
--- a/modules/moderate.module
+++ b/modules/moderate.module
@@ -1,7 +1,5 @@
<?php
-$module = array("admin" => "moderate_admin");
-
function moderate_comment_access($cid) {
global $user;
return db_fetch_object(db_query("SELECT n.moderate FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.cid = '". check_input($cid) ."' AND n.moderate LIKE '%$user->userid%'"));
@@ -30,29 +28,25 @@ function moderate_overview($query = array()) {
return $output;
}
-function moderate_node_edit($id) {
+function moderate_node($edit, $name) {
global $user;
- $node = node_get_array("nid", $id);
+ $node = node_get_array("nid", $edit[nid]);
if ($node && strstr($node[moderate], $user->userid)) {
- return node_form($node);
+ $edit[type] = $node[type];
+ return node_invoke($edit, $name);
}
else {
- return "access denied";
+ return status(t("access denied"));
}
}
-function moderate_node_save($edit) {
- global $user;
+function moderate_node_edit($edit) {
+ return moderate_node($edit, "form");
+}
- $node = node_get_array("nid", $edit[nid]);
- if ($node && strstr($node[moderate], $user->userid)) {
- $edit[type] = $node[type];
- return node_invoke($edit, "save");
- }
- else {
- return "access denied";
- }
+function moderate_node_save($edit) {
+ return moderate_node($edit, "save");
}
function moderate_comment_edit($id) {
@@ -92,7 +86,10 @@ function moderate_admin() {
default:
switch ($op) {
case "edit":
- print moderate_node_edit($id);
+ print moderate_node_edit(node_get_array("nid", $id));
+ break;
+ case t("Preview"):
+ print moderate_node_edit($edit);
break;
case t("Submit"):
print status(moderate_node_save($edit));
diff --git a/modules/module.module b/modules/module.module
index e4140ce22..f11832770 100644
--- a/modules/module.module
+++ b/modules/module.module
@@ -1,8 +1,5 @@
<?php
-$module = array("help" => "module_help",
- "admin" => "module_admin");
-
function module_help() {
?>
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.
@@ -10,34 +7,24 @@ function module_help() {
}
function module_admin_rehash() {
- global $repository;
-
$result = db_query("SELECT * FROM modules");
while ($module = db_fetch_object($result)) {
module_rehash($module->name);
}
- foreach ($repository as $name=>$module) {
+ foreach (module_list() as $name) {
module_rehash($name);
}
}
-function module_admin_display() {
- global $output;
-
- function module_row($name, $module) {
- global $output;
-
- $view = ($module["page"]) ? "<A HREF=\"module.php?mod=$name\">view</A>" : "&nbsp;";
- $admin = ($module["admin"]) ? "<A HREF=\"admin.php?mod=$name\">admin</A>" : "&nbsp;";
- $output .= " <TR><TD>$name</TD><TD>$view</TD><TD>$admin</TD><TD><A HREF=\"admin.php?mod=module&op=rehash&name=$name\">rehash</A></TD></TR>\n";
- }
-
+function module_admin_overview() {
$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";
- module_iterate("module_row");
+ foreach (module_list() as $name) {
+ $output .= " <TR><TD>$name</TD><TD>". (module_hook($name, "page") ? "<A HREF=\"module.php?mod=$name\">view</A>" : "&nbsp;") ."</TD><TD>". (module_hook($name, "admin") ? "<A HREF=\"admin.php?mod=$name\">admin</A>" : "&nbsp;") ."</TD><TD><A HREF=\"admin.php?mod=module&op=rehash&name=$name\">rehash</A></TD></TR>\n";
+ }
$output .= "</TABLE>\n";
$output .= "<INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Rehash modules\">\n";
@@ -56,14 +43,14 @@ function module_admin() {
break;
case "rehash":
module_rehash($name);
- module_admin_display();
+ module_admin_overview();
break;
case "Rehash modules":
module_admin_rehash();
- module_admin_display();
+ module_admin_overview();
break;
default:
- module_admin_display();
+ module_admin_overview();
}
}
diff --git a/modules/node.module b/modules/node.module
index bdc4b30d6..cff8e636d 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1,6 +1,15 @@
<?php
-$module = array("admin" => "node_admin");
+class Node {
+ function Node($node) {
+ global $user;
+ $this->userid = $node[userid] ? $node[userid] : $user->userid;
+ $this->title = $node[title];
+ $this->timestamp = $node[timestamp] ? $node[timestamp] : time();
+ $this->cid = $node[cid];
+ $this->tid = $node[tid];
+ }
+}
function node_overview($query = array()) {
global $user;
diff --git a/modules/node/node.module b/modules/node/node.module
index bdc4b30d6..cff8e636d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1,6 +1,15 @@
<?php
-$module = array("admin" => "node_admin");
+class Node {
+ function Node($node) {
+ global $user;
+ $this->userid = $node[userid] ? $node[userid] : $user->userid;
+ $this->title = $node[title];
+ $this->timestamp = $node[timestamp] ? $node[timestamp] : time();
+ $this->cid = $node[cid];
+ $this->tid = $node[tid];
+ }
+}
function node_overview($query = array()) {
global $user;
diff --git a/modules/page.module b/modules/page.module
index 65379b729..03ca6165f 100644
--- a/modules/page.module
+++ b/modules/page.module
@@ -1,7 +1,5 @@
<?php
-$module = array("admin" => "page_admin");
-
$format = array(0 => HTML, 1 => PHP, 2 => text);
function page_view($node, $main = 0) {
diff --git a/modules/page/page.module b/modules/page/page.module
index 65379b729..03ca6165f 100644
--- a/modules/page/page.module
+++ b/modules/page/page.module
@@ -1,7 +1,5 @@
<?php
-$module = array("admin" => "page_admin");
-
$format = array(0 => HTML, 1 => PHP, 2 => text);
function page_view($node, $main = 0) {
diff --git a/modules/queue.module b/modules/queue.module
index 31087d5f3..69c738784 100644
--- a/modules/queue.module
+++ b/modules/queue.module
@@ -10,9 +10,6 @@ $queue_votes = array("neutral (+0)" => "+ 0",
"post it (+1)" => "+ 1",
"dump it (-1)" => "- 1");
-$module = array("menu" => "queue_menu",
- "page" => "queue_page");
-
function queue_menu() {
return array("<A HREF=\"module.php?mod=queue\">". t("moderation queue") ."</A> (<FONT COLOR=\"red\">". queue_count() ."</FONT>)");
}
diff --git a/modules/rating.module b/modules/rating.module
index c5e665592..cc6b02caf 100644
--- a/modules/rating.module
+++ b/modules/rating.module
@@ -1,10 +1,5 @@
<?php
-$module = array("cron" => "rating_cron",
- "help" => "rating_help",
- "page" => "rating_page",
- "block" => "rating_block");
-
function rating_cron() {
$r1 = db_query("SELECT id FROM users ORDER BY rating DESC");
while ($account = db_fetch_object($r1)) {
diff --git a/modules/settings.module b/modules/settings.module
index 6952bbae6..acb5af2cd 100644
--- a/modules/settings.module
+++ b/modules/settings.module
@@ -1,7 +1,5 @@
<?php
-$module = array("admin" => "settings_admin");
-
function settings_conf() {
global $conf, $cmodes, $corder, $themes;
@@ -66,12 +64,12 @@ function settings_default() {
return "all settings have been reset.";
}
-function settings_module($name, $module) {
+function settings_module($name) {
global $settings;
- if ($module["conf"]) {
+ if (module_hook($name, "conf")) {
$settings .= "<H3>". ucfirst($name) ." module</H3>\n";
- $settings .= $module["conf"]();
+ $settings .= module_invoke($name, "conf");
$settings .= "<HR>\n";
}
}
diff --git a/modules/story.module b/modules/story.module
index c2dff4709..58469aa12 100644
--- a/modules/story.module
+++ b/modules/story.module
@@ -1,22 +1,10 @@
<?php
-$module = array("help" => "story_help",
- "find" => "story_find",
- "user" => "story_user",
- "queue" => "story_queue",
- "admin" => "story_admin",
- "block" => "story_block");
-
class Story {
function Story($story) {
- global $user;
- $this->userid = $story[userid] ? $story[userid] : $user->userid;
- $this->title = $story[title];
+ $this = new Node($story);
$this->abstract = $story[abstract];
$this->body = $story[body];
- $this->timestamp = $story[timestamp] ? $story[timestamp] : time();
- $this->cid = $story[cid];
- $this->tid = $story[tid];
}
}
diff --git a/modules/story/story.module b/modules/story/story.module
index c2dff4709..58469aa12 100644
--- a/modules/story/story.module
+++ b/modules/story/story.module
@@ -1,22 +1,10 @@
<?php
-$module = array("help" => "story_help",
- "find" => "story_find",
- "user" => "story_user",
- "queue" => "story_queue",
- "admin" => "story_admin",
- "block" => "story_block");
-
class Story {
function Story($story) {
- global $user;
- $this->userid = $story[userid] ? $story[userid] : $user->userid;
- $this->title = $story[title];
+ $this = new Node($story);
$this->abstract = $story[abstract];
$this->body = $story[body];
- $this->timestamp = $story[timestamp] ? $story[timestamp] : time();
- $this->cid = $story[cid];
- $this->tid = $story[tid];
}
}
diff --git a/modules/structure.module b/modules/structure.module
index 2f5138431..f51bc7f5e 100644
--- a/modules/structure.module
+++ b/modules/structure.module
@@ -1,10 +1,8 @@
<?php
-$module = array("admin" => "structure_admin");
-
-function content_types($name, $module) {
+function content_types($name) {
global $types;
- if ($module[type]) $types[$name] = $name;
+ if (function_exists($name ."_status")) $types[$name] = $name;
}
function category_form($edit = array()) {
diff --git a/modules/watchdog.module b/modules/watchdog.module
index 23e803e62..a3d04b36d 100644
--- a/modules/watchdog.module
+++ b/modules/watchdog.module
@@ -1,9 +1,5 @@
<?php
-$module = array("help" => "watchdog_help",
- "cron" => "watchdog_cron",
- "admin" => "watchdog_admin");
-
function watchdog_help() {
?>
<P>The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.</P>
diff --git a/modules/watchdog/watchdog.module b/modules/watchdog/watchdog.module
index 23e803e62..a3d04b36d 100644
--- a/modules/watchdog/watchdog.module
+++ b/modules/watchdog/watchdog.module
@@ -1,9 +1,5 @@
<?php
-$module = array("help" => "watchdog_help",
- "cron" => "watchdog_cron",
- "admin" => "watchdog_admin");
-
function watchdog_help() {
?>
<P>The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.</P>