Exemple #1
0
function email__guess_participant($email)
{
    $guess = array();
    if (count($guess) == 0) {
        // search for email in participants
        $pars = array(':email' => $email['from_address']);
        $query = "SELECT *\n                FROM " . table('participants') . "\n                WHERE email=:email\n                ORDER BY creation_time DESC";
        $result = or_query($query, $pars);
        while ($p = pdo_fetch_assoc($result)) {
            $guess[] = $p;
        }
    }
    if (count($guess) == 0) {
        // search email address in email text
        if (preg_match_all("/([^@ \t\r\n\\(\\)\\/\\&\\+]+@[-_0-9a-zA-Z]+\\.[^@ \t\r\n\\(\\)\\/\\&\\+]+)/", $email['body'], $matches, PREG_PATTERN_ORDER)) {
            $par_array = id_array_to_par_array($matches[1], 'email');
            $query = "SELECT * FROM " . table('participants') . "\n                    WHERE email IN (" . implode(',', $par_array['keys']) . ")";
            $result = or_query($query, $par_array['pars']);
            while ($p = pdo_fetch_assoc($result)) {
                $guess[] = $p;
            }
        }
    }
    return $guess;
}
Exemple #2
0
function sessions__load_sessions_for_ids($ids = array())
{
    $sessions = array();
    if (count($ids) > 0) {
        $par_array = id_array_to_par_array($ids);
        $query = "SELECT * FROM " . table('sessions') . "\n\t\t\t\tWHERE session_id IN (" . implode(',', $par_array['keys']) . ")";
        $result = or_query($query, $par_array['pars']);
        while ($line = pdo_fetch_assoc($result)) {
            $sessions[$line['session_id']] = $line;
        }
    }
    return $sessions;
}
Exemple #3
0
function participant__load_participants_for_ids($ids = array())
{
    $participants = array();
    if (count($ids) > 0) {
        $par_array = id_array_to_par_array($ids);
        $query = "SELECT * FROM " . table('participants') . "\n                WHERE participant_id IN (" . implode(',', $par_array['keys']) . ")";
        $result = or_query($query, $par_array['pars']);
        while ($line = pdo_fetch_assoc($result)) {
            $participants[$line['participant_id']] = $line;
        }
    }
    return $participants;
}