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]   Go Down

Author Topic: Don't Let Anybody To Download The Lightbox As Zip  (Read 6788 times)

0 Members and 1 Guest are viewing this topic.

pressurecooker

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Environmental Articles
Don't Let Anybody To Download The Lightbox As Zip
« on: April 11, 2008, 03:07:04 pm »

Hi,

So I got a Lightbox and I have enabled a function to let Zip downloads of the Lightbox. The problem was that anyone could download anything despite of permissions.

I read this post http://forum.coppermine-gallery.net/index.php/topic,38437.0.html where Nibbler suggested a solution to a similar problem and it gave me inspiration. What I wanted to do was restricting guests from having any downloads at all. Here's what I did:

Replaced this bit of zipdownload.php
Code: [Select]
$cwd = "./{$CONFIG['fullpath']}";
$zip = new zip_file('pictures.zip');
$zip->set_options(array('basedir' => $cwd, 'inmemory' => 1, 'recurse' => 0, 'storepaths' => 0));
$zip->add_files($filelist);
$zip->create_archive();
ob_end_clean();
$zip->download_file();
With this bit:
Code: [Select]
if (USER_ID){
$cwd = "./{$CONFIG['fullpath']}";
$zip = new zip_file('pictures.zip');
$zip->set_options(array('basedir' => $cwd, 'inmemory' => 1, 'recurse' => 0, 'storepaths' => 0));
$zip->add_files($filelist);
$zip->create_archive();
ob_end_clean();
$zip->download_file();
} else {
pageheader($lang_error);
starttable('-2', $lang_error);
print <<<EOT
<tr>
        <td align="center" class="tableb">
      <p>You need to be registered to access downloads. <a href="whateveryoulike.php">Click here to become a member</a>.</p>
      </td>
</tr>
EOT;
endtable();
pagefooter();
ob_end_flush();
}

Now when a curious person browses a gallery and decides it would be a good idea to steal a picture or two, he/she gets a prompt to register when clicking on "Download as Zip file".
Logged
Join the green campaign - Environmental Articles

paquets

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 59
Re: Don't Let Anybody To Download The Lightbox As Zip
« Reply #1 on: January 22, 2010, 07:38:09 pm »

Great mod. Thanks!
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.