Commit | Line | Data |
---|---|---|
e586807d H |
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 | function set_creator() { | |
10 | global $node,$db; | |
11 | $owner=$_POST['owner']; | |
12 | $userset=$db->query("select user_id from users where login='$owner'"); | |
13 | $userset->next(); | |
14 | $user_id=$userset->getString('user_id'); | |
15 | if (!is_numeric($user_id)) { | |
16 | $error="user $owner does not exist"; | |
17 | return false; | |
18 | } | |
19 | ||
20 | if ($node['node_creator']!=$_SESSION['user_id']) { | |
21 | $error="you are not owner of da node"; | |
22 | return false; | |
23 | } | |
24 | ||
25 | $node_id=$node['node_id']; | |
26 | if (is_numeric($node_id)) { | |
27 | $q="update nodes set node_creator='$user_id' where node_id='$node_id'"; | |
28 | $db->query($q); | |
29 | $ubik['mail_to']=$user_id; | |
30 | $ubik['mail_text']="user ".$_SESSION['user_name']." have given you node <a href='/id/$node_id'>".$node['node_name']."</a>"; | |
31 | ubik::ubikMail($ubik); | |
32 | return false; | |
33 | } | |
34 | ||
35 | } | |
36 | ||
37 | ?> |