Merge pull request #416 from ASponch/master

Fix : Display only public video and increased cookie time for a video of duration more than one hour
This commit is contained in:
Fahad Abbas 2018-05-11 15:19:45 +05:00 committed by GitHub
commit 7d1716d5f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View file

@ -2184,8 +2184,11 @@
{
if(!isset($_COOKIE['video_'.$id])) {
$currentTime = time();
$vdetails = get_video_details($id);
// Cookie life time at least 1 hour else if video duration is bigger set at video time.
$cookieTime = ($vdetails['duration'] > 3600) ? $vdetails['duration'] : $cookieTime = 3600;
$db->update(tbl("video"),array("views", "last_viewed"),array("|f|views+1",$currentTime)," videoid='$id' OR videokey='$id'");
setcookie('video_'.$id,'watched',time()+3600);
setcookie('video_'.$id,'watched',time()+$cookieTime);
}
}
break;

View file

@ -30,7 +30,7 @@ switch($mode)
case 'recent':
default:
{
$videos = get_videos(array('limit'=>$limit,'order'=>'date_added DESC'));
$videos = get_videos(array('limit'=>$limit,'broadcast'=>'public','order'=>'date_added DESC'));
$title = "Recently Added Videos";
}
break;
@ -38,21 +38,21 @@ switch($mode)
case 'views':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'views DESC'));
$videos = get_videos(array('limit'=>$limit,'broadcast'=>'public','order'=>'views DESC'));
$title = "Most Viewed Videos";
}
break;
case 'rating':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'rating DESC'));
$videos = get_videos(array('limit'=>$limit,'broadcast'=>'public','order'=>'rating DESC'));
$title = "Top Rated Videos";
}
break;
case 'watching':
{
$videos = get_videos(array('limit'=>$limit,'order'=>'last_viewed DESC'));
$videos = get_videos(array('limit'=>$limit,'broadcast'=>'public','order'=>'last_viewed DESC'));
$title = "Videos Being Watched";
}
break;