4 function set_bookmark_category() {
5 global $node,$db,$error;
6 $bookmarks=$_POST['bookmarks_chosen'];
8 if (isset($_POST['bookmark_category_id']) &&
9 is_numeric($_POST['bookmark_category_id'])) {
10 $category_id=$_POST['bookmark_category_id'];
13 $new_parent=nodes::getNodeById($category_id,$_SESSION['user_id']);
14 $new_parent_permissions=permissions::checkPermissions($new_parent);
17 if (!$new_parent_permissions['w']) {
18 global $error_messages;
19 $error=$error_messages['WRITE_PERMISSION_ERROR'];
25 foreach ($bookmarks as $chosen_id) {
28 if (!is_numeric($chosen_id))
30 $error=$error_messages['What a strange number..'];
34 $db->query("start transaction");
36 $q="update node_access set bookmark_category='$category_id' where node_id='$chosen_id' and user_id='".$_SESSION['user_id']."'";
39 $q="update neurons set dst='$category_id' where src='$chosen_id' and synapse_creator='".$_SESSION['user_id']."' and link='bookmark'";
40 $result=$db->update($q);
41 if (!$result) $db->query("insert into neurons set synapse_creator='".$_SESSION['user_id']."',src='$chosen_id',dst='$category_id',link='bookmark'");
42 $db->query("update nodes set lastdescendant_created=NOW() where node_id='$category_id'");