Kyberia v2.0
[mirrors/Kyberia-bloodline.git] / inc / eventz / accesslist.inc
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 accesslist() {
10 global $db,$error,$node;
11 $node_id=$node['node_id'];
12 $access=explode(";",$_POST['access']);
13
14 if ($node['node_permission']!=('owner' OR 'master' OR 'op')) {
15 $error=$error_messages['EVENT_PERMISSION_ERROR'];
16 return false;
17 }
18
19
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'");
23 $set->next();
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')."'";
26 echo $q;
27 $changed=$db->update($q);
28 if (!$changed) {
29 $q="insert into node_access set node_permission='access',node_id=$node_id,user_id=".$set->getString('user_id');
30 $db->query($q);
31 }
32 log::log('add access',$node_id,'ok',$acc);
33 }
34 else { $error .= "$acc does not exist..."; }
35 }
36 }
37 ?>
This page took 0.259635 seconds and 4 git commands to generate.