From 5a8234db136e8d608f8161f43c0f1b991c110966 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Mon, 25 Nov 2024 11:58:08 -0500 Subject: [PATCH] Remove branding from downloaded files via link and use original filename replaced old logging function in download with new logAction funtion --- guest_download_file.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/guest_download_file.php b/guest_download_file.php index bccfdcb9..e3671975 100644 --- a/guest_download_file.php +++ b/guest_download_file.php @@ -8,8 +8,8 @@ require_once "inc_set_timezone.php"; require_once "functions.php"; -$ip = sanitizeInput(getIP()); -$user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']); +$session_ip = sanitizeInput(getIP()); +$session_user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']); if (isset($_GET['id']) && isset($_GET['key'])) { $item_id = intval($_GET['id']); @@ -57,23 +57,21 @@ if (isset($_GET['id']) && isset($_GET['key'])) { } $file_name = sanitizeInput($file_row['file_name']); - $file_ext = sanitizeInput($file_row['file_ext']); $file_reference_name = sanitizeInput($file_row['file_reference_name']); $client_id = intval($file_row['file_client_id']); $file_path = "uploads/clients/$client_id/$file_reference_name"; - $file_download_name = str_replace('.', '', $file_name) . '-' . $config_app_name . '-download.' . $file_ext; // Brand the downloaded file name, and also force the original file extension // Display file as download $mime_type = mime_content_type($file_path); header('Content-type: '.$mime_type); - header('Content-Disposition: attachment; filename=' . $file_download_name); + header('Content-Disposition: attachment; filename=' . $file_name); readfile($file_path); // Update file view count $new_item_views = $item_views + 1; mysqli_query($mysqli, "UPDATE shared_items SET item_views = $new_item_views WHERE item_id = $item_id"); - // Logging - mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Downloaded shared file $file_name via link', log_client_id = $client_id, log_ip = '$ip', log_user_agent = '$user_agent'"); + //Logging + logAction("Share", "View", "Downloaded shared file $file_name via link", $client_id); }