51ff3226 |
1 | <?php |
2 | function oplist() { |
fd15ea3a |
3 | global $db,$error,$node; |
51ff3226 |
4 | $node_id=$node['node_id']; |
5 | |
6 | if (($node['node_permission']!='owner') && ($node['node_permission']!='master')) { |
7 | $error=$error_messages['EVENT_PERMISSION_ERROR']; |
8 | return false; |
9 | } |
10 | |
11 | $ops=explode(";",$_POST['oplist']); |
12 | $db->query("update node_access set node_permission='' where node_id=$node_id and node_permission='op'"); |
13 | foreach ($ops as $op) { |
14 | $set=$db->query("select user_id from users where login='$op'"); |
15 | $set->next(); |
16 | if ($set->getString('user_id')) { |
17 | $q="update node_access set node_permission='op' where node_id=$node_id and user_id='".$set->getString('user_id')."'"; |
18 | $changed=$db->update($q); |
19 | if (!$changed) { |
20 | $q="insert into node_access set node_permission='op',node_id=$node_id,user_id=".$set->getString('user_id'); |
21 | echo $q; |
22 | $db->query($q); |
23 | } |
fd15ea3a |
24 | logger::log('add op',$node_id,'ok',$op); |
51ff3226 |
25 | }else { $error .= "$op does not exist..."; } |
26 | } |
27 | } |
28 | ?> |