function checkOfficialEmail($email)
{
    global $config;
    if (!$email) {
        return true;
    }
    $start = strpos($email, "@");
    if ($start === FALSE) {
        return false;
    }
    if ($config->teacherInterface->forceOfficialEmailDomain) {
        $domain = substr($email, $start + 1);
        $allowedDomains = getAllowedDomains();
        foreach ($allowedDomains as $allowedDomain) {
            if ($domain === $allowedDomain) {
                return true;
            }
        }
        return false;
    } else {
        return true;
    }
}
Example #2
0
function checkOfficialEmail($email)
{
    global $config;
    if (!$email) {
        return true;
    }
    $start = strpos($email, "@");
    if ($start === FALSE) {
        return "impossible de trouver le caractère @ dans l'email.";
    }
    if ($config->teacherInterface->forceOfficialEmailDomain) {
        $domain = substr($email, $start + 1);
        $allowedDomains = getAllowedDomains();
        foreach ($allowedDomains as $allowedDomain) {
            if ($domain === $allowedDomain) {
                return true;
            }
        }
        return "l'adresse email ne correspond pas à un domaine académique";
    } else {
        return true;
    }
}