From 383a2aea722ad94ce250425b5176909c9b51dae5 Mon Sep 17 00:00:00 2001 From: niekt0 Date: Thu, 23 Dec 2010 00:14:58 +0100 Subject: [PATCH] added setParrent function --- wwwroot/inc/eventz/verify.inc | 3 +-- wwwroot/inc/nodes.inc | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/wwwroot/inc/eventz/verify.inc b/wwwroot/inc/eventz/verify.inc index 433849b..0481671 100644 --- a/wwwroot/inc/eventz/verify.inc +++ b/wwwroot/inc/eventz/verify.inc @@ -8,8 +8,7 @@ $login=mysql_real_escape_string($_POST['login']); $kset=$db->query("select user_id from users where login='$login'"); $kset->next();$userid=$kset->getString('user_id'); -// XXX HARD CODED -$set=$db->query("select * from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE); +$set=$db->query("select node_id from nodes where node_id='$userid' and node_parent=".UNVERIFIED_REGISTRATIONS_NODE); if($set->getNumRows()!=1) { global $error; $error="User already verificated or invalid."; diff --git a/wwwroot/inc/nodes.inc b/wwwroot/inc/nodes.inc index 008a527..279142d 100644 --- a/wwwroot/inc/nodes.inc +++ b/wwwroot/inc/nodes.inc @@ -293,6 +293,26 @@ node_parent='$node_handle' order by node_created $orderby LIMIT $offset,$limit"; return $access_data; } + + +// Simple internal function to set node parrent + +function setParrent() { + 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'"; + $db->query($q); +} } ?> -- 2.30.2