Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / eventz / book.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 function book() {
9 global $db,$error,$node;
10 $q="update neurons set link='bookmark',synapse_creator='".$_SESSION['user_id']."',synapse=synapse+1 where dst='".$_SESSION['user_id']."' and src='".$node['node_id']."'";
11 $result=$db->update($q);
12 if (!$result) {
13 $q="insert into neurons set synapse_created=NOW(),dst='".$_SESSION['user_id']."',src='".$node['node_id']."',synapse_creator='".$_SESSION['user_id']."',link='bookmark'";
14 $db->query($q);
15 }
16 $q="update node_access set last_visit='',node_bookmark='yes' where user_id='".$_SESSION['user_id']."' and node_id='".$node['node_id']."'";
17 $result=$db->query($q);
18 if ($result) {
19 log::log('book','ok');
20 return true;
21 }
22 else {
23 log::log('book','failed');
24 $error='book failed';
25 return false;
26 }
27 }
28 ?>
This page took 0.363042 seconds and 4 git commands to generate.