From: Daniel Hromada Date: Sun, 30 Jan 2011 22:14:42 +0000 (+0100) Subject: since event PUTting a node is now being considered as "adding a child" to a nodeshell... X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=0fd4a30fa839ce315009ad2c9ddae09198e40967;p=mirrors%2FKyberia-bloodline.git since event PUTting a node is now being considered as "adding a child" to a nodeshell (incrementing children_count), destroy_synapse should decrement it in order to keep data consistent (he he he :) --- diff --git a/wwwroot/inc/eventz/destroy_synapse.inc b/wwwroot/inc/eventz/destroy_synapse.inc index cf752ba..3889c00 100644 --- a/wwwroot/inc/eventz/destroy_synapse.inc +++ b/wwwroot/inc/eventz/destroy_synapse.inc @@ -8,10 +8,22 @@ $user_id=$_SESSION['user_id']; $node_id=$node['node_id']; if (is_array($_POST['node_chosen'])) { $srcs=$_POST['node_chosen']; -}else{ global $error;$error="Ak chces nejaky ten put zmazat musis si najskor nejaky ten put vybrat.Logicke nie?:-)";return false;} +}else{ + $error="Ak chces nejaky ten put zmazat musis si najskor nejaky ten put vybrat.Logicke nie?:-)"; + return false; +} +if (!is_numeric($node_id)) { + $error=$error_messages['NUMERIC_NOT_NUMERIC']; + return false; +} foreach ($srcs as $chosen) { + +if (!is_numeric($chosen)) { + $error=$error_messages['NUMERIC_NOT_NUMERIC']; +} + $kset=$db->query("select synapse_creator from neurons where dst='$node_id' and src='$chosen'"); $kset->next();$synapse_creator=$kset->getString('synapse_creator'); @@ -20,14 +32,10 @@ $kset->next();$node_creator=$kset->getString('node_creator'); $dnode=nodes::getNodeById($node_id,$_SESSION['user_id']); if ($synapse_creator == $user_id || $node_creator == $user_id || permissions::isHierarch($dnode)) { - -$q="update neurons set dst_vector='',link='soft',synapse_creator='$user_id' where dst='$node_id' and src='$chosen' and link='hard'"; -if (is_numeric($node_id) && is_numeric($chosen)) { -$db->update($q); -//echo "permission check OK."; -//echo $q; -} -}else{ + $q="update neurons set dst_vector='',link='soft',synapse_creator='$user_id' where dst='$node_id' and src='$chosen' and link='hard'"; + $db->update($q); + $db->update("update nodes set node_children_count=node_children_count-1 where node_id='$node_id'"); +} else{ global $error; $error="Nemas pravomoci na vykonanie daneho skutku...."; return false;