-
Notifications
You must be signed in to change notification settings - Fork 0
/
watch_video.php
105 lines (84 loc) · 2.64 KB
/
watch_video.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/*
******************************************************************
| Copyright (c) 2007-2009 Clip-Bucket.com. All rights reserved.
| @ Author : ArslanHassan
| @ Software : ClipBucket , © PHPBucket.com
*******************************************************************
*/
define("THIS_PAGE",'watch_video');
define("PARENT_PAGE",'videos');
require 'includes/config.inc.php';
$userquery->perm_check('view_video',true);
$pages->page_redir();
//Getting Video Key
$vkey = @$_GET['v'];
$vkey = mysql_clean($vkey);
$vdo = $cbvid->get_video($vkey);
//pr($vdo,true);
assign('vdo',$vdo);
if(video_playable($vdo))
{
/**
* Please check http://code.google.com/p/clipbucket/issues/detail?id=168
* for more details about following code
*/
if(SEO=='yes')
{
//Checking if Video URL is Exactly What we have created
$vid_link = videoLink($vdo);
$vid_link_seo = explode('/',$vid_link);
$vid_link_seo = $vid_link_seo[count($vid_link_seo) -1 ];
//What we are getting
$server_link = $_SERVER['REQUEST_URI'];
$server_link_seo = explode('/',$server_link);
$server_link_seo = $server_link_seo[count($server_link_seo) -1 ];
//Now finally Checking if both are equal else redirect to new link
if($vid_link_seo != $server_link_seo)
{
/*//Redirect to valid link leaving mark 301 Permanent Redirect
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.$vid_link);
exit();*/
}
}
//Checking for playlist
$pid = $_GET['play_list'];
if(!empty($pid))
{
$plist = get_playlist( $pid );
if ( $plist ) {
assign( 'playlist', $plist );
}
}
//Calling Functions When Video Is going to play
call_watch_video_function($vdo);
subtitle($vdo['title']);
}else
$Cbucket->show_page = false;
//Return category id without '#'
$v_cat = $vdo['category'];
if($v_cat[2] =='#') {
$video_cat = $v_cat[1];
}else{
$video_cat = $v_cat[1].$v_cat[2];}
$vid_cat = str_replace('%#%','',$video_cat);
assign('vid_cat',$vid_cat);
$title = $vdo['title'];
$tags = $vdo['tags'];
$videoid = $vdo['videoid'];
$related_videos = get_videos(array('title'=>$title,'tags'=>$tags,
'exclude'=>$videoid,'show_related'=>'yes','limit'=>12,'order'=>'date_added DESC'));
if(!$related_videos){
$related_videos = get_videos(array('exclude'=>$videoid,'limit'=>12,'order'=>'date_added DESC'));
}
$playlist = $cbvid->action->get_playlist($pid,userid());
assign('playlist',$playlist);
//Getting Playlist Item
$items = $cbvid->get_playlist_items( $pid, 'playlist_items.date_added DESC' );
assign('items',$items);
Assign('videos', $related_videos);
//Displaying The Template
template_files('watch_video.html');
display_it();
?>