コード例 #1
0
ファイル: point-of-contact.php プロジェクト: hughnguy/php
        $l10n->localizeArray($referralList, 'topic');
        $l10n->localizeArray($assistiveTechnologyList, 'topic');
        $viewFile = 'views/point-of-contact.php';
    }
} elseif ($_GET['page'] === "create") {
    $allowedFileTypes = unserialize(FILE_TYPES_ALLOWED_FOR_NOTES_DISABILITIES);
    $last_inserted = $poc->createPointOfContact($_POST);
    $loggers['audit']->info("Specialist point of contact {$last_inserted} created");
    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" => $last_inserted);
        $poc->createPointOfContactFile($file, $content);
        $loggers['audit']->info("File added to specialist point of contact {$last_inserted} created");
    }
    if (!empty($_POST['point_of_contact_topics'])) {
        $poc->addPointOfContactTopics($last_inserted, $_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") {
    $allowedFileTypes = unserialize(FILE_TYPES_ALLOWED_FOR_NOTES_DISABILITIES);
    $poc->updatePointOfContact($_POST);
    $loggers['audit']->info("Specialist point of contact {$_POST['point_of_contact_id']} updated");