Beispiel #1
0
}
main_menu();
read_sample_id();
if (isset($_POST['action'])) {
    if ($_POST['action'] == 'list_attachment') {
        list_attachment($_POST['sample_id']);
    }
    if ($_POST['action'] == 'edit_attachment') {
        edit_attachment($_POST['sample_id'], $_POST['attachment_id']);
    }
    if ($_POST['action'] == 'add_attachment') {
        add_attachment($_POST['sample_id']);
    }
    if ($_POST['action'] == 'save_attachment') {
        if (isset($_FILES)) {
            save_attachment($_POST, $_FILES);
        }
        list_attachment($_POST['sample_id']);
    }
    if ($_POST['action'] == 'insert_attachment') {
        if (isset($_FILES)) {
            insert_attachment($_POST, $_FILES);
        }
        update_cross_reference($_POST['sample_id']);
        list_attachment($_POST['sample_id']);
    }
    if ($_POST['action'] == 'delete_attachment') {
        if (isset($_FILES)) {
            delete_attachment($_POST['sample_id'], $_POST['attachment_id']);
        }
        update_cross_reference($_POST['sample_id']);
Beispiel #2
0
function process_attachments($attachments)
{
    $result = array();
    foreach ($attachments as $info) {
        $orig_name = "";
        $size = 0;
        $stored_name = "";
        $type = "";
        if (array_key_exists("Type", $info)) {
            $type = $info["Type"];
        }
        if (array_key_exists("FileName", $info)) {
            $orig_name = $info["FileName"];
        }
        if (!strlen($orig_name)) {
            continue;
        }
        if (array_key_exists("Data", $info)) {
            $data = $info["Data"];
            $size = strlen($data);
            if ($size == 0) {
                continue;
            }
            $attachsdir = get_config("AttachmentsDir");
            if (!is_dir($attachsdir)) {
                die('The attachments directory "' . $attachsdir . '" doesn\'t exist.');
            }
            $stored_name = save_attachment($attachsdir, getFileExtension($orig_name), $data);
        } else {
            $stored_name = $info['DataFile'];
            $size = filesize($stored_name);
        }
        $result[] = array("orig_name" => $orig_name, "size" => $size, "stored_name" => $stored_name, "type" => $type);
    }
    return $result;
}
Beispiel #3
0
        // otherwise, it could be attached as a text, csv, or pdf file
        if ($ct_style) {
            // get html for the email body
            $htmlBody = transform_xml();
        } else {
            // look for a body message in the definition
            if ($thisProcess[0]->notify_email_body) {
                $htmlBody = $thisProcess[0]->notify_email_body;
                $htmlBody = replace_variables($htmlBody);
            } else {
                // put in a generic message so nothing fails
                $htmlBody = "This is a scheduled notification from AFIDS";
            }
        }
        if ($attach_data == "yes") {
            $attach_result = save_attachment();
        } else {
            $attach_result = null;
        }
        // See if there is an body message to go along with an attachment
    } else {
        // personalized emails cannot have attachments?
    }
}
$send_count = 0;
$error_count = 0;
// get the recipients
if ($thisProcess[0]->recipient_list) {
    $rl_source = $thisProcess[0]->recipient_list->attributes()->source;
    $rl_command = $thisProcess[0]->recipient_list->command;
    $rl_command = replace_variables($rl_command);