Fullsize access plugin for cpg1.5.x - Page 2 Fullsize access plugin for cpg1.5.x - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Fullsize access plugin for cpg1.5.x

Started by Αndré, May 04, 2012, 03:05:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Αndré

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

JohannM


Αndré

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

JohannM

Thanx André

Will wait in anticipation ...  ;D

JohannM

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

Αndré

Open fullsize_check.php, find
if( USER_ID && $superCage->cookie->getInt($CONFIG['cookie_name'].'_agb') === 1){
and replace with
    global $USER_DATA;
    if(in_array(4, $USER_DATA['groups'])) {

(where "4" is the group ID of your VIP group).


Open codebase.php, find
?>
and above, add
$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).

gmc

Quote
  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...
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

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

JohannM

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

Αndré

Quote from: JohannM on March 21, 2016, 08:12:54 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
if(in_array(4, $USER_DATA['groups'])) {
with
if(in_array(4, $USER_DATA['groups']) || in_array(1, $USER_DATA['groups'])) {


Quote from: JohannM on March 21, 2016, 08:12:54 PM
2. If I want to put the link ontop of the intermediate pic, where should I change what ?

Replace
return $pic_html.$download;
with
return $download."<br />\n".$pic_html;

JohannM

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

Αndré

Quote from: JohannM on March 22, 2016, 03:15:49 PM
will it be complecated to add the actual category as well ?

Open fullsize_hist.php, find
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
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>";

JohannM

André

Thanx. Your an absolute star !!!

It works perfectly.

Thanx again.

Αndré

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.

JohannM

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.

JohannM

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 ?


Αndré

Open fullsize_hist.php, find
pagefooter();
and above, add
echo '<br /><a href="'.$CPG_PHP_SELF.'?file=fullsize_access/fullsize_hist&amp;clearlog" class="admin_menu">Clear logs</a>';

find
if( !USER_IS_ADMIN ) {
echo '<br><br><b>access to this page is restricted to administrators</b>';
exit;
}

and below, add
if($superCage->get->keyExists('clearlog')) {
    cpg_db_query("DELETE FROM $htab");
}

JohannM

André

Thank you so much. Works wonderfull.

Your a star !

JohannM

André

Mmm, hope you dont mind.

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

Please. And thanx.

Αndré

Open fullsize_hist.php, find
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
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