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. */
9 function accesslist() {
10 global $db,$error,$node;
11 $node_id=$node['node_id'];
12 $access=explode(";",$_POST['access']);
14 if ($node['node_permission']!=('owner' OR 'master' OR 'op')) {
15 $error=$error_messages['EVENT_PERMISSION_ERROR'];
20 $db->query("update node_access set node_permission='' where node_id=$node_id and node_permission='access'");
21 foreach ($access as $acc) {
22 $set=$db->query("select user_id from users where login='$acc'");
24 if ($set->getString('user_id')) {
25 $q="update node_access set node_permission='access' where node_id=$node_id and user_id='".$set->getString('user_id')."'";
27 $changed=$db->update($q);
29 $q="insert into node_access set node_permission='access',node_id=$node_id,user_id=".$set->getString('user_id');
32 log::log('add access',$node_id,'ok',$acc);
34 else { $error .= "$acc does not exist..."; }