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