2 /* This program is free software. It comes without any warranty, to
3 * the extent permitted by applicable law. You can redistribute it
4 * and/or modify it under the terms of the Do What The Fuck You Want
5 * To Public License, Version 2, as published by Sam Hocevar. See
6 * http://sam.zoy.org/wtfpl/COPYING for more details. */
10 function set_bookmark_category() {
12 global $node,$db,$error;
13 $bookmarks=$_POST['bookmarks_chosen'];
14 $category_id=$_POST['bookmark_category_id'];
15 $new_parent=nodes::getNodeById($category_id,$_SESSION['user_id']);
16 $new_parent_permissions=permissions::checkPermissions($new_parent);
19 if (!$new_parent_permissions['w']) {
20 global $error_messages;
21 $error=$error_messages['WRITE_PERMISSION_ERROR'];
27 foreach ($bookmarks as $chosen_id) {
31 $db->query("start transaction");
32 $set=$db->query("select bookmark_category from node_access where node_id='$chosen_id' and user_id='".$_SESSION['user_id']."'");
34 $old_category=$set->getString('old_category');
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 central='$category_id' where peripheral='$chosen_id' and central='$old_category'";