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