@@ 198-222 (lines=25) @@ | ||
195 | $voted_id = $this->request->variable('vote_id', array('' => 0)); |
|
196 | ||
197 | $cur_voted_id = array(); |
|
198 | if ($this->user->data['is_registered']) |
|
199 | { |
|
200 | $sql = 'SELECT poll_option_id |
|
201 | FROM ' . POLL_VOTES_TABLE . ' |
|
202 | WHERE topic_id = ' . (int) $up_topic_id . ' |
|
203 | AND vote_user_id = ' . (int) $this->user->data['user_id']; |
|
204 | $result = $this->db->sql_query($sql); |
|
205 | ||
206 | while ($row = $this->db->sql_fetchrow($result)) |
|
207 | { |
|
208 | $cur_voted_id[] = $row['poll_option_id']; |
|
209 | } |
|
210 | $this->db->sql_freeresult($result); |
|
211 | } |
|
212 | else |
|
213 | { |
|
214 | // Cookie based guest tracking ... I don't like this but hum ho |
|
215 | // it's oft requested. This relies on "nice" users who don't feel |
|
216 | // the need to delete cookies to mess with results. |
|
217 | if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $up_topic_id, \phpbb\request\request_interface::COOKIE)) |
|
218 | { |
|
219 | $cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $up_topic_id, '', true, \phpbb\request\request_interface::COOKIE)); |
|
220 | $cur_voted_id = array_map('intval', $cur_voted_id); |
|
221 | } |
|
222 | } |
|
223 | ||
224 | $sql = 'SELECT t.poll_length, t.poll_start, t.poll_vote_change, t.topic_status, f.forum_status, t.poll_max_options |
|
225 | FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f |
|
@@ 393-417 (lines=25) @@ | ||
390 | $cur_voted_id = array(); |
|
391 | if ($this->config['board3_poll_allow_vote_' . $module_id]) |
|
392 | { |
|
393 | if ($this->user->data['is_registered']) |
|
394 | { |
|
395 | $vote_sql = 'SELECT poll_option_id |
|
396 | FROM ' . POLL_VOTES_TABLE . ' |
|
397 | WHERE topic_id = ' . (int) $topic_id . ' |
|
398 | AND vote_user_id = ' . (int) $this->user->data['user_id']; |
|
399 | $vote_result = $this->db->sql_query($vote_sql); |
|
400 | ||
401 | while ($row = $this->db->sql_fetchrow($vote_result)) |
|
402 | { |
|
403 | $cur_voted_id[] = $row['poll_option_id']; |
|
404 | } |
|
405 | $this->db->sql_freeresult($vote_result); |
|
406 | } |
|
407 | else |
|
408 | { |
|
409 | // Cookie based guest tracking ... I don't like this but hum ho |
|
410 | // it's oft requested. This relies on "nice" users who don't feel |
|
411 | // the need to delete cookies to mess with results. |
|
412 | if ($this->request->is_set($this->config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE)) |
|
413 | { |
|
414 | $cur_voted_id = explode(',', $this->request->variable($this->config['cookie_name'] . '_poll_' . $topic_id, 0, false, true)); |
|
415 | $cur_voted_id = array_map('intval', $cur_voted_id); |
|
416 | } |
|
417 | } |
|
418 | ||
419 | $s_can_vote = (((!sizeof($cur_voted_id) && $this->auth->acl_get('f_vote', $forum_id)) || |
|
420 | ($this->auth->acl_get('f_votechg', $forum_id) && $data['poll_vote_change'])) && |