42.patch

jobin dcruz, 04/23/2010 12:14 am

Download (136 kB)

 
b/templates/view_video.tpl
195 195
                        {if $view.video_info.video_allow_embed eq "enabled" && $embed_show eq 1}
196 196
                            <label>Embeddable Player:</label>
197 197
                            <br /><br />
198
                            <input name="video_play" value='{if $embed_type eq "0"}<iframe vspace="0" hspace="0" allowtransparency="true" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border:0px;" width="435" height="470" SRC="{$base_url}/show.php?id={$view.video_info.video_id}"></iframe>{else}<object width="425" height="350" type="application/x-shockwave-flash" data="{$base_url}/player/player.swf"><param name="movie" value="{$base_url}/player/player.swf"><param name="flashvars" value="&file={$base_url}/xml_playlist.php?id={$view.video_info.video_id}&height=350&image={$view.video_info.video_thumb_url}/thumb/{$view.video_info.video_folder}{$view.video_info.video_id}.jpg&width=425&location={$base_url}/player/player.swf&logo={$img_css_url}/images/watermark.gif&link={$watermark_url}&linktarget=_blank"/></object>{/if}' size="60" onclick="javascript:document.linkForm.video_play.focus();document.linkForm.video_play.select();" readonly="readonly" />
198
                            <input name="video_play" value='{if $embed_type eq "0"}<iframe vspace="0" hspace="0" allowtransparency="true" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" style="border:0px;" width="600" height="500" SRC="{$base_url}/show.php?id={$view.video_info.video_id}"></iframe>{else}<object width="560" height="340"><param name="movie" value="{$base_url}/v/{$view.video_info.video_id}&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="{$base_url}/v/{$view.video_info.video_id}&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>{/if}' size="60" onclick="javascript:document.linkForm.video_play.focus();document.linkForm.video_play.select();" readonly="readonly" />
199 199
                            <div>
200 200
                                (Put this video on your website. Works on Friendster, eBay, Blogger, MySpace!)
201 201
                            </div>
......
358 358
    
359 359
    </div> <!-- related-video-playing-->
360 360

  
361
</div> <!-- video-sidebar -->
361
</div> <!-- video-sidebar -->
362
- 
b/video_embed.php
1
<?php
2
/******************************************************************************
3
 *
4
 *   COMPANY: BuyScripts.in
5
 *   PROJECT: vShare Youtube Clone
6
 *   VERSION: 2.8
7
 *   LISENSE: http://buyscripts.in/vshare-license.html
8
 *   WEBSITE: http://buyscripts.in/youtube_clone.html
9
 *
10
 *   This program is a commercial software and any kind of using it must agree
11
 *   to vShare license.
12
 *
13
 ******************************************************************************/
14

  
15
require 'include/config.php';
16

  
17
$video_id = isset($_GET['video_id']) ? (int) $_GET['video_id'] : 0;
18

  
19
if ($video_id == 0)
20
{
21
    echo "invalid video id";
22
    exit();
23
}
24

  
25
$sql = "SELECT * FROM `videos` WHERE
26
       `video_id`='$video_id'";
27
$result = mysql_query($sql) or mysql_die($sql);
28
$video_info = mysql_fetch_assoc($result);
29

  
30
$video_token = time() . rand();
31
$_SESSION['video_token'] = $video_token;
32

  
33
$video_thumb_url = $servers[$video_info['video_thumb_server_id']];
34
$logo = IMG_CSS_URL . '/images/watermark.gif';
35
$image = $video_thumb_url . '/thumb/' . $video_info['video_folder'] . '/' . $video_id . '.jpg';
36

  
37
if ($video_info['video_server_id'] > 0)
38
{
39
    $file_url = 'file=' . get_file_url($video_info['video_server_id'], $video_info['video_folder'], $video_info['video_flv_name']);
40
}
41
else if ($video_info['video_vtype'] == '7')
42
{
43
    $file_url = 'file=' . $video_info['video_youtube_url'];
44
}
45
else
46
{
47
    $file_url = 'file=' . $video_id . '.flv&streamer=' . VSHARE_URL . '/video_stream.php&token=' . $video_token;
48
}
49

  
50
$vide_flv_player = VSHARE_URL . '/player/player.swf?';
51
$vide_flv_player .= $file_url;
52
$vide_flv_player .= '&image=' . $image;
53
$vide_flv_player .= '&logo=' . $logo;
54

  
55
$sql = "UPDATE `videos` SET `video_view_number`=`video_view_number`+1 WHERE `video_id`=$video_id";
56
$result = mysql_query($sql);
57

  
58
header("Content-Type: video/flv");
59
Header("Location: $vide_flv_player");
60

  
61

  
b/video_stream.php
1
<?php
2
/******************************************************************************
3
 *
4
 *   COMPANY: BuyScripts.in
5
 *   PROJECT: vShare Youtube Clone
6
 *   VERSION: 2.8
7
 *   LISENSE: http://buyscripts.in/vshare-license.html
8
 *   WEBSITE: http://buyscripts.in/youtube_clone.html
9
 *
10
 *   This program is a commercial software and any kind of using it must agree
11
 *   to vShare license.
12
 *
13
 ******************************************************************************/
14

  
15
require 'include/config.php';
16

  
17
define('VSHARE_GET_FILE', 'file');
18
define('VSHARE_GET_POSITION', 'position');
19
define('VSHARE_GET_AUTHENTICATION', 'token');
20

  
21
$id = str_replace('.flv', '', $_GET[VSHARE_GET_FILE]);
22

  
23
$sql = "SELECT * FROM `videos` WHERE `video_id`=" . (int) $id;
24
$result = mysql_query($sql);
25
$video_info = mysql_fetch_assoc($result);
26

  
27
$stoken = isset($_SESSION['video_token']) ? $_SESSION['video_token'] : md5(time());
28

  
29
if (isset($_GET[VSHARE_GET_FILE]))
30
{
31
    $seekPos = isset($_GET[VSHARE_GET_POSITION]) ? $_GET[VSHARE_GET_POSITION] : 0;
32
    $file = VSHARE_DIR . '/flvideo/' . $video_info['video_folder'] . $video_info['video_flv_name'];
33
    
34
    if (! file_exists($file) || $_GET[VSHARE_GET_AUTHENTICATION] != $stoken)
35
    {
36
        print('<b>ERROR:</b>could not find');
37
        exit();
38
    
39
    }
40
    
41
    if (file_exists($file))
42
    {
43
        @ob_end_clean();
44
        
45
        $fh = fopen($file, 'rb') or die('<b>ERROR:</b>could not open');
46
        
47
        $fileSize = filesize($file) - (($seekPos > 0) ? $seekPos + 1 : 0);
48
        
49
        header("Content-Type: video/flv");
50
        header("Content-Disposition: attachment; filename=\"" . $video_info['video_flv_name'] . "\"");
51
        header("Content-Length: " . $fileSize);
52
        
53
        if ($seekPos != 0)
54
        {
55
            print('FLV');
56
            print(pack('C', 1));
57
            print(pack('C', 1));
58
            print(pack('N', 9));
59
            print(pack('N', 9));
60
        }
61
        
62
        fseek($fh, $seekPos);
63
        
64
        $packet_size = 90 * 1024;
65
        
66
        while (! feof($fh))
67
        {
68
            if (filesize($file) < 33554400)
69
            {
70
                print(fread($fh, filesize($file)));
71
            }
72
            else
73
            {
74
                print(fread($fh, $packet_size));
75
            }
76
            
77
            ob_clean();
78
        }
79
    }
80

  
81
}
82

  
83
?>
0
- 
b/.htaccess
77 77
RewriteRule ^([^/\.]+)/groups/(.*)$ user_groups.php?user_name=$1&page=$2 [L,QSA]
78 78
RewriteRule ^([^/\.]+)/edit/(.*)$ user_profile_edit.php?user_name=$1 [L,QSA]
79 79
RewriteRule ^([^/\.]+)?/?$ user.php?user_name=$1 [L,QSA]
80
RewriteRule ^v/(.*) video_embed.php?video_id=$1 [L,QSA]
80 81

  
81 82
<IfModule mod_security.c>
82 83
SecFilterEngine Off
83
- 
... This diff was truncated because it exceeds the maximum size that can be displayed.