Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_polls.php
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 $set=$db->query("select nodes.*,node_content.node_content,node_access.node_permission from nodes left join node_content on node_content.node_id=nodes.node_id left join node_access on (nodes.node_id=node_access.node_id and node_access.user_id='$user_id') where node_parent='$poll_id' and node_type='11' order by node_id desc limit 1");
9 $set->next();
10 $option_array=unserialize($set->getString('node_content'));
11 $permission=$set->getString('node_permission');
12
13 if ($permission=='ban') $voted='yes';
14 else $voted='no';
15
16 $poll=Array("voted"=>$voted,"node_id"=>$set->getString('node_id'),"question"=>$set->getString('node_name'),"total"=>$set->getString('node_views'),"options"=>$option_array);
17 $smarty->assign('get_poll',$poll);
18 print_r($poll);
19 }
20 ?>
This page took 0.568495 seconds and 4 git commands to generate.