Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / smarty / node_methodz / function.get_polls.php
diff --git a/inc/smarty/node_methodz/function.get_polls.php b/inc/smarty/node_methodz/function.get_polls.php
new file mode 100644 (file)
index 0000000..b54fb4c
--- /dev/null
@@ -0,0 +1,20 @@
+<?php
+
+       function smarty_function_get_poll($params,&$smarty) {
+               global $db,$node;
+               if (!is_numeric($params['poll_id'])) $poll_id=$node['node_id'];
+               else $poll_id=$params['poll_id'];
+               $user_id=$_SESSION['user_id'];
+               $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");
+               $set->next();
+               $option_array=unserialize($set->getString('node_content'));
+               $permission=$set->getString('node_permission');
+
+               if ($permission=='ban') $voted='yes';
+               else $voted='no';
+
+               $poll=Array("voted"=>$voted,"node_id"=>$set->getString('node_id'),"question"=>$set->getString('node_name'),"total"=>$set->getString('node_views'),"options"=>$option_array);
+               $smarty->assign('get_poll',$poll);
+               print_r($poll);
+}
+?>
\ No newline at end of file
This page took 0.100913 seconds and 4 git commands to generate.