Merge pull request #102 from MitanOmar/3.1.0

change the method of update the number of download
This commit is contained in:
Abdulrahman ☕️
2019-05-20 03:02:06 +03:00
committed by GitHub

47
do.php
View File

@@ -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);
}
}
}
}