forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: erostew on October 25, 2007, 08:53:17 pm

Title: [cpg1.4.x]: Download a Zipped Album With Basic Security
Post by: erostew on October 25, 2007, 08:53:17 pm
This was originally posted in a reply to http://forum.coppermine-gallery.net/index.php?topic=43527.0
Since that thread contains multiple hack versions it is very cluttered and hard to follow. Since my original post there I have made some small changes to to the commenting in the zip.php file located in the attached securezip.zip file. I also cleaned up some typos, etc. in the installation instructions. And I included a readme.html with the full installation instructions.


Download a Zipped Album With Basic Security

I have wanted to have the functionality of users being able to download a zip of an entire album/folder for a long, long time. But I never manged to get it working on my own. That's one reason that I decided to try out CPG. So I tried out the various hacks in the forum and managed to get the zip.php version to work. The zipalbum.php version does not work at all as posted. There are errors in the scripting.

I was happy to get zip downloads working, but there was one major problem. Lack of any kind of security. All a user had to do was replace the number in the aid portion of the url and he could download any album, including private ones. Well there can be many many reasons why that is completely unacceptable. You may have family pictures stored in your CPG that you don't want the world at large to see, etc. My main reason for needing better security is that I want to be able to make updates at anytime, and then make them active on a set day by changing the permissions from admin-only to everyone.

So I decided to use the built in user levels to secure the zip script. An album with "everyone" permissions has "0" set in the visibility colum of the cpgxxx_albums table. An "admin" gallery has a "1", etc. I figured the easiest thing to implement would be a check to see what the content of the visibility column was, and then disallow any downloads if the result was not "0". I only use admin and everyone in my CPG, so that works perfectly for me. You might want to change things around a bit to suit your own setup. To find out what the visibilty value is for any particular setting just change the setting in the album's properties and then check the contents of the table with phpmyadmin or MySQL Administrator.

This is tested and working on my linux, apache, mysql, php4 server. Your mileage may vary.

This script contains work by h3nn3s, Beme, MoolFreet, easyjava and Nibbler. Thanks guys!


This mod does not require any modification of any core CPG files so it should be installable on most versions of CPG or future versions. Rather than a CPG mod it is actually a template modification. It should not cause a problem for you to update to a different version of CPG unless the way themes work is changed. With that said I have only tested it with 1.4.13, 1.4.14 and 1.4.16. I have tried it with the following themes: Rainy Day, Classic and Water Drop. Also with a heavily customized Rainy Day variant that I am using in my CPG. It works with no problems with Stramm's ModPack installed. I have tested it with CPG 1.5 and it is working. However I am not using the latest build of 1.5.

Detailed installation instructions:

# 1 ) Download the securezip.zip attached to this message.
# 2 ) Unzip it and upload zip.php to the root folder of your CPG installation. (Same folder as the index.php)
# 3 ) Open the file in your editor of choice and look for:
Code: [Select]
/* Write here the name of the folder  where the zip will be created */
$sFolderZip = "zipfiles/";
It starts on line 5. Either change the name (make sure it has the "/" on the end!) of the folder or else make a folder in the root of your CPG installation called "zipfiles". Whichever one you choose, you will probably have to chmod to 777 to get the script to work.

# 4 ) Navigate to the folder of the template you are using. Something like: /yourwwwfolder/CPG/templates/name_of_template.

# 5 ) Open themes/yourtheme/theme.php in your editor of choice. Copy the following code into your theme.php file just above the
Code: [Select]
?>at the end of the file.
Code: [Select]
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
    global $CONFIG;
    global $template_thumb_view_title_row,$template_fav_thumb_view_title_row, $lang_thumb_view, $template_tab_display, $template_thumbnail_view, $lang_album_list;

    static $header = '';
    static $thumb_cell = '';
    static $empty_cell = '';
    static $row_separator = '';
    static $footer = '';
    static $tabs = '';
    static $spacer = '';

    if ($header == '') {
        $thumb_cell = template_extract_block($template_thumbnail_view, 'thumb_cell');
        $tabs = template_extract_block($template_thumbnail_view, 'tabs');
        $header = template_extract_block($template_thumbnail_view, 'header');
        $empty_cell = template_extract_block($template_thumbnail_view, 'empty_cell');
        $row_separator = template_extract_block($template_thumbnail_view, 'row_separator');
        $footer = template_extract_block($template_thumbnail_view, 'footer');
        $spacer = template_extract_block($template_thumbnail_view, 'spacer');
    }

    $cat_link = is_numeric($aid) ? '' : '&cat=' . $cat;
    $uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&uid=' . $_GET['uid'] : '';

    $theme_thumb_tab_tmpl = $template_tab_display;

    if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' ? $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . $uid_link . '&page=%d'));
    } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
    }

    $thumbcols = $CONFIG['thumbcols'];
    $cell_width = ceil(100 / $CONFIG['thumbcols']) . '%';

    $tabs_html = $display_tabs ? create_tabs($nbThumb, $page, $total_pages, $theme_thumb_tab_tmpl) : '';
    // The sort order options are not available for meta albums
    if ($sort_options) {
        $param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        // MOD - begin
$param['{ALBUM_NAME}'] .= '&nbsp;<a href="zip.php?aid=' . $aid . '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end
        $title = template_eval($template_thumb_view_title_row, $param);
    } else if ($aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       $param = array('{ALBUM_NAME}' => $album_name,
                             '{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       $title = template_eval($template_fav_thumb_view_title_row, $param);
    }else{
        $title = $album_name;
    }


    if ($mode == 'thumb') {
        starttable('100%', $title, $thumbcols);
    } else {
        starttable('100%');
    }

    echo $header;

    $i = 0;
    foreach($thumb_list as $thumb) {
        $i++;
        if ($mode == 'thumb') {
            if ($aid == 'lastalb') {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            }
        } else {
            $params = array('{CELL_WIDTH}' => $cell_width,
                '{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                '{THUMB}' => $thumb['image'],
                '{CAPTION}' => $thumb['caption'],
                '{ADMIN_MENU}' => ''
                );
        }
        echo template_eval($thumb_cell, $params);

        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
    }
    for (;($i % $thumbcols); $i++) {
        echo $empty_cell;
    }
    echo $footer;

    if ($display_tabs) {
        $params = array('{THUMB_COLS}' => $thumbcols,
            '{TABS}' => $tabs_html
            );
        echo template_eval($tabs, $params);
    }

    endtable();
    echo $spacer;
}
This is assuming that you are using CPG 1.4.13 - 1.4.16 with the Classic, RainyDay or Waterdops themes. I haven't tested it in other themes. Your theme may have some or all of this code in it already. If that's the case then search the code in your theme.php for:
Code: [Select]
$param = array('{ALBUM_NAME}' => $album_name,
            '{AID}' => $aid,
            '{PAGE}' => $page,
            '{NAME}' => $lang_thumb_view['name'],
            '{TITLE}' => $lang_thumb_view['title'],
            '{DATE}' => $lang_thumb_view['date'],
            '{SORT_TA}' => $lang_thumb_view['sort_ta'],
            '{SORT_TD}' => $lang_thumb_view['sort_td'],
            '{SORT_NA}' => $lang_thumb_view['sort_na'],
            '{SORT_ND}' => $lang_thumb_view['sort_nd'],
            '{SORT_DA}' => $lang_thumb_view['sort_da'],
            '{SORT_DD}' => $lang_thumb_view['sort_dd'],
            '{POSITION}' => $lang_thumb_view['position'],
            '{SORT_PA}' => $lang_thumb_view['sort_pa'],
            '{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
and immediately after that, insert this:
Code: [Select]
// MOD - begin
$param['{ALBUM_NAME}'] .= '&nbsp;<a href="zip.php?aid=' . $aid . '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end
As MoolFreet pointed out you can change the formatting of the URL in that snippet to use an icon image instead of text if you like.

# 6 ) Download the pclzip library from http://www.phpconcept.net/pclzip/index.php#download. Unzip it and and upload pclzip.lib.php to your CPG root.
# 7 ) You're done! If you want to test it just go to an album and click the download link on the top of the thumbnail view. If you want to test the security just set an album to anything except "everyone" in the album's properties, and then try to d/l it by changing the aid=123 portion of the zip url to the aid (album ID) number of the restricted gallery. You should see a white page with a red error message.

Known Limitations:

    * If you are logged in as admin you will still see the "Download Album" link, but if you click it permission will be denied. Personally I don't have any need to download a zip because I am the only one allowed to upload to my site.
    * As written ONLY albums with permission set to "Everyone" can be downloaded.
    * The coding of the error message is inelegant, but it works.
    * If you change themes you will need to do the same modifications to the theme.php of your new theme.

I am NOT a real coder. I struggled like hell to get this tiny bit of code to work. If you can improve it then feel free to do so. Hopefully something like this might make it into the next release of CPG. If you are using the "download favorites" function included in CPG you may be interested to know that it also allows the downloading of favorites without checking if the pic is in an album that is private  or not. However that script only downloads the files that are already present in favorites. That makes it less of a risk because if he can't see an album a user can't add an image to his favorites. I have not checked to see if it is possible to add to favorites by changing the url around.

Possible Modifications:

If you know some PHP you can change the security settings to suit your own setup. For instance you could change
Code: [Select]
 != '0'Into something like
Code: [Select]
 ==1That would allow albums of all levels except 1 to be downloaded. That has a serious drawback if you allow private albums for anyone except admins because you will have changed the code from protecting all albums except "everyone" viewable albums, to only protecting "admin" albums.

See the 3rd post in this topic for how to modify it to use the "registered users" group instead of "everyone"

You can also mess around with elseif statements to try and make it fit better with your setup. As a general rule it is easier and safer to disallow permissions than it is to grant them when dealing with multiple user groups.

The best way to handle security would be to check if the user was logged in and then check to see if he or his user group was allowed access to the album. However that is a lot more complex and not really something suitable for a quick hack/mod.

Enjoy!

Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on October 28, 2007, 03:28:51 am
I made a small change to zip.php to remove the path from the generated archive. No need to have the files 3 or folders deep. After extraction the files were inside albums/folder1/folder2/etc.

An entirely optional upgrade. If you want it just d/l the newer file securezip1.01.zip attached to the first post.

If you already installed the first version just overwrite the old zip.php with the new. If you haven't installed it before just use install as normal.

Regards
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on October 28, 2007, 03:50:36 am
If you use the registered users group and don't want to allow unregistered users to d/l zips you can make the following changes to the install to suit your setup.

look in zip.php for:
Code: [Select]
if ($priv["visibility"] != '0') {and change it to:
Code: [Select]
if ($priv["visibility"] != '2') {
This will change the script to only allow albums with privileges set to "registered user" to be zip downloaded. Of course this means that "everyone" and "guests" will not be able to download.

In case you are wondering about the levels...
In cpgXXX_albums each album has a visibilty setting. 0 means everyone, 1 is admin only, 2 is registered user and 3 is guest user. Higher levels have the privileges of the lower level in addition to their own. Admins can access admin, registered, guest and everyone albums. Registered users can access registered, guest and everyone, etc. Everyone seems to be effectively the same as guest. I'm not sure about private user albums because I don't use those in my CPG.
Title: A note about server requirements.
Post by: erostew on November 05, 2007, 12:27:01 pm
Zipping an album places a fairly heavy burden on the server. Processing power isn't too big a deal. My server is about 3 years old and zipping a good size album is pretty fast. But it DOES take a good chunk of memory and it does use a lot of cpu cycles for that 5-10 seconds. You will probably have to adjust your settings a bit in php.ini to zip anything more than a small album.

I have memory usage set to 32M and I have successfully tested with an album of 174 pics in 1280x833. Total filesize of the zip was 20.63MB. I couldn't manage more than about 30 pics until I turned up the memory from 20M. If you are running on a shared server this mod may not be for you. You can still try it but your host is not likely to give you more memory usage for php. You might even get into trouble for using too many resources if you use this on a busy site.

I'd be interested to hear from anyone that does or does not get this mod to work on their server. Let me know what your settings are in php.ini. I think it's necessary to have the entire zipfile in memory plus a certain amount extra for overhead, but I could be wrong.

To Do: When the mod writes the file to disk it stays in whatever folder you have configured after sending the file to the user. I'd like to know if the pclzip class just writes over the file on the next request for that particular album, or if it just checks to see if anyfiles need to be added and appends or exits based on that. Not sure how to test it. The timestamp changes on the file so I think it just overwrites.

Might be a good idea to have a check to see if the file exists before passing the filelist to the class for zipping. It could save a lot of resources by not duplicating previously done work. But that would cause a problem with an album that gets new files sometimes. So it would have to be coded to check the contents of the zip and create/not create based on that. Pretty complex for a simple mod.

Also might be useful to delete the file after the user gets it, to save disk space. Done! Thanks to easyjava and Nibbler.

Also To Do: Check for compatibilty with CPG1.5 and possibly turn it into a plugin. I installed 1.5 for testing but unfortunately was not able to get the installation to work well enough to test anything. It installed OK but I was unable to save any settings for any of the config. I couldn't even turn on debug mode to try and find the problem. So I had to abandon that for the moment. But the good news is that CPG1.5 looks to be very nice indeed. I got 1.5 installed after a lot of trial/error but still haven't had a chance to test the mod. I have tested it with 1.5 and found it to be working. BUT I am not using the latest build.
Regards

Update: I have tested successfully now with an album of 343 photos. The zip file size was 36.7MB. So it seems that it ISN'T necessary for all the files/zip to be in memory to create the file for downloading. Cool! It's probably more a question of raising the allowed execution time in php.ini than the actual memory. Although I doubt you could get by with 8MB memory allowed.
Title: Re: Download a Zipped Album With Basic Security
Post by: easyjava on January 03, 2008, 04:11:49 pm
I  add a script for auto delete the older files.

zip.php

under
Code: [Select]
/* Write here the name of the folder  where the zip will be created */
$sFolderZip = "zipfiles/";
add
Code: [Select]
/* Auto déléstage */
$dir = opendir($sFolderZip);
while($filetodel = readdir($dir)) {
if(date("F d Y", filemtime($sFolderZip.$filetodel)) != date("F d Y")){
unlink($sFolderZip.$filetodel);
}
}
closedir($dir);

This will delete all files older than 1 day.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 03, 2008, 06:30:25 pm
I  add a script for auto delete the older files.

This will delete all files older than 1 day.
Cool! I'll test it out and then add it into the script.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 04, 2008, 12:09:47 am
I  add a script for auto delete the older files.

zip.php

under
Code: [Select]
/* Write here the name of the folder  where the zip will be created */
$sFolderZip = "zipfiles/";
add
Code: [Select]
/* Auto déléstage */
$dir = opendir($sFolderZip);
while($filetodel = readdir($dir)) {
if(date("F d Y", filemtime($sFolderZip.$filetodel)) != date("F d Y")){
unlink($sFolderZip.$filetodel);
}
}
closedir($dir);

This will delete all files older than 1 day.
Tried it out and files were deleted and created successfully but PHP gave the following error:
Code: [Select]
Warning: unlink(..) [function.unlink]: Is a directory in /home/lpath/to/file/zip.php on line 15line 15 is:
Code: [Select]
unlink($sFolderZip.$filetodel);after that I got the header already sent error because of the error sent to the browser already and the script outputted the zip file to the browser, without the correct header information, as a screenful of gibberish.

I'll see if I can figure out how to fix that before adding to the script. Might be because I'm using PHP4.
Title: Re: Download a Zipped Album With Basic Security
Post by: Nibbler on January 04, 2008, 12:11:45 am
Use

Code: [Select]
if (!is_dir($sFolderZip.$filetodel)) unlink($sFolderZip.$filetodel);
Also, that date comparison is a little odd. Better to just compare timestamps.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 04, 2008, 12:22:21 am
Use

Code: [Select]
if (!is_dir($sFolderZip.$filetodel)) unlink($sFolderZip.$filetodel);
Also, that date comparison is a little odd. Better to just compare timestamps.
That worked perfectly. Revised code:
Code: [Select]
$dir = opendir($sFolderZip);
while($filetodel = readdir($dir)) {
if(date("F d Y", filemtime($sFolderZip.$filetodel)) != date("F d Y")){
if (!is_dir($sFolderZip.$filetodel)) unlink($sFolderZip.$filetodel);
}
}
closedir($dir);

Maybe it would be better to just wildcard delete all the files in the folder and forget about date/time comparison?

Edit: Just answered my own question. If all files were deleted it could cause trouble if one user is still d/ling when another user starts a new d/l.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 04, 2008, 12:46:31 am
Okay I got it working and changed from the date comparison to a simple timestamp check and deletion of any file more than 60 minutes old. Should allow plenty of time for d/ling a zip.
Code: [Select]
/* Begin Auto déléstage - Auto Delete stored zip files
// Comment out if for some reason you have problems  with this. Change seconds_old param to modify the gae of files that will be deleted.
// This will delete any files from the folder specified above that have a file creation date older than 3600 seconds (60 mins). */

$dir = opendir($sFolderZip);
$seconds_old = 3600;
while($filetodel = readdir($dir)) {
if(filemtime($sFolderZip.$filetodel) < (time()-$seconds_old)){
if (!is_dir($sFolderZip.$filetodel)) unlink($sFolderZip.$filetodel);
}
}
closedir($dir);
/* End Auto déléstage - Auto Delete stored zip files */
The original code by easyjava would have created problems around 0h00/12:00 AM because it wasn't actually checking the age of the file, only deleting any file that had a timestamp date before "today". That would include any file created at 23h59/11:59 PM, so would lead to problems with d/ls still in progress.

I'll update the zip.php in the first post asap. This has been included in the 1.1 zip.php downloadable from the first post. Thanks to easyjava and Nibbler!

Title: Re: Download a Zipped Album With Basic Security
Post by: sabbia on January 04, 2008, 11:45:12 am
Hi folks!
You really did a great job, I've just tried the 1.1 and it works fine.
I have two questions (unfortunately I'm only an user, I don't develop at all):

1) When I try to zip a very big album (over 300 Mb) I get an Internal Server Error. I have unlimited webspace, so I'm afraid it depends on my PHP.INI configuration (that my hosting provider doesn't let me to modify), but I'm not sure. What can I check to be sure?

2) It would be great if the security check

Code: [Select]
if ($priv["visibility"] != '0')

could be something like

Code: [Select]
if ($priv["visibility"] != 'THE_GROUP_NUMBER_I'M_LOGGED_IN_RIGHT_NOW')
It would let zip and download an album if it belongs to my group (not necessarely a default group like Admin - Registered - Guest etc... but a new one too)

Thanks a lot

Sabbia
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 04, 2008, 07:08:22 pm
Hi folks!
You really did a great job, I've just tried the 1.1 and it works fine.
I have two questions (unfortunately I'm only an user, I don't develop at all):

1) When I try to zip a very big album (over 300 Mb) I get an Internal Server Error. I have unlimited webspace, so I'm afraid it depends on my PHP.INI configuration (that my hosting provider doesn't let me to modify), but I'm not sure. What can I check to be sure?

2) It would be great if the security check

Code: [Select]
if ($priv["visibility"] != '0')

could be something like

Code: [Select]
if ($priv["visibility"] != 'THE_GROUP_NUMBER_I'M_LOGGED_IN_RIGHT_NOW')
It would let zip and download an album if it belongs to my group (not necessarely a default group like Admin - Registered - Guest etc... but a new one too)

Thanks a lot

Sabbia
Zipping 300mb of files will probably never be possible under normal circumstances. You would need to raise the execution times in php.ini quite high and almost certainly raise the memory limit quite a bit also. Basically you could only do it on a dedicated server. I do have a dedicated server and I would never even consider trying it. It would slow things down to a standstill for everyone else while the file was being zipped. So while it is technically possible if you have access to your php.ini, it isn't something that I would recommend.

Read post 3 in this thread for some hints on modifying the user groups that can access the zip function. If I ever get the time to turn the mod into a plugin I will probably add the functionality you request. But it probably won't be anytime soon I'm afraid. I don't have that much free time to work on it. And I still have to learn a lot about coppermine and plugins before attempting it.

Regards.
Title: Re: Download a Zipped Album With Basic Security
Post by: easyjava on January 05, 2008, 02:46:35 pm
Okay I got it working and changed from the date comparison to a simple timestamp check and deletion of any file more than 60 minutes old. Should allow plenty of time for d/ling a zip.
Code: [Select]
/* Begin Auto déléstage - Auto Delete stored zip files
// Comment out if for some reason you have problems  with this. Change seconds_old param to modify the gae of files that will be deleted.
// This will delete any files from the folder specified above that have a file creation date older than 3600 seconds (60 mins). */

$dir = opendir($sFolderZip);
$seconds_old = 3600;
while($filetodel = readdir($dir)) {
if(filemtime($sFolderZip.$filetodel) < (time()-$seconds_old)){
if (!is_dir($sFolderZip.$filetodel)) unlink($sFolderZip.$filetodel);
}
}
closedir($dir);
/* End Auto déléstage - Auto Delete stored zip files */
The original code by easyjava would have created problems around 0h00/12:00 AM because it wasn't actually checking the age of the file, only deleting any file that had a timestamp date before "today". That would include any file created at 23h59/11:59 PM, so would lead to problems with d/ls still in progress.

I'll update the zip.php in the first post asap. This has been included in the 1.1 zip.php downloadable from the first post. Thanks to easyjava and Nibbler!



 ;)
Title: Re: Download a Zipped Album With Basic Security
Post by: VladiczeK on January 28, 2008, 02:17:24 am
Hi, I've tried to mod my gallery in the same way as in this topic, but this error message is shown after execution of the link:
Code: [Select]
Notice: Undefined variable: aid in d:\www\fotky\zip.php on line 31
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

an you imagine wat is wrong??

Thx for reply...
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 28, 2008, 03:37:27 am
Hi, I've tried to mod my gallery in the same way as in this topic, but this error message is shown after execution of the link:
Code: [Select]
Notice: Undefined variable: aid in d:\www\fotky\zip.php on line 31
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

an you imagine wat is wrong??

Thx for reply...
Can't be sure of the exact error but the variable $aid is defined in config.inc.php I believe. Either that file is corrupt or missing or it is possibly the wrong version. Make sure you are using the latest version of CPG and make sure that the config.inc.php file is located in the includes folder of your installation. Should be d:\www\fotky\include or something similar.

Seems you are using a windows server so you might want to try changing the line:
Code: [Select]
include ('include/config.inc.php');to
Code: [Select]
include ('d:\www\fotky\include\config.inc.php');
I'm not all that familiar with windows servers so that's about all the help I can give.
Title: Re: Download a Zipped Album With Basic Security
Post by: VladiczeK on January 28, 2008, 04:25:05 am
Can't be sure of the exact error but the variable $aid is defined in config.inc.php I believe. Either that file is corrupt or missing or it is possibly the wrong version. Make sure you are using the latest version of CPG and make sure that the config.inc.php file is located in the includes folder of your installation. Should be d:\www\fotky\include or something similar.

Seems you are using a windows server so you might want to try changing the line:
Code: [Select]
include ('include/config.inc.php');to
Code: [Select]
include ('d:\www\fotky\include\config.inc.php');
I'm not all that familiar with windows servers so that's about all the help I can give.

So I tried your suggestions but still not works. Everything seems to be ok, table prefix defined in config.inc.php is the same as in database and changing absolute path gives the error as well. So it might be deeper problem :-/ But the favorites zip download works fine, and the zip download of entire albums was working for me earlier. I'm confused, maybe it's caused by some upgrade or new plug-in, million reasons possible, who knows.

Thx for the help anyway!
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 28, 2008, 08:48:53 am
So I tried your suggestions but still not works. Everything seems to be ok, table prefix defined in config.inc.php is the same as in database and changing absolute path gives the error as well. So it might be deeper problem :-/ But the favorites zip download works fine, and the zip download of entire albums was working for me earlier. I'm confused, maybe it's caused by some upgrade or new plug-in, million reasons possible, who knows.

Thx for the help anyway!
About the only thing I can tell for sure is that mysql is getting an empty string instead of the variable and causing it to error out. So the fault is with php somewhere. Strange that it would work before and then quit. The favorites download uses a quite different method but is similar enough that you would think both should work. Oh well.

Maybe you can do a search in the forum for "undefined variable".
Title: Re: Download a Zipped Album With Basic Security
Post by: Nibbler on January 28, 2008, 09:02:57 am
It's a coding error. You need to add in

Code: [Select]
$aid = (int) $_GET['aid'];

Somewhere near the top of the script.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 28, 2008, 09:54:02 am
It's a coding error. You need to add in

Code: [Select]
$aid = (int) $_GET['aid'];

Somewhere near the top of the script.
Actually $aid isn't defined in config.inc.php. That's for the database connections, etc.
My bad.
I'm too tired to remember where $aid is defined but it's used in multiple places in CPG. It isn't a variable that is specific to the zip.php script.
There shouldn't be a need to add any code for that or many parts of coppermine wouldn't work, no?

It seems likely that his problem is caused by a php setting change or maybe something as simple as a missing or extra character somewhere in one of the template files or in zip.php
I've had that kind of error before with other mods and scripts and it is always seems to be some little thing right in your face that you can't see.

Maybe replace the modified template files with the original ones and then redo the mod might work. Maybe delete and then reupload the zip.php also.
Title: Re: Download a Zipped Album With Basic Security
Post by: VladiczeK on January 28, 2008, 03:09:39 pm
It's a coding error. You need to add in

Code: [Select]
$aid = (int) $_GET['aid'];

Somewhere near the top of the script.

Yeah, this mod to mod work for me, thx2all!
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 28, 2008, 06:41:04 pm
Yeah, this mod to mod work for me, thx2all!
Well cool!
Apparently in some configurations that line is needed. Strange.

I'll add it to the archive if it tests out okay on my installation. Thanks again Nibbler.
Title: Re: Download a Zipped Album With Basic Security
Post by: Nibbler on January 28, 2008, 07:40:59 pm
It's not at all strange. Your code relies on the php setting register_globals being enabled. It is usually not enabled for security reasons.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on January 29, 2008, 03:04:49 am
It's not at all strange. Your code relies on the php setting register_globals being enabled. It is usually not enabled for security reasons.

You're right again, but that isn't "my" code. I simply adapted what was already present in the script for that section of the security check. I'm only a novice at php.

I do find it strange that nobody reported trouble with this before now in either this script or the original that it was built on. It makes me think that register_globals isn't disabled as often as you would think. It also makes me wonder exactly why my hosting provider has set up all my servers in the last 5 years with it enabled. Maybe they prefer not having to be bothered by customers who have a hard time getting a script to run more than they worry about my data being safe.

Now I am going to have to spend a couple of days turning it off and then troubleshooting scripts that may no longer work.  :(
Title: Fixed to comply with register_globals off
Post by: erostew on January 29, 2008, 03:37:39 am
I have been quite open about not being a real coder and it has once again been proven.  :-[

However the excellent Nibbler has once again provided a valuable lesson. Thanks to VladiczeK also for reporting the issue.

The latest version has been uploaded to the first post and now should be compatible with a server where register_globals is turned off, as it should be.

Regards
Title: Re: Download a Zipped Album With Basic Security
Post by: williamgates on February 09, 2008, 10:29:16 am

Just for download this file, I signed in here. But I found it won't works for me if I follow the instructions. I found out a new method that allows you not need to edit the theme.php everytime you change theme.

In my classic theme.php, there is just a small piece of code:
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally 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 version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.16
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/themes/classic/theme.php $
  $Revision: 4233 $
  $Author: gaugau $
  $Date: 2008-02-02 09:23:58 +0100 (Sa, 02 Feb 2008) $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has all CORE items removed                                     //
// ------------------------------------------------------------------------- //
define('THEME_IS_XHTML10_TRANSITIONAL',1);

?>

I think it maybe the difference between the 1.4.16 and the verision the author of this post uses. I tried insert those code in this file, but it does not take effect. So I think that means CPG even not use this file to show a classic theme. I readed the document and found:
Quote
There are now theme $template_ and theme_ function fallbacks which allow you to eliminate many un-modified templates or functions from the theme.php. You only need to modify the templates or functions that you want to act differently from the default "Classic" theme.
So I looked into the include folder, open the themes.inc.php, here I found the code which the instructions mentioned. Though the file reads:
Quote
// Do not edit this file.                                      //
// If you need to customize your theme,                        //
// edit themes/yourtheme/theme.php instead !!!                 //
// Take a look at the sample theme (themes/sample/theme.php)   //
// to get an idea what to copy into your custom theme.         //
// Really, don't edit this file! We mean it!                   //
But I still did it, then it works. It works with every theme just once edit.

I am sorry for my poor English and subjective assertion. There might be a better way or a better explanation. If you found me any wrong, please let me know. Thanks.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on February 09, 2008, 06:38:09 pm
Just for download this file, I signed in here. But I found it won't works for me if I follow the instructions. I found out a new method that allows you not need to edit the theme.php everytime you change theme.


I haven't yet had a chance to install 1.4.16.
I will check things out as soon as I can. Thanks for the information.

I have updated my sandbox coppermine to 1.4.16 and have found no issues at all. Procedures for installing have not changed.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on February 09, 2008, 07:42:51 pm
Just for download this file, I signed in here. But I found it won't works for me if I follow the instructions. I found out a new method that allows you not need to edit the theme.php everytime you change theme.

In my classic theme.php, there is just a small piece of code:
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally 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 version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.16
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/themes/classic/theme.php $
  $Revision: 4233 $
  $Author: gaugau $
  $Date: 2008-02-02 09:23:58 +0100 (Sa, 02 Feb 2008) $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has all CORE items removed                                     //
// ------------------------------------------------------------------------- //
define('THEME_IS_XHTML10_TRANSITIONAL',1);

?>

I think it maybe the difference between the 1.4.16 and the verision the author of this post uses. I tried insert those code in this file, but it does not take effect. So I think that means CPG even not use this file to show a classic theme. I readed the document and found:So I looked into the include folder, open the themes.inc.php, here I found the code which the instructions mentioned. Though the file reads:But I still did it, then it works. It works with every theme just once edit.

I am sorry for my poor English and subjective assertion. There might be a better way or a better explanation. If you found me any wrong, please let me know. Thanks.

OK I haven't yet upgraded to 1.4.16 but I compared the themes.inc.php and the theme.php from several themes with the same files for 1.4.14. There are zero code differences between the 2 versions.

This means that you probably did not follow the installation directions correctly.

Your themes.php for the classic theme should look like this if you have the mod installed correctly:
Code: [Select]
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally 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 version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.16
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/themes/classic/theme.php $
  $Revision: 4233 $
  $Author: gaugau $
  $Date: 2008-02-02 09:23:58 +0100 (Sa, 02 Feb 2008) $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has all CORE items removed                                     //
// ------------------------------------------------------------------------- //
define('THEME_IS_XHTML10_TRANSITIONAL',1);

function 
theme_display_thumbnails(&$thumb_list$nbThumb$album_name$aid$cat$page$total_pages$sort_options$display_tabs$mode 'thumb')
{
    global 
$CONFIG;
    global 
$template_thumb_view_title_row,$template_fav_thumb_view_title_row$lang_thumb_view$template_tab_display$template_thumbnail_view$lang_album_list;

    static 
$header '';
    static 
$thumb_cell '';
    static 
$empty_cell '';
    static 
$row_separator '';
    static 
$footer '';
    static 
$tabs '';
    static 
$spacer '';

    if (
$header == '') {
        
$thumb_cell template_extract_block($template_thumbnail_view'thumb_cell');
        
$tabs template_extract_block($template_thumbnail_view'tabs');
        
$header template_extract_block($template_thumbnail_view'header');
        
$empty_cell template_extract_block($template_thumbnail_view'empty_cell');
        
$row_separator template_extract_block($template_thumbnail_view'row_separator');
        
$footer template_extract_block($template_thumbnail_view'footer');
        
$spacer template_extract_block($template_thumbnail_view'spacer');
    }

    
$cat_link is_numeric($aid) ? '' '&amp;cat=' $cat;
    
$uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' $_GET['uid'] : '';

    
$theme_thumb_tab_tmpl $template_tab_display;

    if (
$mode == 'thumb') {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));
        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));
    } else {
        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));
    }

    
$thumbcols $CONFIG['thumbcols'];
    
$cell_width ceil(100 $CONFIG['thumbcols']) . '%';

    
$tabs_html $display_tabs create_tabs($nbThumb$page$total_pages$theme_thumb_tab_tmpl) : '';
    
// The sort order options are not available for meta albums
    
if ($sort_options) {
        
$param = array('{ALBUM_NAME}' => $album_name,
            
'{AID}' => $aid,
            
'{PAGE}' => $page,
            
'{NAME}' => $lang_thumb_view['name'],
            
'{TITLE}' => $lang_thumb_view['title'],
            
'{DATE}' => $lang_thumb_view['date'],
            
'{SORT_TA}' => $lang_thumb_view['sort_ta'],
            
'{SORT_TD}' => $lang_thumb_view['sort_td'],
            
'{SORT_NA}' => $lang_thumb_view['sort_na'],
            
'{SORT_ND}' => $lang_thumb_view['sort_nd'],
            
'{SORT_DA}' => $lang_thumb_view['sort_da'],
            
'{SORT_DD}' => $lang_thumb_view['sort_dd'],
            
'{POSITION}' => $lang_thumb_view['position'],
            
'{SORT_PA}' => $lang_thumb_view['sort_pa'],
            
'{SORT_PD}' => $lang_thumb_view['sort_pd'],
            );
        
// MOD - begin
$param['{ALBUM_NAME}'] .= '&nbsp;<a href="zip.php?aid=' $aid '" title="Download album as *zip archive">[ Download Album ]</a>';
// MOD - end
        
$title template_eval($template_thumb_view_title_row$param);
    } else if (
$aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later
       
$param = array('{ALBUM_NAME}' => $album_name,
                             
'{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']
                               );
       
$title template_eval($template_fav_thumb_view_title_row$param);
    }else{
        
$title $album_name;
    }


    if (
$mode == 'thumb') {
        
starttable('100%'$title$thumbcols);
    } else {
        
starttable('100%');
    }

    echo 
$header;

    
$i 0;
    foreach(
$thumb_list as $thumb) {
        
$i++;
        if (
$mode == 'thumb') {
            if (
$aid == 'lastalb') {
                
$params = array('{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",
                    
'{THUMB}' => $thumb['image'],
                    
'{CAPTION}' => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            } else {
                
$params = array('{CELL_WIDTH}' => $cell_width,
                    
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",
                    
'{THUMB}' => $thumb['image'],
                    
'{CAPTION}' => $thumb['caption'],
                    
'{ADMIN_MENU}' => $thumb['admin_menu']
                    );
            }
        } else {
            
$params = array('{CELL_WIDTH}' => $cell_width,
                
'{LINK_TGT}' => "index.php?cat={$thumb['cat']}",
                
'{THUMB}' => $thumb['image'],
                
'{CAPTION}' => $thumb['caption'],
                
'{ADMIN_MENU}' => ''
                
);
        }
        echo 
template_eval($thumb_cell$params);

        if (((
$i $thumbcols) == 0) && ($i count($thumb_list))) {
            echo 
$row_separator;
        }
    }
    for (;(
$i $thumbcols); $i++) {
        echo 
$empty_cell;
    }
    echo 
$footer;

    if (
$display_tabs) {
        
$params = array('{THUMB_COLS}' => $thumbcols,
            
'{TABS}' => $tabs_html
            
);
        echo 
template_eval($tabs$params);
    }

    
endtable();
    echo 
$spacer;
}

?>
I will install 1.4.16 in my sandbox to make sure, but I am 100% certain that there have been no changes to the way themes work form 1.4.14 to 1.4.16.
I have installed 1.4.16 and have confirmed that no changes have been made to the way themes work since 1.4.14. You can in fact skip uploading the new themes folder and leave your already modified theme/themes in place if you absolutely can not take the time to cut and paste the mod into the new files. But I do not recommend that. You should always keep all files that are included in the archive updated to the newest version.

themes.inc.php is the DEFAULT code for all themes and should NEVER be edited or changed. Changes made in the theme.php of your selected theme OVERRIDE what is in themes.inc.php. So only code which is DIFFERENT from the default needs to be in the theme.php. That is why you do the modifications in that file and NOT themes.inc.php.

Regards
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on February 09, 2008, 08:34:11 pm
Ok so I updated my CPG from 1.4.14 to 1.4.16 and have confirmed that the mod still works. While I was at it I took the time to try the mod with CPG 1.5 and have found that it works just fine. My installed 1.5 is not the latest build but, if no big changes are made in the theming between now and the release of 1.5, you should be able to use the mod well into the future.

Now I just have to find the time to study how plugins work in CPG.
Title: Re: Download a Zipped Album With Basic Security
Post by: Joachim Müller on February 10, 2008, 12:27:49 am
Good and thorough approach, you're doing a fine job making sure that your mod works as expected on all coppermine versions. Keep up the good work.
Title: Re: Download a Zipped Album With Basic Security
Post by: williamgates on February 10, 2008, 05:23:02 am

Thank you very much for checking that, I will check my CPG again.
You did a very good job, thanks. :)
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on February 10, 2008, 08:25:40 am
Good and thorough approach, you're doing a fine job making sure that your mod works as expected on all coppermine versions. Keep up the good work.
Thanks for the encouragement.

Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on February 10, 2008, 08:26:40 am
Thank you very much for checking that, I will check my CPG again.
You did a very good job, thanks. :)
No problem.
Title: Re: Download a Zipped Album With Basic Security
Post by: opulence on March 21, 2008, 11:27:21 pm
Small request: any way to have this featured enabled/disabled by group?

I allow all users, registered and guests to view the albums on the site, but restrict full-size and intermediate access to pictures to guests, only registered users can view.

Unfortunately though, in it's current state, this mod will allow unregistered users to download zips of albums
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on March 22, 2008, 12:37:27 am
Small request: any way to have this featured enabled/disabled by group?

I allow all users, registered and guests to view the albums on the site, but restrict full-size and intermediate access to pictures to guests, only registered users can view.

Unfortunately though, in it's current state, this mod will allow unregistered users to download zips of albums
Read http://forum.coppermine-gallery.net/index.php/topic,47820.msg228822.html#msg228822 for info about user groups. It's the 3rd post in this thread.
Download enabling is done on a per album basis depending on group settings of the album. It doesn't work on a per user basis. If you want it to be based on the user rather than the album I'm afraid you will need to do that yourself.

Regards
Title: Re: Download a Zipped Album With Basic Security
Post by: opulence on March 22, 2008, 04:53:25 pm
Read http://forum.coppermine-gallery.net/index.php/topic,47820.msg228822.html#msg228822 for info about user groups. It's the 3rd post in this thread.
Download enabling is done on a per album basis depending on group settings of the album. It doesn't work on a per user basis. If you want it to be based on the user rather than the album I'm afraid you will need to do that yourself.

Regards

I didn't think that would work, but I tried it anyway (it didn't work, it gave me the message "You don't have permission to do that!" as admin, as registered user, and as guest.

I'm not sure if you understood my request and the settings on my site.

I allow ALL users to 'view' an album, and only restrict access to intermediate, and full-size pictures, with use of another mod/plugin.

So instead of using the privledges based off of albums (which are open to anyone) I need to set seperate permissions for the zip download links themselves.  But okay, I'll try to figure out something myself.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on March 22, 2008, 05:59:29 pm
I didn't think that would work, but I tried it anyway (it didn't work, it gave me the message "You don't have permission to do that!" as admin, as registered user, and as guest.

I'm not sure if you understood my request and the settings on my site.

I allow ALL users to 'view' an album, and only restrict access to intermediate, and full-size pictures, with use of another mod/plugin.

So instead of using the privledges based off of albums (which are open to anyone) I need to set seperate permissions for the zip download links themselves.  But okay, I'll try to figure out something myself.

I understood your request. It just isn't possible for me to fulfill it at this time. This is a quick mod, not a plugin. Checking the level of an album is quick and fairly easy. Checking if a user is logged in and what group he belongs to and then checking an album to see if it belongs to the appropriate group is much more complicated. I simply don't have time to do it right now. Which is why I said you would need to do it yourself.

If you had read the very first post completely you would have seen:
Quote
The best way to handle security would be to check if the user was logged in and then check to see if he or his user group was allowed access to the album. However that is a lot more complex and not really something suitable for a quick hack/mod.

Also Sabbia made the same request as you and I replied:
Quote
Read post 3 in this thread for some hints on modifying the user groups that can access the zip function. If I ever get the time to turn the mod into a plugin I will probably add the functionality you request. But it probably won't be anytime soon I'm afraid. I don't have that much free time to work on it. And I still have to learn a lot about coppermine and plugins before attempting it.

The modification suggested for registered user albums only will work. However you need to be using a suitable permission level for it to work with your albums. If you allow everyone to VIEW an album then your albums will obviously have a permission of "0". So changing the code to work with albums set to "2" (registered users only) will not work for you. As I said in my first reply to you:
Quote
Download enabling is done on a per album basis depending on group settings of the album. It doesn't work on a per user basis.
Title: Re: Download a Zipped Album With Basic Security
Post by: webmonarch on June 19, 2008, 02:35:35 am
This is probably one of the stupidest questions ever, but after implementing this and attemptng to click on the "Download Album" link, I'm getting a 404 error. All files are present and accounted for as far as I can tell. I'm not a total noob, but I honestly can't see how I'd be getting 404 errors as opposed to some other type of errors. Any guidance much appreciated.
Title: Re: Download a Zipped Album With Basic Security
Post by: Nibbler on June 19, 2008, 03:34:06 am
Did you upload zip.php? Post a link to your gallery.
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on June 19, 2008, 08:19:36 am
This is probably one of the stupidest questions ever, but after implementing this and attemptng to click on the "Download Album" link, I'm getting a 404 error. All files are present and accounted for as far as I can tell. I'm not a total noob, but I honestly can't see how I'd be getting 404 errors as opposed to some other type of errors. Any guidance much appreciated.
If your webserver is configured normally (showing the proper error number) the only explanation is that zip.php is in the wrong place or not uploaded. Any other problem would generate a php error, not a 404.

Make sure that zip.php is in the root directory of coppermine, not the root directory of your site.
Title: Re: Download a Zipped Album With Basic Security
Post by: wperry1 on July 08, 2008, 06:24:15 pm
Thanks a million!  This is exactly what I was looking for.

WP
Title: Re: Download a Zipped Album With Basic Security
Post by: Rebel Racer on August 08, 2008, 09:07:57 pm
Hi,

Thanks for making this mod - I've been looking for something like this for ages! If only I could get it to work!  :'(

I followed your instructions carefully, but when it came time to test the script, I get a humongous error message, it reads:

Quote
Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/o/c/dockingbay101/html/images/include/config.inc.php:17) in /home/content/d/o/c/dockingbay101/html/images/zip.php on line 71

Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/o/c/dockingbay101/html/images/include/config.inc.php:17) in /home/content/d/o/c/dockingbay101/html/images/zip.php on line 72

Warning: Cannot modify header information - headers already sent by (output started at /home/content/d/o/c/dockingbay101/html/images/include/config.inc.php:17) in /home/content/d/o/c/dockingbay101/html/images/zip.php on line 73

...and is followed by millions of nonsensical characters.

You can see it in action on my site here: http://www.dockingbay101.com/images/thumbnails.php?album=1

Any idea what I'm doing wrong/how to fix this?

Thanks again for your time!
Title: Re: Download a Zipped Album With Basic Security
Post by: Nibbler on August 09, 2008, 02:18:51 pm
Looks like you were hacked but didn't clean everything up. Remove the iframe from include/config.inc.php and any whitespace after the closing ?>
Title: Re: Download a Zipped Album With Basic Security
Post by: Rebel Racer on August 09, 2008, 11:23:22 pm
Thank you for your insightful instructions, Nibbler! I did as you instructed and the script now works flawlessly.

Many, many thanks!
Title: Re: Download a Zipped Album With Basic Security
Post by: screech on October 26, 2008, 07:40:27 pm
First i hope you can excuse me for my bad english..

I do all things i can, All works except the ZIP File i download directly.

this is the error i get after the downloading: !   "C:\Documents and Settings\Administrateur\Bureau\2008+-+Visite+de+Soumia.zip: Unexpected end of archive"

If i try to download directly from the FTP in the zipfile folder, the generated ZIP file Work, but it didn't work if i download it from the link in the galery.

I try with PCLZIP 2-5 and 2-6 the error is the same.

(I try version 1.1 and 1.2 too but no change...)

This is a link to my gallery : http://screech2.free.fr

Can you help me ?
Title: Re: Download a Zipped Album With Basic Security
Post by: erostew on October 27, 2008, 02:35:13 am
First i hope you can excuse me for my bad english..

I do all things i can, All works except the ZIP File i download directly.

this is the error i get after the downloading: !   "C:\Documents and Settings\Administrateur\Bureau\2008+-+Visite+de+Soumia.zip: Unexpected end of archive"

If i try to download directly from the FTP in the zipfile folder, the generated ZIP file Work, but it didn't work if i download it from the link in the galery.

I try with PCLZIP 2-5 and 2-6 the error is the same.

(I try version 1.1 and 1.2 too but no change...)

This is a link to my gallery : http://screech2.free.fr

Can you help me ?


I can't say what the problem is for sure. If the zip file is okay by ftp then it seems the script is working okay. I would guess it is an error caused by the server configuration. For some reason it seems not to transfer the zip file correctly. Not sure what kind of Apache that server is running as the headers don't say. There is some small possibility that the problem might be caused by the "/" in the album name. You could try renaming it to something like 01.02.2008 and see if it makes any difference.

Maybe someone else will have a different suggestion but I'm afraid I don't have any other ideas. Good luck.
Title: Re: Download a Zipped Album With Basic Security
Post by: screech on October 27, 2008, 12:59:20 pm
Thanks for your help.

I try to rename the album name without "/" (now it's 10-08-2008) but the problem is the same.

My Apache serveur is  hosted by my provider "Free" So it's impossible for me to change settings on it...

But if it's help

PHP : PHP Version 4.4.3-dev
MySQL : 5.0.51a
But i'm sorry i can't found the version of the Apache serveur...

If you think about some other hint ;) i take it ;) thank you.
Title: Re: Download a Zipped Album With Basic Security
Post by: primera on November 12, 2008, 07:11:46 am
Hi all, i am the newbie of the php and Coppermine, i've just follow all the step ...and get the error code which is...

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

did anyone know about this ?

thx ~
Title: Re: Download a Zipped Album With Basic Security
Post by: Joachim Müller on November 12, 2008, 07:19:20 am
Means that you haven't followed the instructions to a tee. Undo your edits and re-apply the mod extra throughly. Impossible to advise anything else, since we can't see what you did.
Title: Re: Download a Zipped Album With Basic Security
Post by: primera on November 12, 2008, 08:19:36 am
yeah ... this time i step by step clearly. and it's work ...thanks Joachim Müller !!
but anything came out....

the page "You don't have permission to do that!" come out when i click on "download album"  even i am using administrator to log in..

Title: Re: Download a Zipped Album With Basic Security
Post by: stardust on January 11, 2009, 08:49:15 pm
This was actually very fast and easy to do, so thank you so much for this mod!

I would like it if the mod recognized the registered user, so we wouldn't have to change the album permission. In that way, anyone can view the content in the albums, but the Download Album link only appears when viewers are logged in. But I don't know if this is possible? Or I think somewhere in this thread, it's said that the security can only be done through album properties?  ???

Oh well, this is still a great mod. Thanks again!
Title: Re: Download a Zipped Album With Basic Security
Post by: Artin1 on April 04, 2009, 03:36:21 am
I installed the script. And when I click on the download album link i get this error:

Code: [Select]
Warning: opendir(zipfiles/) [function.opendir]: failed to open dir: No such file or directory in /home/deltadai/public_html/gallery/zip.php on line 13

Warning: readdir(): supplied argument is not a valid Directory resource in /home/deltadai/public_html/gallery/zip.php on line 15

Warning: closedir(): supplied argument is not a valid Directory resource in /home/deltadai/public_html/gallery/zip.php on line 20
Error : PCLZIP_ERR_READ_OPEN_FAIL (-2) : Unable to open archive 'zipfiles/Madison+-+April.zip' in wb mode

 ??? Any ideas?

Thanks,
Artin
Title: Re: Download a Zipped Album With Basic Security
Post by: Artin1 on April 04, 2009, 03:45:34 am
Sorry, I fixed it! Sorry about that. I can't edit my previous post.

Artin
Title: I cannot use this f*cking forum
Post by: quake_jatekos on April 10, 2009, 10:56:02 am
Hi all.
I post here since I can post here. I do not find any button to make a new discussion or whatever.
Here is a Tar downloader (All, large pictures, norm pictures)
There is a short info inside the Zip.
Hope it works.

By
Title: Re: I cannot use this f*cking forum
Post by: quake_jatekos on April 10, 2009, 11:06:58 am
Hi all.
I post here since I can post here. I do not find any button to make a new discussion or whatever.
Here is a Tar downloader (All, large pictures, norm pictures)
There is a short info inside the Zip.
Hope it works.

By

Sorry, the help txt was not saved :):)
Here:

Coppermine "download all" easy

I created a coppermine patch to everyone who do not like shopping carts and others.
To whom want to share their coppermine gallery for download (.tar).
- Download cpg1.4.21.zip
- Owerwrite the files you can find here

You will see the change in the coppermine having icons with title for categories and albums:
   Video Camera icon: "Videók és nagy képek letöltése" == Download ALL Recursively
   Big Camera icon: "Nagy képek letöltése" == Download Only images (mime=image/*)
   Small Camera icon: "Csak normál képek letöltése" == Download normal_* images

- No security considerations! Since Coppermine security is suxx.
- No internationalization Since I'm lazy (there is only 4 new text, above 3 plus "Letöltés" == Download)
- Needs Pear installed with "Archive_Tar"

Have fun
quake_jatekos@freemail.hu
Title: Re: Download a Zipped Album With Basic Security
Post by: modrej on April 10, 2009, 04:44:12 pm
hi... i've just installed this MOD, it's great, but...

is it possible to change it some easy way, so archive name includes the last directory, which album is inside?

for example album is in this directory tree: year -> month -> event -> album and i would like to have archive name like this: event+album.zip

i cant do that myself

thx for help
Title: Re: I cannot use this f*cking forum
Post by: Joachim Müller on April 11, 2009, 09:58:59 am
I post here since I can post here. I do not find any button to make a new discussion or whatever.
Sure. Whatever. Read up "Modifications/Add-Ons/Hacks > About this board - READ (http://forum.coppermine-gallery.net/index.php/topic,14348.0.html)".
Title: Re: Download a Zipped Album With Basic Security
Post by: GecKoTDF on June 19, 2009, 02:43:49 am
I tested in my Coppermine Photo Gallery 1.4.24 (stable) and works great no problem y download SecureZip 1.2 and the last version of the plugin in the web PCLZIP Release 2.8, and no problem, i follow the steps one by one and everything okay, thanks for the mod.
Title: Re: Download a Zipped Album With Basic Security
Post by: FireBird2003 on June 22, 2009, 06:08:14 pm
Hi,

I implemented a better security check. These few lines should check the user-groups for the current user against the user-group which is used by the album:

Code: [Select]
/* updated Check up by FireBird2003 {*/
$sql = 'SELECT user_group_list FROM `'.$CONFIG['TABLE_PREFIX'].'users` where `user_id` = ' . USER_ID;
$result = mysql_query($sql) OR die(mysql_error());
$priv2 = mysql_fetch_assoc($result);
$user_group_list = split ("[, ]", $priv2["user_group_list"]);
if (($priv["visibility"] != '0') && (!in_array($priv["visibility"], $user_group_list))){
/* } // updated Check up by FireBird2003 */

it shoud be placed after
Code: [Select]
$sql = 'SELECT visibility FROM `'.$CONFIG['TABLE_PREFIX'].'albums` where `aid` = ' . $aid;
$result = mysql_query($sql) OR die(mysql_error());
$priv = mysql_fetch_assoc($result)

replacing the followed if-clause.

There is still a problem: If I choose a big album I get a file sized 0kb. Any ideas for that?

Attached you wil find my changed zip.php.tx. Rename it to zip.php.

Thx in advance.
Title: Re: Download a Zipped Album With Basic Security
Post by: the1shadow on August 23, 2009, 07:43:48 pm
Just wanted to throw in a quick note... This mod works GREAT and is exactly what I needed.  The instructions are very clear and easy to follow for installation.  Worked great off the bat.  Thanks so much!
Title: Re: Download a Zipped Album With Basic Security
Post by: nellygrl on September 01, 2009, 04:57:28 pm
The second step says to add the code you posted just above the "?>" at the end of template.php. I looksed on my theme to add the code, but the ?> wasn'y on it. I was thinking that it was because I have a different them, so I checked the classic, rany_day, and water_drop themes to see what it should look like, but none of them had it either and I've never even touched those themes.

Can anyone offer any insight on this problem?
Title: Re: Download a Zipped Album With Basic Security
Post by: Joe Carver on September 01, 2009, 05:37:21 pm
Do you refer to this step in the instruction?

Quote
# 5 ) Open template.php in your editor of choice. Copy the following code into your template.php file just above the

The author probably intended to write:   theme.php
Title: Re: Download a Zipped Album With Basic Security
Post by: Joachim Müller on September 01, 2009, 05:52:33 pm
Obviously, as there is no file named template.php in coppermine themes, but only theme.php and template.html
I edited the initial posting in this thread accordingly to end confusion for newbies.
Title: Re: Download a Zipped Album With Basic Security
Post by: shadlaws on November 24, 2009, 02:50:36 am
Hi everyone,

Thanks so much to everyone for working on this zip download feature!  Last night I spent a fair amount of time toying with it for use with my personal website, and having this new feature makes me much happier with my photo server :-).  Also, I made a few more modifications / bug fixes I thought I'd share with the group.

Disclaimer: I'm not a coder by trade and this is my first experience with php, so any and all feedback is welcome :-)

#1 - Commas in directories and filenames make the code crash

Commas do not work well with zip.php and pclzip by default.  If you're like me and have several directory names that have commas, the Download Album feature simply won't work.  This is because, by default, the create() function of pclzip uses the comma as a filename separator in the filelist.  Whoops.

This is easily solved by making a modification to both zip.php and pclzip.lib.php by changing the separator from "," to something that's extremely unlikely to occur in a directory or filename.  Note that there is no reason this has to be a single character... in fact, having a multiple-character separator likely makes things more robust.  I chose "#,#,#,#".

In zip.php, find:
Code: [Select]
$bilder .= "albums/" . $row['filepath'].$row['filename'].",";

And change to:
Code: [Select]
$bilder .= "albums/" . $row['filepath'].$row['filename']."#,#,#,#";

Then, in pclzip.lib.php, find:
Code: [Select]
  //define( 'PCLZIP_SEPARATOR', ' ' );
  // Recommanded values for smart separation of filenames.
  if (!defined('PCLZIP_SEPARATOR')) {
    define( 'PCLZIP_SEPARATOR', ',' );
  }

And change to:
Code: [Select]
  //define( 'PCLZIP_SEPARATOR', ' ' );
  define( 'PCLZIP_SEPARATOR', '#,#,#,#' );
  // Recommanded values for smart separation of filenames.
  if (!defined('PCLZIP_SEPARATOR')) {
    define( 'PCLZIP_SEPARATOR', ',' );
  }

Voila - now, unless you tend to use #,#,#,# in your directory names, the Download Album button won't cause the system to crash :-)

#2 - Zip-compressing images that are already compressed is a waste of time

I have a lot of high-resolution jpeg images on my website, so sometimes it can take quite awhile to generate the zip file for download.  Much of this time is spent by the zip program trying to compress jpegs... which is pretty useless.  So, I modified zip.php to tell pclzip to do compression-less zipping.  This saves a lot of server processing time while causing zip file sizes to grow by maybe 1-2% - a nice tradeoff in my opinion.

In zip.php, find:
Code: [Select]
$v_list = $archive->create($bilder,PCLZIP_OPT_REMOVE_ALL_PATH);

And change to:
Code: [Select]
$v_list = $archive->create($bilder,PCLZIP_OPT_REMOVE_ALL_PATH,PCLZIP_OPT_NO_COMPRESSION);

This probably isn't a good idea if you have a bunch of uncompressed files (bmp, raw, etc.), but otherwise it can be quite handy.

#3 - Filenames for zip files might be unintelligible

By default, zip.php uses urlencode() to make the filename for the zip file from the album name.  This is a very robust, straightforward, and fool-proof method.  However, for my purposes, I felt that it resulted in a bunch of really ugly, unintelligible filenames.  For example, a descriptive name of "2009/11/23 - John Smith's birthday" becomes "2009%2F11%2F23+-+John+Smith%27s+birthday" which wasn't exactly my cup of tea :-).

So, I use str_replace() instead.  For functionality, some characters must be changed.  I made spaces into underscores (" " to "_"), turned apostrophes back into apostrophes ("&#39;" to "'"), and got rid of slashes ("/" to "").  Now, "2009/11/23 - John Smith's birthday" becomes "20091123_-_John_Smith's_birthday" which looks prettier to me :-). 

In zip.php, find:
Code: [Select]
$sDesiredZipName = urlencode($o_AlbumName->title);

And change to:
Code: [Select]
//$sDesiredZipName = urlencode($o_AlbumName->title);
$sDesiredZipName = str_replace(" ", "_", $o_AlbumName->title);
$sDesiredZipName = str_replace("&#39;", "'", $sDesiredZipName);
$sDesiredZipName = str_replace("/", "", $sDesiredZipName);

This works well with my style of album titles, but likely needs tweaking for other people (particularly with the slashes... some might prefer them to be spaces or hyphens or something).  Also, to be fair, this method is not as robust as the default, urlencode() method.  I haven't thought through an exhaustive list of name cases... it's possible that your album naming scheme may generate something that causes the code to crash.  But, it works well with mine so I thought I'd share.

#4 - Adding a "Download Album" button to the album list view

Having the Download Album button on the thumbnail view is great, but I also wanted the option of seeing the button on the album list view.  That way, you don't have to open the album to be able to download it.  It seemed like a nice piece of functionality to add - having the button in two different places makes it seem more user-friendly.

Adding this functionality is very similar to the default implementation of zip.php - it involves theme.php.  Whereas adding the button to the thumbnail view involved the theme_display_thumbnails function, adding the button to the album list view involves (unsurprisingly) the theme_display_album_list function.  Like before, odds are that this function is not, by default, defined in theme.php but rather in theme.inc.php.  So, it has to be added to theme.php and then modified for our purposes.

In theme.inc.php, find:
Code: [Select]
function theme_display_album_list
    ...
    ...
    ...
}
and copy it in entirety to theme.php either directly above or below the theme_display_thumbnails function that was added to make zip.php work.

Then, within this function, find:
Code: [Select]
$params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                );

And change to:
Code: [Select]
$params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => $album['album_info'],
                );
        //mod zipped album download start
            $params['{ALB_INFOS}'] .= '&nbsp;&nbsp;&nbsp;<a href="zip.php?aid=' . $album['aid'] . '" title="Download album as *zip archive">[ DOWNLOAD ALBUM ]</a>';
        //mod zipped album download end

This implementation appends the button to the end of the info field, which looks nice for my site layout.  One could also use the description field (change ALB_INFOS to ALB_DESC) or the album title itself (change ALB_INFOS to ALBUM_TITLE).  I also used capital letters for the button... I thought it looked better for the album view.  Change as you like :-).

Thanks again for your work on making the securezip modification, and I hope my suggestions help out someone else!

Take care,
Shad
Title: Re: Download a Zipped Album With Basic Security
Post by: shadlaws on November 26, 2009, 12:33:03 am
Oops, one more addition to above...

#3 - Filenames for zip files might be unintelligible

I got the single quotes ('), but forgot the double quotes (") in the characters that need to be changed - d'oh!  Anyway, instead of what I wrote above, replace with this piece of code in zip.php:

Code: [Select]
//$sDesiredZipName = urlencode($o_AlbumName->title);
$sDesiredZipName = str_replace(" ", "_", $o_AlbumName->title);
$sDesiredZipName = str_replace("&#39;", "'", $sDesiredZipName);
$sDesiredZipName = str_replace("/", "", $sDesiredZipName);
$sDesiredZipName = str_replace("&quot;", "'", $sDesiredZipName);

Take care,
Shad
Title: Re: Download a Zipped Album With Basic Security
Post by: Kazna on January 03, 2010, 03:45:54 pm
Oh man it's working...  :o :o I didn't expect it to work but it works!!! Thanks a bunch guys!!!  :-* :-* :-* Really appreciate your jobs!
Title: Re: Download a Zipped Album With Basic Security
Post by: btaz on January 04, 2010, 07:13:20 am
I'm pretty new to php and and working to host my own website, so be kind :)

I added this mod to my gallery (its awesome, thanks) and was doing some basic checks to see if the security settings were working as expected.  I do not allow guests into my gallery.  So I tried something pretty simple tests and think I failed a basic security check.


I'm a bit worries that anybody can come to my site and paste the link to get the last downloaded file. 

Does this happen to anyone else?  Any ideas for a fix?

--BT

Title: Re: Download a Zipped Album With Basic Security
Post by: nike_bytom on May 03, 2010, 07:40:48 pm
Hi i have litlle problem with this code, zip download option works ok but on my template i get this :  (my album properties icons above the thumbnails disappear, all i have is)

    * {MODIFY_ICO}
    * {PARENT_CAT_ICO}
    * {EDIT_PICS_ICO}
    * {ALBUM_MGR_ICO}

cpg1.5.3
any idea what is wrong


http://lobuziaki.info

login:test
pass:12345
Title: Re: Download a Zipped Album With Basic Security
Post by: Joachim Müller on May 03, 2010, 11:18:12 pm
The mod you're trying to implement is for cpg1.4.x and can't be used with cpg1.5.3. Undo your edits. The dev team is not fond of this mod anyway - just forget it, it's not really that good anyway.
Title: Re: Download a Zipped Album With Basic Security
Post by: btaz on May 04, 2010, 05:38:52 am
To the admin:  This is a really useful mod as it lets me exchange photos with my family easily.  If the functionality exists by some other means let me know.

--BT
Title: Re: Download a Zipped Album With Basic Security
Post by: Joachim Müller on May 04, 2010, 07:53:27 am
Board rules / Forum policies: Post Links (http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616). Coppermine already comes with zip support. I can't see the point of your request. Anyway, if your requesting this mod to be ported for cpg1.5.x, then please read up Don't ask for other versions (http://forum.coppermine-gallery.net/index.php/topic,24540.0.html).
Title: Re: [cpg1.4.x]: Download a Zipped Album With Basic Security
Post by: nike_bytom on May 04, 2010, 10:55:35 pm
Hi Thanks for all ur answers   ;)

From first post:
Quote
With that said I have only tested it with 1.4.13, 1.4.14 and 1.4.16. I have tried it with the following themes: Rainy Day, Classic and Water Drop. Also with a heavily customized Rainy Day variant that I am using in my CPG. It works with no problems with Stramm's ModPack installed.I have tested it with CPG 1.5 and it is working .

so it could be used with 1.5.3 ? ???

Quote
To the admin:  This is a really useful mod as it lets me exchange photos with my family easily.  If the functionality exists by some other means let me know.

I have got same feeling about this mod,it is very useful for me and my family.....

sory guys for messing about...
Regards
Rafał

Title: Re: [cpg1.4.x]: Download a Zipped Album With Basic Security
Post by: Joachim Müller on May 06, 2010, 05:12:38 pm
Then go ahead and use that "very usefull" mod. Use it with cpg1.5.x if you can, but stop asking questions about that aspect. This mod has been built for cpg1.4.x, and it's not very well designed imo. Applying it to cpg1.5.x is an even worse idea - the thread starter who created this mod sadly edited his initial posting instead of replying to the thread and posting a valid test report. In other words: you're on your own with this, no matter how helpfull you might consider this mod.
Title: Re: [cpg1.4.x]: Download a Zipped Album With Basic Security
Post by: MoshPuiu on February 15, 2011, 01:04:20 am
Then go ahead and use that "very usefull" mod. Use it with cpg1.5.x if you can, but stop asking questions about that aspect. This mod has been built for cpg1.4.x, and it's not very well designed imo. Applying it to cpg1.5.x is an even worse idea - the thread starter who created this mod sadly edited his initial posting instead of replying to the thread and posting a valid test report. In other words: you're on your own with this, no matter how helpfull you might consider this mod.

I noticed some sarcastic and superior tone in your post; maybe you are angry :(
It is the first forum I've met where one of moderators have replies like these: 'Then go ahead and use that "very usefull" mod. Use it with cpg1.5.x if you can...' or ' you're on your own with this, no matter how helpfull you might consider this mod'...
You should be shame with that answer...

In other words this mod really is very usefull (at least for me, one of the commoners);
...and if you don't see the point of request, I'll explain to you: If you want to download 100 files from one album, you have to click hundreds times instead to click few times on 'download album'.

So, if anybody knows one method to download an entire album (zip or whatever method...) on version 1.5.12, please post it...
Thanks in advance!


Title: Re: [cpg1.4.x]: Download a Zipped Album With Basic Security
Post by: clocktowerweb on July 17, 2011, 02:49:53 am
Hey, just wanted to say this has helped me loads, I needed to download images in album groups from an old version of Coppermine (1.4.18) - this is working perfectly.

Thank you  :)