Exemplo n.º 1
0
    exit;
} elseif ($_GET['page'] === "update") {
    $allowedFileTypes = unserialize(FILE_TYPES_ALLOWED_FOR_NOTES_DISABILITIES);
    $poc->updatePointOfContact($_POST);
    $loggers['audit']->info("Specialist point of contact {$_POST['point_of_contact_id']} updated");
    for ($i = 0, $numFiles = sizeof($_FILES["point_of_contact_attachment"]["name"]) - 1; $i < $numFiles; $i++) {
        if (in_array($_FILES["point_of_contact_attachment"]["type"][$i], $allowedFileTypes, true)) {
            $fp = fopen($_FILES["point_of_contact_attachment"]["tmp_name"][$i], "rb");
            $content = fread($fp, $_FILES["point_of_contact_attachment"]["size"][$i]);
            fclose($fp);
        }
        $file = array("name" => $_FILES["point_of_contact_attachment"]["name"][$i], "size" => $_FILES["point_of_contact_attachment"]["size"][$i], "type" => $_FILES["point_of_contact_attachment"]["type"][$i], "inserted_on" => date("Y-m-d H:i:s"), "point_of_contact_id" => $_POST['point_of_contact_id']);
        $poc->createPointOfContactFile($file, $content);
        $loggers['audit']->info("File added to specialist point of contact {$_POST['point_of_contact_id']}");
    }
    $poc->updatePointOfContactTopics($_POST['point_of_contact_id'], $_POST['point_of_contact_topics']);
    if (ctype_digit($_GET['student_num'])) {
        header('Location: point-of-contact.php?student_num=' . $_GET['student_num']);
        exit;
    }
    header('Location: point-of-contact.php');
    exit;
} elseif ($_GET['page'] === "update-incident-report") {
    $allowedFileTypes = unserialize(FILE_TYPES_ALLOWED_FOR_NOTES_DISABILITIES);
    $ir->updateIncidentReport($_POST);
    $loggers['audit']->info("Incident report {$_POST['incident_report_id']} updated");
    for ($i = 0, $numFiles = sizeof($_FILES["incident_report_attachment"]["name"]) - 1; $i < $numFiles; $i++) {
        if (in_array($_FILES["incident_report_attachment"]["type"][$i], $allowedFileTypes, true)) {
            $fp = fopen($_FILES["incident_report_attachment"]["tmp_name"][$i], "rb");
            $content = fread($fp, $_FILES["incident_report_attachment"]["size"][$i]);
            fclose($fp);