Portions created by the Initial Developer are Copyright (C) 2008-2020 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')) { //access granted } else { 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 "; $parameters['domain_uuid'] = $domain_uuid; $parameters['contact_uuid'] = $contact_uuid; $database = new database; $contact_attachments = $database->select($sql, $parameters, 'all'); unset($sql, $parameters); //show if exists if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) { //styles and attachment layer echo "\n"; echo "\n"; //script echo "\n"; //show the content echo "
\n"; echo "
".$text['label-attachments']."
\n"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; if (permission_exists('contact_attachment_delete')) { echo " \n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; } echo "\n"; if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) { $x = 0; foreach ($contact_attachments as $row) { $attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION)); $attachment_type_label = $attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png' ? $text['label-image'] : $text['label-file']; if (permission_exists('contact_attachment_edit')) { $list_row_url = "contact_attachment_edit.php?contact_uuid=".urlencode($row['contact_uuid'])."&id=".urlencode($row['contact_attachment_uuid']); } echo "\n"; if (permission_exists('contact_attachment_delete')) { echo " \n"; } echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " \n"; } echo "\n"; $x++; } } unset($contact_attachments); echo "
\n"; echo " \n"; echo " ".$text['label-type']."".$text['label-attachment_filename']."".$text['label-attachment_size']."".$text['label-tools']."".$text['label-attachment_description']." 
\n"; echo " \n"; echo " \n"; echo " ".$attachment_type_label." ".($row['attachment_primary'] ? " " : null)."".escape($row['attachment_filename'])."".strtoupper(byte_convert($row['attachment_size']))."".escape($row['attachment_description'])."\n"; echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]); echo "
"; echo "
\n"; } ?>