#275 Only update dl count if the attachment exists

merge-requests/2/head
Mike Koch 9 years ago
parent 22d6d3569c
commit f375859de3

@ -95,9 +95,6 @@ if ( isset($_GET['kb_att']) )
hesk_checkPermission('can_man_kb');
}
}
// Update the download count
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_attachments` SET `download_count` = `download_count` + 1 WHERE `att_id` = '{$att_id}'");
}
// Ticket attachments
@ -137,7 +134,7 @@ else
}
// Update the download count
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` SET `download_count` = `download_count` + 1 WHERE `att_id` = '{$att_id}'");
}
// Path of the file on the server
@ -149,6 +146,13 @@ if ( ! file_exists($realpath))
hesk_error($hesklang['attdel']);
}
// Update the download count
if ( isset($_GET['kb_att']) ) {
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_attachments` SET `download_count` = `download_count` + 1 WHERE `att_id` = '{$att_id}'");
} else {
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` SET `download_count` = `download_count` + 1 WHERE `att_id` = '{$att_id}'");
}
// Send the file as an attachment to prevent malicious code from executing
header("Pragma: "); # To fix a bug in IE when running https
header("Cache-Control: "); # To fix a bug in IE when running https

Loading…
Cancel
Save