$data['data'] = $validation_errors; if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error'; echo json_encode($data); } else { $data['status'] = 'OK'; echo json_encode($data); } exit; } else { if (is_array($validation_errors) && !empty($validation_errors)) { $data['status'] = 'error'; $data['data'] = $validation_errors; } else { $data['status'] = 'OK'; Incident_ticket::delete($conn, $ticket_id); $db->close(); header("Location: incident.php?id={$incident_id}&edit={$edit}"); exit; } } } elseif ($action == 'e_subscription') { $incident_id = $_POST['incident_id'] = GET('incident_id'); $login = POST('login'); $validate = array('incident_id' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Incident ID')), 'login' => array('validation' => 'OSS_USER_2', 'e_message' => 'illegal:' . _('Email changes to'))); $validation_errors = validate_form_fields('POST', $validate); if (is_array($validation_errors) && empty($validation_errors)) { if (!Incident::user_incident_perms($conn, $incident_id, $action)) { $validation_errors['extended_validatation'] = _('You are not allowed to subscribe a new user because you are neither *admin* or the ticket owner'); } }
header("Location: incident.php?id={$id}&edit={$edit}&nohmenu=1"); } else { header("Location: incident.php?id={$id}&edit={$edit}"); } exit; } /* Remove a ticket */ if ($action == 'delticket') { if (!GET('ticket_id')) { die("Invalid Ticket ID"); } // Only admin, entity admin and ticket owner if (!Incident_ticket::user_tickets_perms($conn, GET('ticket_id'))) { die_error(_("You are not allowed to delete this ticket because you are neither *admin* or the ticket owner")); } Incident_ticket::delete($conn, GET('ticket_id')); if (intval(POST('nohmenu')) == 1) { header("Location: incident.php?id={$id}&edit={$edit}&nohmenu=1"); } else { header("Location: incident.php?id={$id}&edit={$edit}"); } exit; } /* Remove an incident */ if ($action == 'delincident') { // Only admin, entity admin and ticket owner if (!Incident::user_incident_perms($conn, $id, $action)) { die_error(_("You are not allowed to delete this incident because you are neither *admin* or the ticket owner")); } Incident::delete($conn, $id); header("Location: ./");