Body Header User Image and Menu, Domain Selector, Contact Attachment improvements.

This commit is contained in:
fusionate
2024-09-28 16:37:36 -06:00
parent 7f2bd7d53a
commit ae15319487
9 changed files with 246 additions and 64 deletions
+6 -2
View File
@@ -34,6 +34,7 @@
//get attachment uuid
$contact_attachment_uuid = $_GET['id'] ?? '';
$action = $_GET['action'] ?? '';
$session_id = $_GET['sid'] ?? '';
//get media
if (!empty($contact_attachment_uuid) && is_uuid($contact_attachment_uuid)) {
@@ -45,14 +46,13 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$attachment = $database->select($sql, $parameters ?? null, 'row');
// view_array($database->message);
unset($sql, $parameters);
$attachment_type = strtolower(pathinfo($attachment['attachment_filename'] ?? '', PATHINFO_EXTENSION));
//determine mime type
$content_type = 'application/octet-stream'; //set default
$allowed_attachment_types = json_decode($_SESSION['contacts']['allowed_attachment_types']['text'] ?? '', true);
$allowed_attachment_types = json_decode($_SESSION['contact']['allowed_attachment_types']['text'] ?? '', true);
if (!empty($allowed_attachment_types)) {
if ($allowed_attachment_types[$attachment_type] != '') {
$content_type = $allowed_attachment_types[$attachment_type];
@@ -64,6 +64,10 @@
header("Content-type: ".$content_type."; charset=utf-8");
header("Content-Disposition: attachment; filename=\"".$attachment['attachment_filename']."\"");
header("Content-Length: ".strlen(base64_decode($attachment['attachment_content'])));
if (!empty($session_id)) {
header("Cache-Control: max-age=86400"); // 24h
header("Expires: ". gmdate('D, d M Y H:i:s \G\M\T', time() + 86400)); // 24h
}
echo base64_decode($attachment['attachment_content']);
break;
case 'display':
+12 -14
View File
@@ -496,19 +496,17 @@
$y = 0;
if (!empty($contact_attachments)) {
foreach ($contact_attachments as $row) {
if (!empty($row['attachment_description'])) {
$array['contacts'][0]['contact_attachments'][$y]['contact_attachment_uuid'] = $row["contact_attachment_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['domain_uuid'] = $row["domain_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['contact_uuid'] = $row["contact_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['attachment_primary'] = $row["attachment_primary"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_filename'] = $row["attachment_filename"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_content'] = $row["attachment_content"];
$array['contacts'][0]['contact_attachments'][$y]['attachment_description'] = $row["attachment_description"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_uploaded_date'] = $row["attachment_uploaded_date"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_uploaded_user_uuid'] = $row["attachment_uploaded_user_uuid"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_size'] = $row["attachment_size"];
$y++;
}
$array['contacts'][0]['contact_attachments'][$y]['contact_attachment_uuid'] = $row["contact_attachment_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['domain_uuid'] = $row["domain_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['contact_uuid'] = $row["contact_uuid"];
$array['contacts'][0]['contact_attachments'][$y]['attachment_primary'] = $row["attachment_primary"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_filename'] = $row["attachment_filename"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_content'] = $row["attachment_content"];
$array['contacts'][0]['contact_attachments'][$y]['attachment_description'] = $row["attachment_description"] ?? null;
//$array['contacts'][0]['contact_attachments'][$y]['attachment_uploaded_date'] = $row["attachment_uploaded_date"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_uploaded_user_uuid'] = $row["attachment_uploaded_user_uuid"];
//$array['contacts'][0]['contact_attachments'][$y]['attachment_size'] = $row["attachment_size"];
$y++;
}
}
@@ -2622,7 +2620,7 @@ if (permission_exists('contact_attachment_view')) {
echo " </select>\n";
echo " </div>\n";
echo " <div class='label required'>\n";
echo " <div class='label'>\n";
echo " ".$text['label-description']."\n";
echo " </div>\n";
echo " <div class='field no-wrap'>\n";