Results 1 to 9 of 9

Thread: Download Video Mod for 2.7

  1. #1

    Default Download Video Mod for 2.7

    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:

  2. #2

    Default Re: Download Video Mod for 2.7

    I would love to see this done when the file is on another server

  3. #3
    Join Date
    Feb 2008
    Location
    Greece
    Posts
    235

    Default Re: Download Video Mod for 2.7

    Good mod but do not work with multyservers. For more info go to class.video_player.php and you will find it. :D
    something like this i think
    Code:
            if ($this->video_info['video_server_id'] == 0)
            {
                $file = VSHARE_URL . '/flvideo/' . $video_folder . $this->video_info['video_flv_name'];
                $video_id = $this->video_info['video_id'];
            }
            else
            {
                $sql = "SELECT * FROM `servers` WHERE
    			       `id`='" . (int) $this->video_info['video_server_id'] . "'";
                $result = mysql_query($sql) or mysql_die($sql);
                $server_info = mysql_fetch_assoc($result);
                $video_id = $this->video_info['video_id'];
    
                if ($server_info['server_type'] == 2)
                {
                    $uri_prefix = '/dl/';
                    $f = '/' . $this->video_info['video_folder'] . $this->video_info['video_flv_name'];
                    $t = time();
                    $t_hex = sprintf('%08x', $t);
                    $m = md5($server_info['server_secdownload_secret'] . $f . $t_hex);
                    $file = $server_info['url'] . $uri_prefix . $m . '/' . $t_hex . $f;
                }
                else
                {
                    $file = $server_info['url'] . '/' . $this->video_info['video_folder'] . $this->video_info['video_flv_name'];
                }
            }
    
        }
    
        function youtube()
        {
          echo 'Video download disabled';
        exit();
        }
    
        function revver()
        {
           echo 'Video download disabled';
        exit();
        }
    
        function metcafe()
        {
            echo 'Video download disabled';
        exit();
        }
    
        function embedded_code()
        {
            echo 'Video download disabled';
        exit();
        }
    
        function flv_url()
        {
            global $config;
            $file = $this->video_info['video_embed_code'];
            $video_id = $this->video_info['video_id'];
            $video_folder = $this->video_info['video_folder'];
        }

  4. #4

    Default Re: Download Video Mod for 2.7

    Quote Originally Posted by carefree
    I would love to see this done when the file is on another server
    I would be glad to help but I only have one server at home.
    Ill setup a virtual server on this box and work on it :D

  5. #5
    Join Date
    Feb 2008
    Location
    Greece
    Posts
    235

    Default Re: Download Video Mod for 2.7

    ok i will do it when i will have time and i will post it :D

  6. #6

    Default Re: Download Video Mod for 2.7

    Nup you still cant use readfile() function from another server. Ill work on a ftp() mod

  7. #7

    Default Re: Download Video Mod for 2.7

    Quote Originally Posted by carefree
    Nup you still cant use readfile() function from another server. Ill work on a ftp() mod
    if the file can be streamed it can be downloaded got off work late tonight but I have a buggy version going now give me another day or so Ramstein has the right Idea wrong file

  8. #8
    Join Date
    Feb 2008
    Location
    Greece
    Posts
    235

    Default Re: Download Video Mod for 2.7

    Also youtube videos download could be reachable with this code help :D
    http://www.ngcoders.com/php/php-youtube ... der-script

  9. #9

    Unhappy MOD Error

    The MOD is installed fine but when tried to download flv the file started asked for saving.

    The file was ZERO bites.

    (the actual video was fine and plays okay on the website)

    Help please .... !!!

Similar Threads

  1. Better Download Video Mod
    By leki in forum Template Modifications
    Replies: 25
    Last Post: 01-17-2009, 03:59 AM
  2. Video download protection
    By videlov in forum General Discussions
    Replies: 10
    Last Post: 06-10-2008, 05:51 AM
  3. Allow user to download FLV video
    By gary in forum Installation Support
    Replies: 2
    Last Post: 04-28-2008, 11:52 PM
  4. cannot download .wmv video
    By robaldo in forum Installation Support
    Replies: 1
    Last Post: 03-24-2008, 08:37 AM
  5. Video Download Option
    By scwebmaster in forum Feature Requests
    Replies: 0
    Last Post: 02-09-2008, 05:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •