Advanced search  

News:

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

Pages: 1 [2]   Go Down

Author Topic: Access to Full Size images for certain users  (Read 9499 times)

0 Members and 1 Guest are viewing this topic.

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for sertain users
« Reply #20 on: March 23, 2016, 02:28:41 PM »

André

O .... yes, sure. not a problem. I do have my moments ... sorry.

Yes, tahnx, I can do that.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for sertain users
« Reply #21 on: April 13, 2016, 12:24:33 PM »

Create a file "access.php" in plugins/fullsize_access. Each line needs to contain the following data:
Code: [Select]
<USER_ID> <ALBUM_ID>(USER_ID and ALBUM_ID are separated by space). Example:
Code: [Select]
1 1
2 1
1 2
1 3
2 6
3 8


Now, replace the content of fullsize_check.php with this:
Code: [Select]
<?php
function fullsize_check_user() {
    if (
GALLERY_ADMIN_MODE) {
        return 
true;
    }
    if (!
USER_ID) {
        return 
false;
    }
    global 
$CONFIG;
    
$superCage Inspekt::makeSuperCage();
    
$pid $superCage->get->getInt('pid');
    
$aid mysql_result(cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_PICTURES']} WHERE pid = $pid"), 0);
    
$access file_get_contents('plugins/fullsize_access/access.php');
    
$access str_replace("\r""\n"$access);
    
$access str_replace("\n\n""\n"$access);
    
$lines explode("\n"$access);
    foreach (
$lines as $line) {
        
$user_id NULL;
        
$album_id NULL;
        list(
$user_id$album_id) = explode(" "trim($line));
        if (
USER_ID == $user_id && $aid == $album_id) {
            return 
true;
        }
    }
    return 
false;
}
?>

As you can see, I already added general access for the admin user and denied for unregistered users. If you don't like that, change it to your needs. Additionally, I removed the check for
Code: [Select]
$superCage->cookie->getInt($CONFIG['cookie_name'].'_agb')as I wasn't asked to accept anything while testing. Of course it's possible to re-add this check, if needed. Just let me know.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #22 on: April 13, 2016, 03:15:03 PM »

Thanx André

Got it to work fine. Thanx a lot for your input. Much appreciate it.

Hope this plugin can be changed sometime to make it a bit easier. But for now, I am 100% happy.

Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #23 on: April 22, 2016, 09:27:46 AM »

Hi André

Just two more things.

1. If someone download a photo, I get a text "Fullsize image <051-MB1-0004.jpg> has been downloaded by user <User1234>
Users email address is : User1234@whatever.com"

Q: Can we add the users IP address to this ?

2. Can I add a domain name (e.g. boy-dols.com_051-MB1-0004.jpg  with "boy-dols.com_" prefixed before the filename) to the filename that is downloaded ?

Thanx in advance.

Best

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #24 on: April 22, 2016, 09:56:37 AM »

1. If someone download a photo, I get a text "Fullsize image <051-MB1-0004.jpg> has been downloaded by user <User1234>
Users email address is : User1234@whatever.com"

Q: Can we add the users IP address to this ?

Open fullsize_secure, find
Code: [Select]
function download_mail($filename,$uid) {

global $CONFIG;
and replace with
Code: [Select]
function download_mail($filename,$uid) {

global $CONFIG, $raw_ip;

find
Code: [Select]
"\nUsers email address is : " . $row[1];and replace with
Code: [Select]
"\nUser's email address is : " . $row[1] . "\nUser's IP address is : " . $raw_ip;

2. Can I add a domain name (e.g. boy-dols.com_051-MB1-0004.jpg  with "boy-dols.com_" prefixed before the filename) to the filename that is downloaded ?

Open jpgdownload.php, find
Code: [Select]
header('Content-Disposition: attachment; filename=' . basename($file));and replace with
Code: [Select]
header('Content-Disposition: attachment; filename=boy-dols.com_' . basename($file));
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #25 on: April 22, 2016, 10:03:03 AM »

André

Wow, that was fast ... I will do changes and report back.

Thanx a million.

Btw, the zip download of entire album is disabled due to library shorting ... will it be a mission to change that ?

Best

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #26 on: April 22, 2016, 10:08:39 AM »

the zip download of entire album is disabled due to library shorting

Is this related to the fullsize_access plugin?
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #27 on: April 22, 2016, 10:33:20 AM »

Yes.

In codebase.php line 9 :

// ZIP download feature disabled (doesn't work because of missing library)
//$thisplugin->add_action('post_breadcrumb','ziplink');

Would be nice to have this working though.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #28 on: April 22, 2016, 11:30:44 AM »

Open codebase.php, find
Code: [Select]
//$thisplugin->add_action('post_breadcrumb','ziplink');and replace with
Code: [Select]
$thisplugin->add_action('post_breadcrumb','ziplink');

Open zipdownload_extended.php, find
Code: [Select]
$zip = new zipfile($cwd,$flags);

$zip->addfiles($files);

$zip->filedownload('pictures.zip');
and replace with
Code: [Select]
$options = array(
    'inmemory'   => 1,
);
$zip = new archive($cwd,$flags);
$zip->set_options($options);
$zip->add_files($files);
$zip->download_file('pictures.zip');

This adds the link and opens a download dialog for me. Unfortunately, the file name is wrong and the file doesn't contain anything. I've currently no time to have a closer look at this, so I posted what I got.


By the way, I don't think that this request is related to your initial question. Additionally, you also posted an issue in the plugin announcement thread of the Download complete album as ZIP plugin. If you want to use that plugin, I suggest to fix the other plugin and drop the idea of fixing that functionality of the fullsize_access plugin.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #29 on: April 22, 2016, 12:44:00 PM »

André

I made the changes on the zip section, but I do not get a link and does not open a dialog for me. Where does this open a link for you and what does this dialogue looks like ?

Should I enable zip downloads in main config or just in the config of the plugin ?

Regards

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #30 on: April 22, 2016, 12:48:53 PM »

First of all: sorry, it wasn't you who posted the issue in the other thread: http://forum.coppermine-gallery.net/index.php/topic,74257.msg381466.html#msg381466

The plugin checks if you're allowed to download pictures. Maybe we need to adjust your custom mod to display the download link. I'll check that later.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #31 on: June 14, 2016, 08:25:49 PM »

Hi Αndré

Sorry to bother again. I need to ask you another big favour.

The mods for full access works fine, but I still have a group "VIP" which is uder group "4".

In the file "fullsize_check.php" there's a part

"
function fullsize_check_user() {
   if (GALLERY_ADMIN_MODE) {
        return true;
    }
    if (!USER_ID) {
        return false;
    }
  etc . "

How can I script it to allow also allow full access to the usergroup "4" as it does with the part " if (GALLERY_ADMIN_MODE) {
        return true; "

Im not sure how to add it.

Also, have you managed to check the plugin yet to allow the zip download function yet ?

Thanx in advance

Regards

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #32 on: June 16, 2016, 05:11:43 PM »

How can I script it to allow also allow full access to the usergroup "4" as it does with the part " if (GALLERY_ADMIN_MODE) {
        return true; "

Add,
Code: [Select]
    global $USER_DATA;
    if (in_array(4, $USER_DATA['groups'])) {
        return true;
    }
below
Code: [Select]
    if (GALLERY_ADMIN_MODE) {
        return true;
    }


have you managed to check the plugin yet to allow the zip download function yet ?

No, sorry.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #33 on: June 17, 2016, 02:31:02 AM »

Thanx a lot André
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #34 on: June 17, 2016, 09:58:38 AM »

I just had a look at your other issue. In codebase.php we find this code:
Code: [Select]
function ziplink(){
global $CONFIG;
$superCage = Inspekt::makeSuperCage();

if ($CONFIG['plugin_ks_fullsize_zip'] != 0 ){

if( $superCage->get->testInt('album') and !$superCage->get->keyExists('pid') and fullsize_check_user()){
echo '<div class="tableh1"><b>';
echo '<a style="color:white; text-align:right;" href="plugins/fullsize_access/zipdownload_extended.php?album=' . $superCage->get->getInt('album') . '" >Download aller Bilder dieses Albums als ZIP Datei</a>';
echo '</b></div>';
}
if( strstr($superCage->get->getAlpha('album'),'favpics') != false  and !$superCage->get->keyExists('pid') and fullsize_check_user()){
echo '<div class="tableh1"><b>';
echo '<a style="color:white" href="plugins/fullsize_access/zipdownload_extended.php?fav' . '" >Download aller Favoriten als ZIP Datei</a>';
echo '</b></div>';
}

}
}

First of all, please check if $CONFIG['plugin_ks_fullsize_zip'] is "1" (have a look at the config table in your Coppermine MySQL database). If so, with your last modification, the download button should be displayed for all admins and users of your VIP group.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #35 on: June 17, 2016, 11:40:58 AM »

Hi André

I have checked "if ($CONFIG['plugin_ks_fullsize_zip'] != 0" and change it to "if ($CONFIG['plugin_ks_fullsize_zip'] != 1", and also checked that the "plugin_ks_fullsize_zip" is set to 1, but I did not managed to get a link to "Download aller Favoriten als ZIP Datei" ....

Where is this link suppose to show ?

Regards

JohannM
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #36 on: June 17, 2016, 11:49:59 AM »

André

Sorry, got the link now. I will just make it a bit more visable. Thanx.

I will test it and report.

Thanx so far.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #37 on: June 17, 2016, 11:55:57 AM »

André

Im testing and get this error.

"Fatal error: Class 'zipfile' not found in /home/boyidols/public_html/plugins/fullsize_access/zipdownload_extended.php on line 125"

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15277
Re: Access to Full Size images for certain users
« Reply #38 on: June 17, 2016, 11:59:09 AM »

"Fatal error: Class 'zipfile' not found in /home/boyidols/public_html/plugins/fullsize_access/zipdownload_extended.php on line 125"

Please have a look at my instructions in this post: http://forum.coppermine-gallery.net/index.php/topic,78547.msg381485.html#msg381485

As it probably also won't work for you, I suggest to use the "download all albums as zip file" plugin and add a check for fullsize_check_user() at some places to restrict access.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 214
Re: Access to Full Size images for certain users
« Reply #39 on: January 11, 2017, 11:44:00 AM »

Hi André

First of all, a very happy and prosperous 2017 for you.

Question: The cript is working fine for me now. My customers asked me now if it is possible to download a zip file contaning all the photos. Not to use other scripts, I compressed the files into a zip. Now, (as I coded it with your help ), the "DOWNLOAD FULL SIZE IMAGE" button is above the intermediate photo, but does not appear above the "zip" file. Anyway to fix this that it shows on top of zip file also ? I have VIP usergroup that allows HR downloads only.

Thanx, and hoping for a reply soon.

Best Regards

JohannM
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.091 seconds with 20 queries.