Ejemplo n.º 1
1
function delete_note($noteid)
{
    $db = new DbConn();
    $result = $db->fetch('select userid from notes where id = ?');
    if ($result) {
        $db->exec('delete from notes where id = ?', $noteid);
        log_event(LOG_NOTE_DELETED, $result->userid, $noteid);
    }
}
Ejemplo n.º 2
0
function get_user_by_email($email)
{
    $db = new DbConn();
    return $db->fetch('select * from users where email = ?', $email);
}
Ejemplo n.º 3
0
function get_mail_template($template_id, $throw_on_not_found = FALSE)
{
    $mail_template = FALSE;
    if ($template_id) {
        $db = new DbConn();
        $mail_template = $db->fetch('select mtv.*, mt.role, mt.recipient, mt.allowdupes, mt.recurrence
                                 from mail_templates as mt
                                 left join (mail_template_versions as mtv)
                                 on mt.id = mtv.templateid
                                 where mt.id = ?
                                 order by id desc', $template_id);
    }
    if ($throw_on_not_found && !$mail_template) {
        throw new RuntimeException("Mail template #{$template_id} not found");
    }
    if ($mail_template) {
        $attachments = $db->query('select ma.id, ma.filename, ma.size
                                   from mail_attachments as ma, templatevers_to_attachments as t2a
                                   where ma.id = t2a.attachmentid and t2a.templateverid = ?', $mail_template->id);
        $mail_template->attachments = $attachments;
    }
    return $mail_template;
}
Ejemplo n.º 4
0
 function get_volunteer_coordinator()
 {
     $db = new DbConn();
     return $db->fetch('select name, email from admins where iscoordinator = 1');
 }