2 function destroy_synapse() {
3 global $error_messages,$db,$node,$error;
5 // core idea an programming by id Redtime, debug by DarkAural
7 $user_id=$_SESSION['user_id'];
8 $node_id=$node['node_id'];
9 if (is_array($_POST['node_chosen'])) {
10 $srcs=$_POST['node_chosen'];
12 $error="Ak chces nejaky ten put zmazat musis si najskor nejaky ten put vybrat.Logicke nie?:-)";
16 if (!is_numeric($node_id)) {
17 $error=$error_messages['NUMERIC_NOT_NUMERIC'];
21 foreach ($srcs as $chosen) {
23 if (!is_numeric($chosen)) {
24 $error=$error_messages['NUMERIC_NOT_NUMERIC'];
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');
30 $kset=$db->query("select node_creator from nodes where node_id='$chosen'");
31 $kset->next();$node_creator=$kset->getString('node_creator');
33 $dnode=nodes::getNodeById($node_id,$_SESSION['user_id']);
34 if ($synapse_creator == $user_id || $node_creator == $user_id || permissions::isHierarch($dnode)) {
35 $q="update neurons set dst_vector='',link='soft',synapse_creator='$user_id' where dst='$node_id' and src='$chosen' and link='hard'";
37 $db->update("update nodes set node_children_count=node_children_count-1 where node_id='$node_id'");
40 $error="Nemas pravomoci na vykonanie daneho skutku....";