Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / eventz / configure_poll.inc
1 <?php
2 /* This program is free software. It comes without any warranty, to
3 * the extent permitted by applicable law. You can redistribute it
4 * and/or modify it under the terms of the Do What The Fuck You Want
5 * To Public License, Version 2, as published by Sam Hocevar. See
6 * http://sam.zoy.org/wtfpl/COPYING for more details. */
7
8
9 function configure_poll() {
10 //poll is special node with serialized option.text and option.number array in node_content
11
12 global $db,$node;
13 $user_id=$_SESSION['user_id'];
14 if ($node['node_creator']==$user_id || $node['node_permission']=='master') {
15
16 $options=explode(";",$_POST['options']);
17 if (!Is_array($options)) {
18 $error="ain't any optionz for da poll h3r3 mista'";
19 return false;
20 }
21 foreach ($options as $option) {
22 $optionz[]=array("text"=>nodes::processContent($option),"number"=>"0");
23 }
24
25 $optionz=serialize($optionz);
26
27 $q="insert into nodes set
28 node_name='".$_POST['question']."',node_parent='".$node['node_id']."',
29 node_vector='".$node['node_vector'].";".$node['node_id']."'
30 ,node_system_access='public',node_external_access='".$node['node_external_access']."',
31 node_creator='$user_id',node_type=11,node_views=0";
32
33 $db->query($q);
34 $id=$db->getLastInsertId();
35 $db->query("insert into node_content set node_id='$id',node_content='$optionz'");
36 log::log('add poll',$node['node_id'],'ok',$id);
37
38
39 }
40
41 else {
42 log::log('add poll',$node['node_id'],'failed','permissions');
43 }
44
45 }
46
47 ?>
This page took 0.269415 seconds and 4 git commands to generate.