mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 23:55:26 +02:00
[feature/attach-dl] Added function for incrementing download counter
PHPBB3-11042
This commit is contained in:
parent
20a2ceccbd
commit
ed1435d040
@ -407,10 +407,7 @@ if ($attachment)
|
|||||||
else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'] && !phpbb_http_byte_range($attachment['filesize']))
|
else if (($display_cat == ATTACHMENT_CATEGORY_NONE/* || $display_cat == ATTACHMENT_CATEGORY_IMAGE*/) && !$attachment['is_orphan'] && !phpbb_http_byte_range($attachment['filesize']))
|
||||||
{
|
{
|
||||||
// Update download count
|
// Update download count
|
||||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
phpbb_increment_downloads($db, $attachment['attach_id']);
|
||||||
SET download_count = download_count + 1
|
|
||||||
WHERE attach_id = ' . $attachment['attach_id'];
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false)))
|
if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && ((strpos(strtolower($user->browser), 'msie') !== false) && (strpos(strtolower($user->browser), 'msie 8.0') === false)))
|
||||||
@ -443,10 +440,7 @@ if ($attachment)
|
|||||||
|
|
||||||
if ($attachments)
|
if ($attachments)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
phpbb_increment_downloads($db, $attach_ids);
|
||||||
SET download_count = download_count + 1
|
|
||||||
WHERE ' . $db->sql_in_set('attach_id', $attach_ids);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
|
|
||||||
if (!in_array($archive, compress::methods()))
|
if (!in_array($archive, compress::methods()))
|
||||||
{
|
{
|
||||||
|
@ -592,3 +592,24 @@ function phpbb_parse_range_request($request_array, $filesize)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increments the download count of all provided attachments
|
||||||
|
*
|
||||||
|
* @param dbal $db The database object
|
||||||
|
* @param array|int $ids The attach_id of each attachment
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
function phpbb_increment_downloads($db, $ids)
|
||||||
|
{
|
||||||
|
if (!is_array($ids))
|
||||||
|
{
|
||||||
|
$ids = array($ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||||
|
SET download_count = download_count + 1
|
||||||
|
WHERE ' . $db->sql_in_set('attach_id', $ids);
|
||||||
|
$db->sql_query($sql);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user