mirror of
https://github.com/kleeja-official/kleeja.git
synced 2026-08-30 11:47:07 +02:00
Merge pull request #102 from MitanOmar/3.1.0
change the method of update the number of download
This commit is contained in:
47
do.php
47
do.php
@@ -333,29 +333,32 @@ elseif (ig('down') || ig('downf') ||
|
||||
//check if the vistor is new in this page before updating kleeja counter
|
||||
if (! preg_match('/,' . $ii . ',/i', $usrcp->kleeja_get_cookie('oldvistor')) && ! isset($_SERVER['HTTP_RANGE']))
|
||||
{
|
||||
//updates number of uploads ..
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}files",
|
||||
'SET' => 'uploads=uploads+1, last_down=' . time(),
|
||||
'WHERE' => $is_id_filename ? "name='" . $filename . "'" : 'id=' . $id,
|
||||
];
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('qr_update_no_uploads_down', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
$SQL->build($update_query);
|
||||
|
||||
//
|
||||
//Define as old vistor
|
||||
//if this vistor has other views then add this view too
|
||||
//old vistor just for 1 day
|
||||
//
|
||||
if ($usrcp->kleeja_get_cookie('oldvistor'))
|
||||
if ($usrcp->group_id() != 1)
|
||||
{
|
||||
$usrcp->kleeja_set_cookie('oldvistor', $usrcp->kleeja_get_cookie('oldvistor') . $ii . ',', time() + 86400);
|
||||
}
|
||||
else
|
||||
{
|
||||
//first time
|
||||
$usrcp->kleeja_set_cookie('oldvistor', ',' . $ii . ',', time() + 86400);
|
||||
//updates number of uploads ..
|
||||
$update_query = [
|
||||
'UPDATE' => "{$dbprefix}files",
|
||||
'SET' => 'uploads=uploads+1, last_down=' . time(),
|
||||
'WHERE' => $is_id_filename ? "name='" . $filename . "'" : 'id=' . $id,
|
||||
];
|
||||
|
||||
is_array($plugin_run_result = Plugins::getInstance()->run('qr_update_no_uploads_down', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
|
||||
$SQL->build($update_query);
|
||||
|
||||
//
|
||||
//Define as old vistor
|
||||
//if this vistor has other views then add this view too
|
||||
//old vistor just for 1 day
|
||||
//
|
||||
if ($usrcp->kleeja_get_cookie('oldvistor'))
|
||||
{
|
||||
$usrcp->kleeja_set_cookie('oldvistor', $usrcp->kleeja_get_cookie('oldvistor') . $ii . ',', time() + 86400);
|
||||
}
|
||||
else
|
||||
{
|
||||
//first time
|
||||
$usrcp->kleeja_set_cookie('oldvistor', ',' . $ii . ',', time() + 86400);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user