3 global $error_messages,$db,$node,$error;
4 $user_id = $_SESSION['user_id'];
6 if (!empty($_POST['nodeshell_id'])) $nodeshell_id = mysql_real_escape_string($_POST['nodeshell_id']);
7 else $nodeshell_id = mysql_real_escape_string($_POST['nodeshell_id_select']);
9 $nodeshell = nodes::getNodeById($nodeshell_id,$_SESSION['user_id']);
10 $nodeshell_permissions = permissions::checkPermissions($nodeshell);
11 $nodeshell_vector = $nodeshell['node_vector'];
13 if (!$nodeshell_permissions['w']) {
14 $error = $error_messages['WRITE_PERMISSION_ERROR'];
18 if (is_array($_POST['node_chosen'])) $put_array = $_POST['node_chosen'];
19 else $put_array[] = $node['node_id'];
21 foreach ($put_array as $chosen) {
22 $dst_vector = $nodeshell_vector.str_pad($chosen,VECTOR_CHARS,0,STR_PAD_LEFT);
23 $q = "update neurons set synapse_created=NOW(),link='hard',synapse=synapse+1,
24 dst_vector='$dst_vector' where src='$chosen' and dst='$nodeshell_id'";
25 $result=$db->update($q);
27 if (!$result) $db->query("insert into neurons set synapse_creator='$user_id',synapse_created=NOW(),
28 src='$chosen',dst='$nodeshell_id',dst_vector='$dst_vector',link='hard',synapse=1");
30 $db->query("update nodes set lastdescendant_created=NOW() where node_id='$nodeshell_id'");