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