Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2] 3   Go Down

Author Topic: Download video hack for v. 1.4.2  (Read 39968 times)

0 Members and 1 Guest are viewing this topic.

mrandall131

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
    • NorthEastATVers
Re: Download video hack for v. 1.4.2
« Reply #20 on: January 17, 2006, 04:47:07 am »

Just to make sure, you are saying that I should copy the entire theme_html_picture function into the theme.php that I am using, and then make the modifications listed in step 2 above?

[edit]
Well, that's just what I did.  Worked perfect.  Thanks for the work guys!
« Last Edit: January 17, 2006, 05:28:51 am by TranzNDance »
Logged
SMF 1.1RC1 - www.northeastatvers.com/forum
Coppermine 1.4.3 - www.northeastatvers.com/gallery
---------------------------------------------------------------------------------
(http://www.northeastatvers.com/graphics/Logo_small.gif)

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #21 on: January 17, 2006, 10:54:03 am »

Thanks Paver for your reply and Sorry about all the trouble I caused.

I am not at all into php and so you will need to tell me what to edit and where to edit.

I am seeing quotation mark in the file and BTW the classic theme does not contain anything like that code. I can see the code in the theme.inc.php though.

In which of the files I need to edit the code and where ?

displayimage.php
theme.php
theme.inc.php

Also tell me the right code to paste inside the file.

Thanks in Advance

Hotvins
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Download video hack for v. 1.4.2
« Reply #22 on: January 17, 2006, 10:59:37 am »

edit theme.php. If code that you want to edit appears to be "missing" in your theme, copy the corresponding section from themes/sample/theme.php (that's the reference file). Do not copy the entire content of themes/sample/theme.php, but only the stuff you want to override.
Never, ever edit include/themes.inc.php
Logged

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #23 on: January 17, 2006, 11:58:09 am »

Thanks GauGau Bro

I did all the procedure and uploaded original versions of displayimage.php and theme.inc.php but still it doesn't work

it shows just a blank page with the letters "RIFFĸ" when I click on "Click here to download" link.

http://hotvins.300megs.com/vids/displayimage.php?album=lastup&cat=0&pos=0

Please help.
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #24 on: January 17, 2006, 06:25:41 pm »

hotvins:  Something's weird with your download.php script.  You obviously fixed your theme problem because that's all set.  Now download.php doesn't do what it's supposed to do.  Did you copy it exactly as it is shown?  download.php should not put up a banner or anything else; it should just send the header of a file to download.  ... unless your webhost is butting in and messing things up by putting up the banner & Google adwords on every page you post.  I don't know enough about webhosting issues to know if this is possible.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Download video hack for v. 1.4.2
« Reply #25 on: January 18, 2006, 12:20:52 am »

I don't know enough about webhosting issues to know if this is possible.
it is, free webhosts do this often. Usually, you can't use pre-made scripts like coppermine with those extremely ad-driven free webhosts, there are only a few exceptions to this rule.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #26 on: January 18, 2006, 12:24:43 am »

it is, free webhosts do this often. Usually, you can't use pre-made scripts like coppermine with those extremely ad-driven free webhosts, there are only a few exceptions to this rule.
In that case, I guess the only option is to use a "right click to save" note and then change the theme.php download link to point to the actual video file instead of the download.php script.
Logged

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #27 on: January 18, 2006, 02:09:27 am »

Quote
In that case, I guess the only option is to use a "right click to save" note and then change the theme.php download link to point to the actual video file instead of the download.php script.

To Paver & GauGau

Can you please tell me how to point it to actual video file instead of the download.php script ?

You see, you might be thinking that why does he dont know anything but I have not coded in php at all. I have just installed version 1.3 once according to instructions and if you can remember GauGau, I also had asked you about adding the code of Google Adsense at that time in the past.

So your detailed help will be appreciated in the current situation because it is not affordable for me to go for a ad free host or paid host at this point of time since I am a student.

Hotvins
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Download video hack for v. 1.4.2
« Reply #28 on: January 18, 2006, 02:12:44 am »

Are you a college student? Does your school give you webspace?

And you don't have to interpret minimal information as an expectation that you know more than you do. It's just that once we do enough support, we don't want to spend more time than necessary lest the user already knows the information. If not, we will provide more info.
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #29 on: January 18, 2006, 02:49:38 am »

hotvins: Where you currently have this line:
Code: [Select]
$pic_html .= "<p><a href=\"download.php?pid={$CURRENT_PIC_DATA['pid']}\">Click here to download</a></p>";Replace it with this line:
Code: [Select]
$pic_html .= "<p><a href=\"$picture_url\">Right-click and Save to download video</a></p>";
That should do it.
Logged

nontekkyguy

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 59
Re: Download video hack for v. 1.4.2
« Reply #30 on: March 09, 2006, 04:47:41 am »

If my theme (in this case fruity theme) does not contain the following:

Hmm, can't find that code in the mac_os_x theme..... any ideas?

Where in my newly updated theme.php would I paste this info, as in before and after which lines. 

This is my theme.php coding:

// HTML template for main menu
$template_sys_menu = <<<EOT
                <div class="topmenu">
                     {BUTTONS}
                </div>
EOT;

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='';

// HTML template for the image navigation bar
$template_img_navbar = <<<EOT

        <tr>
                <td align="center" valign="middle" class="navmenu" width="48px"><a name="top_display_media"></a>
                        <a href="{THUMB_TGT}" class="navmenu_pic" title="{THUMB_TITLE}"><img src="{LOCATION}images/thumbnails.gif" align="middle" border="0px" alt="{THUMB_TITLE}" /></a>
                </td>
//                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="javascript:;" class="navmenu_pic" onclick="blocking('picinfo','yes', 'block'); return false;" title="{PIC_INFO_TITLE}"><img src="{LOCATION}images/info.gif" border="0px" align="middle" alt="{PIC_INFO_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{SLIDESHOW_TGT}" class="navmenu_pic" title="{SLIDESHOW_TITLE}"><img src="{LOCATION}images/slideshow.gif" border="0px" align="middle" alt="{SLIDESHOW_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="100%">
                        {PIC_POS}
                </td>
<!-- BEGIN report_file_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{REPORT_TGT}" class="navmenu_pic" title="{REPORT_TITLE}"><img src="{LOCATION}images/report.gif" border="0" align="middle" alt="{REPORT_TITLE}" /></a>
                </td>
<!-- END report_file_button -->
<!-- BEGIN ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{ECARD_TGT}" class="navmenu_pic" title="{ECARD_TITLE}"><img src="{LOCATION}images/ecard.gif"  border="0px" align="middle" alt="{ECARD_TITLE}" /></a>
                </td>
<!-- END ecard_button -->
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{PREV_TGT}" class="navmenu_pic" title="{PREV_TITLE}"><img src="{LOCATION}images/prev.gif"  border="0px" align="middle" alt="{PREV_TITLE}" /></a>
                </td>
                <td align="center" valign="middle" class="navmenu" width="48px">
                        <a href="{NEXT_TGT}" class="navmenu_pic" title="{NEXT_TITLE}"><img src="{LOCATION}images/next.gif"  border="0px" align="middle" alt="{NEXT_TITLE}" /></a>
                </td>
        </tr>

EOT;
?>

Logged
learning requires patience; teaching requires more

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #31 on: March 09, 2006, 05:58:23 am »

@nontekkyguy: First of all, you should use the "CODE" button to bracket code you want to paste into a posting; it makes it so much easier to read.  Second of all, you shouldn't paste code or debug_info unless you are asked to.  In this case, you can merely say your theme.php does not include the code mentioned.

Finally, what code are you referring to?  It is not clear if you mean the $pic_html line I mentioned in the post just above yours or some other line since the line you quote is not clear what you mean.
Logged

Polifem

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Download video hack for v. 1.4.2
« Reply #32 on: March 13, 2006, 11:56:29 am »

hi ... i`m a novice in php ...

i`ve edited exactly what u said but it seems it doesn't do anything!!!


This is my theme.php

Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.1
  $Source:
  $Revision: 1.10 $
  $Author:
  $Date: 2005/04/30 07:13:16 $
**********************************************/

define('THEME_HAS_RATING_GRAPHICS'1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);

        
$pic_html  '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        
$pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\""$picture_url "\" />";
        
$pic_html .= '<embed '.$image_size['whole'].' src="'$picture_url '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';        
$pic_html .= "</object><br />\n";
        
$pic_html .= "<p><a href=\"$picture_url\">Right-click and Save to download video</a></p>";

?>


and this is my download.php


Code: [Select]
<?php
//
// hack to allow downloading of pictures and movies
// see http://forum.coppermine-gallery.net/index.php?topic=6464.0
//
define('IN_COPPERMINE',true);
define('UPLOAD_PHP',true);
define('DOWNLOAD_PHP',true);

require(
'include/init.inc.php');

function 
download()
{
        global 
$CONFIG$lang_upload_php$FORBIDDEN_SET;

        
$pid = (int) $_GET['pid'];

        
$sql 'select '.
                
'p.filepath,'.
                
'p.filesize,'.
                
'p.filename,'.
                
$CONFIG['TABLE_ALBUMS'].'.visibility, '.
                
'p.aid as aid '.
                
'from '.$CONFIG['TABLE_PICTURES'].' as p LEFT JOIN '.$CONFIG['TABLE_ALBUMS'].
                
' ON (p.aid = ' $CONFIG['TABLE_ALBUMS'].'.aid ) '.
                
' where pid='.$pid.' and approved="YES"';

        if (!empty(
$FORBIDDEN_SET)) {
                
$sql .= ' and '.$FORBIDDEN_SET;
        }

        
$result cpg_db_query($sql);

        
// No data returned; Display an error page
        
if (mysql_num_rows($result)==0) {
                
mysql_free_result($result);
                
cpg_die(CRITICAL_ERROR,$lang_upload_php['unknown']);
        }

        
$file mysql_fetch_assoc($result);
        
mysql_free_result($result);

        
// Empty output buffer
        
while(ob_get_level()>0) {
                
ob_end_clean();
        }

        
// Send binary information to the browser
        
header("Content-type: application/octet-stream");
        
header("Content-disposition: attachment; filename=".$file['filename']);
        
header("Content-Length: ".$file['filesize']);
        
header("Pragma: no-cache");
        
header("Expires: 0");
        
readfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);
}

download();
?>

my page is www.insomniaracing.org/gallery !!!


plz ... does anyone notice something fishy?
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #33 on: March 13, 2006, 07:24:46 pm »

Your problem is in your theme.php; you are not customizing theme.php correctly.  You need to copy the entire function or variable you want to customize from sample/theme.php.  You only copied a few lines.  If you read this entire thread, particularly mrandall's note about copying the theme_html_picture function, you'll understand better how to get this customization working.

Copy the entire theme_html_picture function from sample/theme.php into your theme.php, then modify the lines in that function.
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Download video hack for v. 1.4.2
« Reply #34 on: March 16, 2006, 05:05:49 am »

How can I prevent unregistered users from using this to download videos?

I've used the solution in the FAQ of limiting unregistered users to thumbnails only, and I've also edited httpd.conf to prevent direct linking to video types. But if someone just directly uses a link like this http://www.mygallery.net/download.php?pid=176 they can download the video or hotlink to it on their site.

Can I just use the same code from the FAQ, i.e.
Code: [Select]
if (!USER_ID) cpg_die(ERROR, 'You need to register to access this page', __FILE__, __LINE__);
and if so, would it go after the line
Code: [Select]
require('include/init.inc.php');
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #35 on: March 16, 2006, 07:38:38 am »

Sounds good to me.  Why not try it out?
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Download video hack for v. 1.4.2
« Reply #36 on: March 21, 2006, 03:18:55 am »

I waited a few days as a "courtesy" to all those who hotlinked and then tried it out. Seems to work fine. I guess I was just being overly cautious in messing with code I haven't really worked with.

Thanks.
Logged

wuurp

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Download video hack for v. 1.4.2
« Reply #37 on: April 09, 2006, 03:42:48 am »

I wasn't sure if I should add to this thread, or start a new topic, but I am having memory problems using this hack.

I've been using it without problems for a couple months, but in the last few days, I have had problems running out of memory. What seems to be happening is that while the file is being downloaded, the particulary httpd thread starts consuming more memory. So if I have an 80MB file, at the end of the download, that thread is using 80+MB. After the download finishes, usually the memory is released, but not always apparently, so after a day each httpd thread was using 16-20MB even when idle. Add in a few large downloads and soon apache is using 100's of MB. I just recently updated to 1.4.4 but a clean install of both 1.4.2 and 1.4.4 exhibit this behaviour.

The only change I know of on the server is going from a 2.4 to a 2.6.8 kernel which is about the time I started having memory problems.

I've had to go back to just using a download link, which doesn't have any significant effect on the amount of memory used, but I'd like to use this again if someone has an idea how to fix it.

Logged

superstan

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 37
    • planetdarren
Re: Download video hack for v. 1.4.2
« Reply #38 on: October 14, 2006, 10:37:29 pm »

Please can you help me with this

There is no code that looks like anything you suggest on the 1st post - that i can alter in theme.php(rainyday)

when i go to the sample theme.php - im not sure which code i need -
there is something about 'if a user has no plugin' that looks like it - but i dont know how much of the code i need

whateverr i try i get syntax errors - unexpected {{
Logged
(http://www.planetdarren.co.uk/forums/images/avatars/gallery/darren/dazboy.gif)

superstan

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Female
  • Posts: 37
    • planetdarren
Re: Download video hack for v. 1.4.2
« Reply #39 on: October 14, 2006, 10:55:42 pm »

hi guys ive sorted it in fashion by copying the whole of the sample theme.php to my template theme.php - but it does spoil the look of the mavigation a bit - but at least it works

why do i have negative karma - what have I done  ???
Logged
(http://www.planetdarren.co.uk/forums/images/avatars/gallery/darren/dazboy.gif)
Pages: 1 [2] 3   Go Up
 

Page created in 0.029 seconds with 20 queries.