diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-10-26 15:17:26 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-10-26 15:17:26 +0000 |
commit | 8d103a08984ac2de72d756eb5c5c8d23061ab028 (patch) | |
tree | e8cb8b9b2f071a9b7bd2e222d8183e5c27ad6683 /modules/poll.module | |
parent | 2ec14f35ac7d5600e6d03b5cf79f717f43d1cfab (diff) | |
download | brdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.gz brdo-8d103a08984ac2de72d756eb5c5c8d23061ab028.tar.bz2 |
- Committed Marco's block rewrite:
+ Blocks are not longer called if not rendered: major performance
improvement.
+ Fixed some bugs (preview option was broken, path option was broken).
+ Removed "ascii"-type blocks.
+ Added permission to for "PHP blocks"
+ ...
NOTES:
+ You'll want to run "update.php":
ALTER TABLE blocks DROP remove;
ALTER TABLE blocks DROP name;
+ You'll want to update your custom modules as well as the modules in
the contrib repository. Block function should now read:
function *_block($op = "list", $delta = 0) {
if ($op == "list") {
return array of block infos
}
else {
return subject and content of $delta block
}
}
Diffstat (limited to 'modules/poll.module')
-rw-r--r-- | modules/poll.module | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/modules/poll.module b/modules/poll.module index 7c22e041c..d2ac76cbe 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -42,19 +42,24 @@ function poll_access($op, $node) { } } -function poll_block() { - $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type='poll' AND status='1' AND moderate='0'")); - if ($timestamp) { - $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); - if ($poll->nid) { - // Poll_view dumps the output into $poll->body - poll_view($poll, 1, 1); +function poll_block($op = "list", $delta = 0) { + if ($op == "list") { + $blocks[0]["info"] = t("Most recent poll"); + return $blocks; + } + else { + $timestamp = db_result(db_query("SELECT MAX(created) FROM node WHERE type = 'poll' AND status = '1' AND moderate = '0'")); + if ($timestamp) { + $poll = node_load(array("type" => "poll", "created" => $timestamp, "moderate" => "0", "status" => "1")); + if ($poll->nid) { + // Poll_view dumps the output into $poll->body + poll_view($poll, 1, 1); + } } + $block["subject"] = t("Latest poll: %t", array("%t" => $poll->title)); + $block["content"] = $poll->body; + return $block; } - $blocks[0][subject] = t("Latest poll: %t", array("%t" => $poll->title)); - $blocks[0][content] = $poll->body; - $blocks[0][info] = t("Most recent poll"); - return $blocks; } function poll_cron() { |