Beispiel #1
0
function checkInsertCourse($subject_name, $course_number, $course_title)
{
    $subject_name = fixSubjectName($subject_name);
    $course_number = fixSubjectName($course_number);
    $course_title = fixTitleCase($course_title);
    if (!subjectExists($subject_name)) {
        return "Invalid SubjectName; does not exist.";
    }
    insertCourse($subject_name, $course_number, $course_title);
    return true;
    # could use some more work
}
Beispiel #2
0
function checkContactUs($email, $name, $subject, $comments)
{
    $email = fixEmail($email);
    if (!isValidEmail($email)) {
        return INVALID_EMAIL_ERR;
    }
    $name = fixName($name);
    if (!isValidName($name)) {
        return INVALID_NAME_ERR;
    }
    $subject = fixTitleCase($subject);
    global $CONTACT_US_SUBJECTS;
    if (!in_array($subject, $CONTACT_US_SUBJECTS)) {
        return INVALID_CONTACT_US_SUBJECT;
    }
    $comments = trim($comments);
    if ($comments === "") {
        return INVALID_COMMENTS_ERR;
    }
    return sendContactUsEmail($email, $name, $subject, $comments);
}