diff --git a/objects/videoAddViewCount.json.php b/objects/videoAddViewCount.json.php index 44ef50547..fece382aa 100644 --- a/objects/videoAddViewCount.json.php +++ b/objects/videoAddViewCount.json.php @@ -1,58 +1,65 @@ getDuration()); if (!empty($seconds)) { $percent = (intval($_POST['currentTime']) / $seconds) * 100; $percentOptions = array(25,50,75,100); foreach ($percentOptions as $value) { if ($percent >= $value) { if (empty($_SESSION['addViewCount'][$_POST['id']][$value]) && !empty($_POST['currentTime'])) { if ($obj->addViewPercent($value)) { _session_start(); $_SESSION['addViewCount'][$_POST['id']][$value] = 1; } } } } } if (empty($_SESSION['addViewCount'][$_POST['id']]['time'])) { $resp = $obj->addView(); _session_start(); $_SESSION['addViewCount'][$_POST['id']]['time'] = strtotime("+{$seconds} seconds"); } elseif (!empty($_POST['currentTime'])) { $resp = VideoStatistic::updateStatistic($obj->getId(), User::getId(), intval($_POST['currentTime'])); } else { $resp = 0; } $count = $obj->getViews_count(); $obj2 = new stdClass(); $obj2->status = !empty($resp); $obj2->count = $count; $obj2->resp = $resp; echo json_encode($obj2);