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