X-Git-Url: http://git.harvie.cz/?a=blobdiff_plain;f=wwwroot%2Fbackend%2Fmysql%2Fbackend.inc;h=7b6537221a32c7fd731c9cc44d16163084aa2286;hb=fba1bac4c86998039580413bc2dab4eeadfc15a7;hp=f8cd6a3fec998f83318162a8ee967ecc58dc1e51;hpb=47ef41dd27796b45028923424d4cfb8aa4a06ef5;p=mirrors%2FKyberia-bloodline.git diff --git a/wwwroot/backend/mysql/backend.inc b/wwwroot/backend/mysql/backend.inc index f8cd6a3..7b65372 100644 --- a/wwwroot/backend/mysql/backend.inc +++ b/wwwroot/backend/mysql/backend.inc @@ -307,20 +307,20 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit"; // Simple internal function to set node parrent -function setParent($params) { +function setParent($node_id,$parent_id) { global $db,$node,$error,$error_messages; - $parent_id=$params['node_parent']; - $node_id=$params['node_id']; if (!is_numeric($parent_id)) { return false; } - $q="select node_vector from nodes where node_id='$parent_id'"; - $parent_vector=$db->query($q); - $new_vector=$parent_vector.str_pad($node_id,VECTOR_CHARS,"0",STR_PAD_LEFT); - $q="update nodes set node_parent='$parent_id',node_vector='".$new_vector." - ' where node_id='$node_id'"; + $q="select node_vector from nodes where node_id='$parent_id'"; + $set=$db->query($q); + $set->next(); + $parent_vector=$set->getString('node_vector'); + $new_vector=$parent_vector.str_pad($node_id,VECTOR_CHARS,"0",STR_PAD_LEFT); + + $q="update nodes set node_parent='$parent_id',node_vector='$new_vector' where node_id='$node_id'"; $db->query($q); }