Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / eventz / set_bookmark_category.inc
1 <?php
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. */
7
8
9
10 function set_bookmark_category() {
11 echo "hello world";
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);
17
18
19 if (!$new_parent_permissions['w']) {
20 global $error_messages;
21 $error=$error_messages['WRITE_PERMISSION_ERROR'];
22 return false;
23 }
24
25
26
27 foreach ($bookmarks as $chosen_id) {
28
29 unset($chosen);
30
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']."'");
33 $set->next();
34 $old_category=$set->getString('old_category');
35
36 $q="update node_access set bookmark_category='$category_id' where node_id='$chosen_id' and user_id='".$_SESSION['user_id']."'";
37 $db->query($q);
38
39 $q="update neurons set central='$category_id' where peripheral='$chosen_id' and central='$old_category'";
40 $db->update($q);
41 $db->query("commit");
42 }
43
44 return true;
45 }
46 ?>
This page took 0.239708 seconds and 4 git commands to generate.