This mod allows registered users to download videos, FLV or Orginal video file or both. With Admin control for Vshare 2.7
First things first Back up Back up Back Up
open .htaccess find
Code:
RewriteRule ^download/(.*)/ download.php?video_id=$1 [L,QSA]
Add this below
Code:
RewriteRule ^fldownload/(.*)/ fldownload.php?video_id=$1 [L,QSA]
Then save file
copy this code and call it fldownload.php save to root of vshare
Code:
<?php
/******************************************************************************
*
* COMPANY: BuyScripts.in
* PROJECT: vShare Youtube Clone
* VERSION: 2.7
* LISENSE: http://buyscripts.in/vshare-license.html
* WEBSITE: http://buyscripts.in/youtube_clone.html
*
* This program is a commercial software and any kind of using it must agree
* to vShare license.
*
******************************************************************************/
require 'include/config.php';
require 'include/class.video.php';
if ($config['allow_fldownload'] != 1)
{
echo 'Video download disabled';
exit();
}
User::is_logged_in();
$video_info = Video::get_video_info($_GET['video_id']);
$video_name = $video_info['video_flv_name'];
$video_dir = $video_info['video_folder'];
$file_path = VSHARE_DIR . '/flvideo/' . $video_dir . $video_name;
if (($video_name == '') || (! is_file($file_path)) || (! file_exists($file_path)))
{
echo 'File not found.';
exit();
}
if (ini_get('zlib.output_compression'))
{
ini_set('zlib.output_compression', 'Off');
}
header('Pragma: public');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . basename($video_name) . '";');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($video_name));
readfile("$file_path");
exit();
open view_video.tpl add below
Code:
{if $allow_fldownload == 1 && $view.video_info.video_vtype eq 0}
<a href="{$base_url}/fldownload/{$view.video_info.video_id}/">
[img]{$img_css_url}/images/download.png[/img] Download Flv
</a>
{/if}
Now open in admin folder miscellaneous.php find this
Code:
if (is_numeric($_POST['allow_download']))
{
$sql = "UPDATE `sconfig` SET
`svalue`='" . (int) $_POST['allow_download'] . "' WHERE
`soption`='allow_download'";
mysql_query($sql) or mysql_die($sql);
$smarty->assign('allow_download', $_POST['allow_download']);
}
add this below
Code:
if (is_numeric($_POST['allow_fldownload']))
{
$sql = "UPDATE `sconfig` SET
`svalue`='" . (int) $_POST['allow_fldownload'] . "' WHERE
`soption`='allow_fldownload'";
mysql_query($sql) or mysql_die($sql);
$smarty->assign('allow_fldownload', $_POST['allow_fldownload']);
}
then open in templates/admin miscellaneous.tpl find this
Code:
<div>
<label for="allow_download">Allow Video Download:</label>
<select name="allow_download" id="allow_download">
<option value="0" {if $allow_download =='0'}selected="selected"{/if}>No</option>
<option value="1" {if $allow_download =='1'}selected="selected"{/if}>Yes</option>
</select>
</div>
Add this below
Code:
<div>
<label for="allow_fldownload">Allow Video FLV Download:</label>
<select name="allow_fldownload" id="allow_fldownload">
<option value="0" {if $allow_fldownload =='0'}selected="selected"{/if}>No</option>
<option value="1" {if $allow_fldownload =='1'}selected="selected"{/if}>Yes</option>
</select>
</div>
Backup SQL now add this to SQL
Code:
INSERT INTO `sconfig` (`soption`, `svalue`) VALUES('allow_fldownload', '0');
your done have fun
this lets you have control over what download you want to use FLV or Original even both under site settings Miscellaneous
:wink: :mrgreen:
Bookmarks