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: Fullsize access plugin for cpg1.5.x  (Read 17503 times)

0 Members and 1 Guest are viewing this topic.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #20 on: January 09, 2016, 09:55:14 pm »

Independent from the functionality of the plugin, with "download" you mean access to the full-sized picture, right?
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #21 on: January 09, 2016, 10:16:39 pm »

Yes André
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #22 on: January 09, 2016, 10:18:50 pm »

Will have a closer look as soon as possible. Has no priority for me, sorry.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #23 on: January 09, 2016, 10:25:09 pm »

Thanx André

Will wait in anticipation ...  ;D
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #24 on: March 20, 2016, 10:07:47 am »

Hi André

Had any chance to look at this already. I tried to find the "hooks" for the info part, to try to change it to current pic data, but with no luck.

Basicly what I want to do as said, is to have this button displayed in top/bottom of the intermediate pic, in spite of the file_info section.

At ehe moment, when I grant certain users VIP status (access to the bigger photo), they basicly have access to all albums with bigger photos. I want to be able to grant access for certain users for bigger pictures just for certain albums. Surely there must be a easier way to do this.

Regards

Johann
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #25 on: March 21, 2016, 10:16:36 am »

Open fullsize_check.php, find
Code: [Select]
if( USER_ID && $superCage->cookie->getInt($CONFIG['cookie_name'].'_agb') === 1){and replace with
Code: [Select]
    global $USER_DATA;
    if(in_array(4, $USER_DATA['groups'])) {
(where "4" is the group ID of your VIP group).


Open codebase.php, find
Code: [Select]
?>and above, add
Code: [Select]
$thisplugin->add_filter('html_image_reduced','download_link_img');
$thisplugin->add_filter('html_image_reduced_overlay','download_link_img');

function  download_link_img($pic_html)
{
global $CURRENT_PIC_DATA,$CONFIG;

if( fullsize_check_user() ){
$download = '<a href="plugins/fullsize_access/jpgdownload.php?pid=' . $CURRENT_PIC_DATA['pid'] . '" >Download Original File</a>';
} else {
$download = 'Fullsize download for registered users only! Please, <a href="register.php" >Register</a> or <a href="login.php" >login</a>';
}
return $pic_html.$download;
}
(you probably either want to edit or remove the text for users that have no fullsize access).
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 720
    • GMC Design Photo Gallery
Re: Fullsize access plugin for cpg1.5.x
« Reply #26 on: March 21, 2016, 12:07:30 pm »

Quote
 
Code: [Select]
global $USER_DATA;
  if(in_array(4, $USER_DATA['groups'])) {
(where "4" is the group ID of your VIP group).
As I understand from JohannM's other thread - he will have a VIP group PER ALBUM... so he will need to determine what group to look for based on the album being viewed...
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #27 on: March 21, 2016, 01:18:12 pm »

That was no requirement in his post in this thread (yet) and should be discussed in the other thread.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #28 on: March 21, 2016, 08:12:54 pm »

André

Thanx so much for your help. I managed to get it working.

Two questions if you dont mind:

1. If I want to add e.g. two user groups (e.g. VIP wich is 4, and Admin which is 1), how would I code the line ?
2. If I want to put the link ontop of the intermediate pic, where should I change what ?

I haven't tested the zip function there, do you perhaps know if it works ?

Thanx a lot for your help.

Regards

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #29 on: March 22, 2016, 02:34:03 pm »

1. If I want to add e.g. two user groups (e.g. VIP wich is 4, and Admin which is 1), how would I code the line ?

Replace
Code: [Select]
if(in_array(4, $USER_DATA['groups'])) {with
Code: [Select]
if(in_array(4, $USER_DATA['groups']) || in_array(1, $USER_DATA['groups'])) {

2. If I want to put the link ontop of the intermediate pic, where should I change what ?

Replace
Code: [Select]
return $pic_html.$download;with
Code: [Select]
return $download."<br />\n".$pic_html;
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #30 on: March 22, 2016, 03:15:49 pm »

André

Thanx a million.

If I look at the script changes, it's actually very simple. I'm getting stupid with php.

Thanx in anyway.

By the way, in the plugins admin section where you can view the downloads ( "show downloads history" ) and then you get a section "downloaded fullsize images sorted by download date ( with user    date    filename    album    ip-address), will it be complecated to add the actual category as well ?

Thanx a lot for your input.

Regards

JohannM
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #31 on: March 22, 2016, 03:39:21 pm »

will it be complecated to add the actual category as well ?

Open fullsize_hist.php, find
Code: [Select]
starttable('100%','downloaded fullsize images sorted by download date');

$query = "SELECT  user.user_name,hist.tstamp,hist.picname,pic.pid,alb.title,hist.ip FROM $utab As user,$htab As hist,$ptab AS pic,$atab AS alb  WHERE " .
         "hist.uid=user.user_id AND alb.aid=pic.aid AND hist.picname LIKE pic.filename ORDER BY hist.tstamp DESC " .
"LIMIT 100";
$res = cpg_db_query( $query );         

echo "<tr><td><table CELLPADDING=\"5\">\n";
echo "<b><tr class=\"tableb\">\n";
    echo "<td>\n";
    echo "<b>user</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>date</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>filename</b>";
    echo "</td>\n"; 
    echo "<td>\n";
    echo "<b>album</b>";
    echo "</td>\n"; 
        echo "<td>\n";
    echo "<b>ip-address</b>";
    echo "</td>\n";   

    echo "</tr></b>\n";

 while($row = mysql_fetch_row($res))
  {
    echo "<tr class=\"tableb\">\n";
    echo "<td>\n";
    echo $row[0];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[1];
    echo "</td>\n";
    echo "<td>\n";
    echo "<A HREF=\"displayimage.php?pos=-$row[3]\">$row[2]</A>";
    echo "</td>\n";
    echo "<td>\n";
    echo $row[4];
    echo "</td>\n";   
    echo "<td>\n";
    echo $row[5];
    echo "</td>\n";
    echo "</tr>\n";
  }
 
echo "</table></td></tr>\n";
 
mysql_free_result($res);
endtable(); 
echo "<br><br>";
and replace with
Code: [Select]
starttable('100%','downloaded fullsize images sorted by download date');

$query = "SELECT  user.user_name,hist.tstamp,hist.picname,pic.pid,alb.title,hist.ip,cat.name
            FROM {$CONFIG['TABLE_USERS']} AS user
            INNER JOIN {$CONFIG['TABLE_PREFIX']}fullsize_hist AS hist
            ON hist.uid=user.user_id
            INNER JOIN {$CONFIG['TABLE_PICTURES']} AS pic
            ON hist.picname = pic.filename
            INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS alb
            ON alb.aid=pic.aid
            LEFT JOIN {$CONFIG['TABLE_CATEGORIES']} AS cat
            ON cat.cid=alb.category
            ORDER BY hist.tstamp DESC
            LIMIT 100";
$res = cpg_db_query( $query );         

echo "<tr><td><table CELLPADDING=\"5\">\n";
echo "<b><tr class=\"tableb\">\n";
    echo "<td>\n";
    echo "<b>user</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>date</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>filename</b>";
    echo "</td>\n"; 
    echo "<td>\n";
    echo "<b>album</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>category</b>";
    echo "</td>\n"; 
        echo "<td>\n";
    echo "<b>ip-address</b>";
    echo "</td>\n";   

    echo "</tr></b>\n";

 while($row = mysql_fetch_row($res))
  {
    echo "<tr class=\"tableb\">\n";
    echo "<td>\n";
    echo $row[0];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[1];
    echo "</td>\n";
    echo "<td>\n";
    echo "<A HREF=\"displayimage.php?pos=-$row[3]\">$row[2]</A>";
    echo "</td>\n";
    echo "<td>\n";
    echo $row[4];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[6];
    echo "</td>\n";   
    echo "<td>\n";
    echo $row[5];
    echo "</td>\n";
    echo "</tr>\n";
  }
 
echo "</table></td></tr>\n";
 
mysql_free_result($res);
endtable(); 
echo "<br><br>";
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #32 on: March 22, 2016, 04:17:01 pm »

André

Thanx. Your an absolute star !!!

It works perfectly.

Thanx again.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #33 on: March 22, 2016, 04:22:07 pm »

Just a small note: if the album resides in the root category (* no category*) or in the user galleries, the script won't display a category name. This would need an additional check, which I haven't added, as I haven't found such albums in your gallery at first glance.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #34 on: March 22, 2016, 06:08:06 pm »

André

Its all fine for the moment. I do not have any albums in my root. And I do not have any users with their own albums. All albums and uploads is created by me and me only.

Thanx anyway.
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #35 on: March 22, 2016, 06:10:23 pm »

André

I just thought of something else that might be usefull to this "admin" side. A button to clear the current "logs". Is it a mission to code this and add a button ?

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #36 on: March 23, 2016, 09:08:58 am »

Open fullsize_hist.php, find
Code: [Select]
pagefooter();and above, add
Code: [Select]
echo '<br /><a href="'.$CPG_PHP_SELF.'?file=fullsize_access/fullsize_hist&amp;clearlog" class="admin_menu">Clear logs</a>';
find
Code: [Select]
if( !USER_IS_ADMIN ) {
 echo '<br><br><b>access to this page is restricted to administrators</b>';
 exit;
}
and below, add
Code: [Select]
if($superCage->get->keyExists('clearlog')) {
    cpg_db_query("DELETE FROM $htab");
}
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #37 on: March 23, 2016, 06:02:35 pm »

André

Thank you so much. Works wonderfull.

Your a star !
Logged

JohannM

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 223
Re: Fullsize access plugin for cpg1.5.x
« Reply #38 on: March 23, 2016, 06:08:23 pm »

André

Mmm, hope you dont mind.

Adding the Category in from of the album in "most viewed albums" on history page ?

Please. And thanx.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15369
Re: Fullsize access plugin for cpg1.5.x
« Reply #39 on: April 13, 2016, 11:46:44 am »

Open fullsize_hist.php, find
Code: [Select]
starttable('100%','most viewed albums');
$query = "SELECT alb.title,SUM(pic.hits) AS ahits, COUNT(*) FROM $atab AS alb, $ptab AS pic WHERE pic.aid=alb.aid GROUP BY alb.aid ORDER BY ahits DESC";
$res = cpg_db_query( $query );         

echo "<tr><td><table CELLPADDING=\"5\">\n";

    echo "<b><tr class=\"tableb\">\n";
    echo "<td>\n";
    echo "<b>album name</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>images in album</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>total hits in album</b>";
    echo "</td>\n";   
    echo "</tr></b>\n";


 while($row = mysql_fetch_row($res))
  {
    echo "<tr class=\"tableb\">\n";
    echo "<td>\n";
    echo $row[0];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[2];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[1];
    echo "</td>\n";   
    echo "</tr>\n";
  }
echo "</table></td></tr>\n";
 
mysql_free_result($res);
endtable();  // album statistics
and replace with
Code: [Select]
starttable('100%','most viewed albums');
$query = "SELECT alb.title,SUM(pic.hits) AS ahits, COUNT(*), cat.name
            FROM {$CONFIG['TABLE_ALBUMS']} AS alb
            INNER JOIN {$CONFIG['TABLE_PICTURES']} AS pic
            ON pic.aid=alb.aid
            LEFT JOIN {$CONFIG['TABLE_CATEGORIES']} AS cat
            ON cat.cid=alb.category
            GROUP BY alb.aid
            ORDER BY ahits DESC";
$res = cpg_db_query( $query );

echo "<tr><td><table CELLPADDING=\"5\">\n";

    echo "<b><tr class=\"tableb\">\n";
    echo "<td>\n";
    echo "<b>category</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>album name</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>images in album</b>";
    echo "</td>\n";
    echo "<td>\n";
    echo "<b>total hits in album</b>";
    echo "</td>\n";   
    echo "</tr></b>\n";


 while($row = mysql_fetch_row($res))
  {
    echo "<tr class=\"tableb\">\n";
    echo "<td>\n";
    echo $row[3];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[0];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[2];
    echo "</td>\n";
    echo "<td>\n";
    echo $row[1];
    echo "</td>\n";   
    echo "</tr>\n";
  }
echo "</table></td></tr>\n";
 
mysql_free_result($res);
endtable();  // album statistics
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.022 seconds with 20 queries.