Portions created by the Initial Developer are Copyright (C) 2008-2018 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ //includes require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (!permission_exists('contact_attachment_view')) { echo "access denied"; exit; } //get the contact attachment list $sql = "select *, length(decode(attachment_content,'base64')) as attachment_size from v_contact_attachments "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and contact_uuid = '$contact_uuid' "; $sql .= "order by attachment_primary desc, attachment_filename asc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $contact_attachments = $prep_statement->fetchAll(PDO::FETCH_NAMED); unset ($prep_statement, $sql); //set the row style $c = 0; $row_style["0"] = "row_style0"; $row_style["1"] = "row_style1"; //styles echo "\n"; //ticket attachment layer echo "\n"; //show the content echo "".$text['label-attachments']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if (is_array($contact_attachments)) { foreach($contact_attachments as $row) { if (permission_exists('contact_attachment_edit')) { $tr_link = "href='contact_attachment_edit.php?contact_uuid=".escape($row['contact_uuid'])."&id=".escape($row['contact_attachment_uuid'])."'"; } echo "\n"; $attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION)); if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') { echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "\n"; $c = $c ?: 1; } unset($sql, $contact_attachments); } echo "
".$text['label-attachment_filename']."".$text['label-attachment_size']."".$text['label-attachment_description'].""; if (permission_exists('contact_attachment_add')) { echo "$v_link_label_add"; } echo "
".strtoupper(byte_convert($row['attachment_size']))."".escape($row['attachment_description']).""; if (permission_exists('contact_attachment_edit')) { echo "$v_link_label_edit"; } if (permission_exists('contact_attachment_delete')) { echo "$v_link_label_delete"; } echo "
"; //javascript echo "\n"; ?>