| 1 | <?php |
| 2 | if(preg_match('/36$/', $event) || preg_match('/36$/', $_POST['event'])) { |
| 3 | $event = preg_replace('/36$/', '', $event); |
| 4 | $_POST['event'] = preg_replace('/36$/', '', $_POST['event']); |
| 5 | $_POST['nodeshell_id'] = base_convert($_POST['nodeshell_id'], 36, 10); //put36 |
| 6 | $_POST['new_parent'] = base_convert($_POST['new_parent'], 36, 10); //set_parent36 |
| 7 | } |
| 8 | |
| 9 | if($event=='delete' || $_POST['event']=='delete') { //XXX TODO FIXME UglyFuckingHack - should go to delete.inc (but something is broken) |
| 10 | $event='set_parent'; |
| 11 | $_POST['event']=$event; |
| 12 | $_POST['new_parent']=123456; //XXX TODO FIXME Hardcoded |
| 13 | } |
| 14 | |
| 15 | //do not make a permission check if an event was executed before |
| 16 | if ($_SESSION['eventz'][$event]) { |
| 17 | include_once(INCLUDE_DIR."eventz/$event.inc"); |
| 18 | $status=$event(); |
| 19 | } |
| 20 | |
| 21 | elseif (is_file(INCLUDE_DIR."eventz/$event.inc")) { |
| 22 | $event_id=nodes::getNodeIdByName($event,"event://$event"); |
| 23 | $event_node=nodes::getNodeById($event_id,$_SESSION['user_id']); |
| 24 | if ( |
| 25 | ($event_node['node_system_access']=='public') |
| 26 | || ($event_node['node_creator']==$_SESSION['user_id']) |
| 27 | || ($event_node['node_permission']=='op') |
| 28 | || ($event_node['node_permission']=='execute') |
| 29 | || ($event_node['node_permission']=='master') |
| 30 | || ($event=='display') |
| 31 | ) { |
| 32 | require_once(INCLUDE_DIR."eventz/$event.inc"); |
| 33 | $status=$event(); |
| 34 | $_SESSION['eventz'][$event]=true; |
| 35 | |
| 36 | } |
| 37 | |
| 38 | else { |
| 39 | $error=$error_messages['EVENT_NOT_PERMITTED']; |
| 40 | } |
| 41 | |
| 42 | } |
| 43 | |
| 44 | else { |
| 45 | $error=$error_messages['EVENT_NOT_EXISTENT']; |
| 46 | $status=false; |
| 47 | } |
| 48 | |
| 49 | if (!$status) { |
| 50 | require_once(INCLUDE_DIR."eventz/display.inc"); |
| 51 | display(); |
| 52 | } |
| 53 | |
| 54 | elseif ($status>1) { |
| 55 | Header("Location: /id/".$status."/"); |
| 56 | } |
| 57 | |
| 58 | elseif ($status && $event!='display') { |
| 59 | Header("Location: /id/".$node['node_id']."/"); |
| 60 | } |
| 61 | |
| 62 | |
| 63 | ?> |