Ejemplo n.º 1
0
     $data['data'] = $validation_errors;
 } else {
     $data['status'] = 'OK';
     //Timezone
     $tz = Util::get_timezone();
     $timetz = 3600 * $tz;
     if ($ref == 'Alarm' or $ref == 'Event') {
         $vars = array('title', 'type', 'submitter', 'priority', 'src_ips', 'dst_ips', 'src_ports', 'dst_ports', 'backlog_id', 'event_id', 'alarm_group_id', 'event_start', 'event_end', 'transferred_user', 'transferred_entity');
         foreach ($vars as $v) {
             ${$v} = POST("{$v}");
         }
         if ($action == 'newincident') {
             if ($ref == 'Alarm') {
                 $incident_id = Incident::insert_alarm($conn, $title, $type, $submitter, $priority, $src_ips, $dst_ips, $src_ports, $dst_ports, $event_start, $event_end, $backlog_id, $event_id, $alarm_group_id, $transferred_user, $transferred_entity);
             } else {
                 $incident_id = Incident::insert_event($conn, $title, $type, $submitter, $priority, $src_ips, $dst_ips, $src_ports, $dst_ports, $event_start, $event_end, $transferred_user, $transferred_entity);
             }
         } elseif ($action == 'editincident') {
             $method = $ref == 'Alarm' ? 'update_alarm' : 'update_event';
             Incident::$method($conn, $incident_id, $title, $type, $submitter, $priority, $src_ips, $dst_ips, $src_ports, $dst_ports, $event_start, $event_end, $transferred_user, $transferred_entity);
         }
     } elseif ($ref == 'Metric') {
         $vars = array('title', 'type', 'submitter', 'priority', 'target', 'metric_type', 'metric_value', 'event_start', 'event_end', 'transferred_user', 'transferred_entity');
         foreach ($vars as $v) {
             ${$v} = POST("{$v}");
         }
         if ($action == 'newincident') {
             $incident_id = Incident::insert_metric($conn, $title, $type, $submitter, $priority, $target, $metric_type, $metric_value, $event_start, $event_end, $transferred_user, $transferred_entity);
         } elseif ($action == 'editincident') {
             Incident::update_metric($conn, $incident_id, $title, $type, $submitter, $priority, $target, $metric_type, $metric_value, $event_start, $event_end, $transferred_user, $transferred_entity);
         }