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 masterlist() { | |
10 | global $db,$error,$node; | |
11 | $node_id=$node['node_id']; | |
12 | if ($node['node_permission']!='owner') { | |
13 | $error=$error_messages['EVENT_PERMISSION_ERROR']; | |
14 | return false; | |
15 | } | |
16 | ||
17 | $masters=explode(";",$_POST['masterlist']); | |
18 | $db->query("update node_access set node_permission='' where node_id=$node_id and node_permission='master'"); | |
19 | foreach ($masters as $master) { | |
20 | $set=$db->query("select user_id from users where login='$master'"); | |
21 | $set->next(); | |
22 | if ($set->getString('user_id')) { | |
23 | $q="update node_access set node_permission='master' where node_id=$node_id and user_id='".$set->getString('user_id')."'"; | |
24 | $changed=$db->update($q); | |
25 | if (!$changed) { | |
26 | $q="insert into node_access set node_permission='master',node_id=$node_id,user_id=".$set->getString('user_id'); | |
27 | $db->query($q); | |
28 | log::log('add master',$node_id,'ok',$master); | |
29 | ||
30 | } | |
31 | } | |
32 | else { $error .= "$master does not exist..."; } | |
33 | } | |
34 | } | |
35 | ?> |