get_image_link fix
[mirrors/Kyberia-bloodline.git] / wwwroot / inc / eventz / destroy_synapse.inc
CommitLineData
9b80aa4a 1<?php
51ff3226 2function destroy_synapse() {
3global $error_messages,$db,$node,$error;
4
5// core idea an programming by id Redtime, debug by DarkAural
6
7$user_id=$_SESSION['user_id'];
8$node_id=$node['node_id'];
9if (is_array($_POST['node_chosen'])) {
10$srcs=$_POST['node_chosen'];
0fd4a30f
DH
11}else{
12 $error="Ak chces nejaky ten put zmazat musis si najskor nejaky ten put vybrat.Logicke nie?:-)";
13 return false;
14}
51ff3226 15
0fd4a30f
DH
16if (!is_numeric($node_id)) {
17 $error=$error_messages['NUMERIC_NOT_NUMERIC'];
18 return false;
19}
51ff3226 20
21foreach ($srcs as $chosen) {
0fd4a30f
DH
22
23if (!is_numeric($chosen)) {
24 $error=$error_messages['NUMERIC_NOT_NUMERIC'];
25}
26
51ff3226 27$kset=$db->query("select synapse_creator from neurons where dst='$node_id' and src='$chosen'");
28$kset->next();$synapse_creator=$kset->getString('synapse_creator');
29
30$kset=$db->query("select node_creator from nodes where node_id='$chosen'");
31$kset->next();$node_creator=$kset->getString('node_creator');
32
33$dnode=nodes::getNodeById($node_id,$_SESSION['user_id']);
34if ($synapse_creator == $user_id || $node_creator == $user_id || permissions::isHierarch($dnode)) {
0fd4a30f
DH
35 $q="update neurons set dst_vector='',link='soft',synapse_creator='$user_id' where dst='$node_id' and src='$chosen' and link='hard'";
36 $db->update($q);
37 $db->update("update nodes set node_children_count=node_children_count-1 where node_id='$node_id'");
38} else{
ac3bdc72 39 global $error;
40 $error="Nemas pravomoci na vykonanie daneho skutku....";
41 return false;
51ff3226 42}
43
51ff3226 44}
45
46return true;
47
ac3bdc72 48}?>
This page took 0.980866 seconds and 4 git commands to generate.