51ff3226 |
1 | <?php |
2 | |
3 | function smarty_function_get_poll($params,&$smarty) { |
4 | global $db,$node; |
5 | if (!is_numeric($params['poll_id'])) $poll_id=$node['node_id']; |
6 | else $poll_id=$params['poll_id']; |
7 | $user_id=$_SESSION['user_id']; |
8 | $node_vector=$node['node_vector']; |
9 | $set=$db->query("select nodes.*,node_access.node_permission from nodes left join node_access on (nodes.node_id=node_access.node_id and node_access.user_id='$user_id') where node_vector='$poll_id' and template_id='1549834' order by node_id desc limit 1"); |
10 | $set->next(); |
11 | $option_array=unserialize($set->getString('node_content')); |
12 | $permission=$set->getString('node_permission'); |
13 | |
14 | if ($permission=='ban') $voted='yes'; |
15 | else $voted='no'; |
16 | |
17 | $poll=Array("voted"=>$voted,"node_id"=>$set->getString('node_id'),"question"=>$set->getString('node_name'),"total"=>$set->getString('node_views'),"options"=>$option_array); |
18 | $smarty->assign('get_poll',$poll); |
19 | print_r($poll); |
20 | } |
21 | ?> |