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 (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
$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:
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".
Great mod. Thanks!