summaryrefslogtreecommitdiff
path: root/modules/poll.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/poll.module')
-rw-r--r--modules/poll.module53
1 files changed, 29 insertions, 24 deletions
diff --git a/modules/poll.module b/modules/poll.module
index e39735011..2fe6207b8 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -195,33 +195,38 @@ function poll_link($type, $node = 0, $main) {
/**
* Implementation of hook_menu().
*/
-function poll_menu() {
+function poll_menu($may_cache) {
$items = array();
- $items[] = array('path' => 'node/add/poll', 'title' => t('poll'),
- 'access' => user_access('create polls'));
- $items[] = array('path' => 'poll', 'title' => t('polls'),
- 'callback' => 'poll_page',
- 'access' => user_access('access content'),
- 'type' => MENU_SUGGESTED_ITEM);
-
- $items[] = array('path' => 'poll/vote',
- 'title' => t('vote'),
- 'callback' => 'poll_vote',
- 'access' => user_access('vote on polls'),
- 'type' => MENU_CALLBACK);
-
- if (arg(0) == 'node' && is_numeric(arg(1))) {
- $node = node_load(array('nid' => arg(1)));
-
- if ($node->type == 'poll' && $node->allowvotes) {
- $items[] = array('path' => 'node/'. arg(1) .'/results',
- 'title' => t('results'),
- 'callback' => 'poll_results',
- 'access' => user_access('access content'),
- 'weight' => 3,
- 'type' => MENU_LOCAL_TASK);
+
+ if ($may_cache) {
+ $items[] = array('path' => 'node/add/poll', 'title' => t('poll'),
+ 'access' => user_access('create polls'));
+ $items[] = array('path' => 'poll', 'title' => t('polls'),
+ 'callback' => 'poll_page',
+ 'access' => user_access('access content'),
+ 'type' => MENU_SUGGESTED_ITEM);
+
+ $items[] = array('path' => 'poll/vote',
+ 'title' => t('vote'),
+ 'callback' => 'poll_vote',
+ 'access' => user_access('vote on polls'),
+ 'type' => MENU_CALLBACK);
+ }
+ else {
+ if (arg(0) == 'node' && is_numeric(arg(1))) {
+ $node = node_load(array('nid' => arg(1)));
+
+ if ($node->type == 'poll' && $node->allowvotes) {
+ $items[] = array('path' => 'node/'. arg(1) .'/results',
+ 'title' => t('results'),
+ 'callback' => 'poll_results',
+ 'access' => user_access('access content'),
+ 'weight' => 3,
+ 'type' => MENU_LOCAL_TASK);
+ }
}
}
+
return $items;
}