summaryrefslogtreecommitdiff
path: root/modules/poll
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-08-30 17:01:42 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-08-30 17:01:42 +0000
commitc84d7a50711c11e62f20f590457a7b82c7134ced (patch)
tree6bc9a035a29603589e192ef37771897f256fe212 /modules/poll
parent614f685bdcbca1798147edefb5b37356b7412478 (diff)
downloadbrdo-c84d7a50711c11e62f20f590457a7b82c7134ced.tar.gz
brdo-c84d7a50711c11e62f20f590457a7b82c7134ced.tar.bz2
#170677 by chx: roll back poll data loading to the load operation
Diffstat (limited to 'modules/poll')
-rw-r--r--modules/poll/poll.module37
1 files changed, 18 insertions, 19 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 64f83f0b3..8c6f60319 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -299,6 +299,24 @@ function poll_load($node) {
while ($choice = db_fetch_array($result)) {
$poll->choice[$choice['chorder']] = $choice;
}
+
+ // Determine whether or not this user is allowed to vote
+ $poll->allowvotes = FALSE;
+ if (user_access('vote on polls') && $poll->active) {
+ if ($user->uid) {
+ $result = db_fetch_object(db_query('SELECT chorder FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
+ }
+ else {
+ $result = db_fetch_object(db_query("SELECT chorder FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
+ }
+ if (isset($result->chorder)) {
+ $poll->vote = $result->chorder;
+ }
+ else {
+ $poll->vote = -1;
+ $poll->allowvotes = TRUE;
+ }
+ }
return $poll;
}
@@ -364,25 +382,6 @@ function poll_view($node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
global $user;
$output = '';
- // Determine whether or not this user is allowed to vote
- $poll->allowvotes = FALSE;
- if (user_access('vote on polls') && $poll->active) {
- if ($user->uid) {
- $result = db_fetch_object(db_query('SELECT chorder FROM {poll_votes} WHERE nid = %d AND uid = %d', $node->nid, $user->uid));
- }
- else {
- $result = db_fetch_object(db_query("SELECT chorder FROM {poll_votes} WHERE nid = %d AND hostname = '%s'", $node->nid, ip_address()));
- }
- if (isset($result->chorder)) {
- $poll->vote = $result->chorder;
- }
- else {
- $poll->vote = -1;
- $poll->allowvotes = TRUE;
- }
- }
-
-
// Special display for side-block
if ($block) {
// No 'read more' link