Commit | Line | Data |
---|---|---|
51ff3226 | 1 | <?php |
2 | function delete() { | |
3 | global $node,$db,$error; | |
4 | $nodes=$_POST['node_chosen']; | |
5 | ||
6 | if (empty($nodes)) { | |
7 | $nodes[]=$node['node_id']; | |
8 | } | |
9 | ||
10 | foreach ($nodes as $chosen) { | |
11 | if (empty($chosen)) { | |
12 | $error="just a little bug"; | |
13 | return false; | |
14 | } | |
15 | ||
16 | $delete_node=nodes::getNodeById($chosen); | |
17 | $vector=$delete_node['node_vector']; | |
18 | ||
19 | ||
20 | if ($delete_node['node_creator']==$_SESSION['user_id'] || isHierarch($delete_node)) { | |
21 | $q="insert into tiamat (node_id,node_name,node_parent,node_thread_vector,node_type,node_external_access,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,node_destructor,node_content,node_descendant_count,lastdescendant_created,template_id) select nodes.node_id,node_name,node_parent,node_vector,node_type,node_external_access,node_system_access,node_children_count,node_creator,node_created,lastchild_created,k,node_views,'$user_id',node_content,node_descendant_count,lastdescendant_created,template_id from nodes left join node_content on nodes.node_id=node_content.node_id where nodes.node_id='$chosen'"; | |
22 | echo $q; | |
23 | // $db->query($q); | |
24 | $q="delete from nodes where node_id='$chosen'"; | |
25 | echo $q; | |
26 | // $db->query($q); | |
27 | $q="delete from node_access where node_id='$chosen'"; | |
28 | echo $q; | |
29 | // $db->query($q); | |
30 | echo $q; | |
31 | $q="update node_access set node_user_subchild_count=node_user_subchild_count-1 where node_id='$node_parent' and last_visit<'$created'"; | |
32 | // $db->query($q); | |
33 | echo $q; | |
34 | if (!empty($vector)) { | |
35 | $q="update nodes set node_vector=replace(node_vector,'$vector','') where node_vector like '$vector%'"; | |
36 | echo $q; | |
37 | // $db->query($q); | |
38 | } | |
39 | ||
40 | } | |
41 | ||
42 | } | |
43 | ||
44 | } | |
45 | ?> |