coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 pnCPG (Coppermine for postNuke/Zikula) => Topic started by: hardlocke on October 12, 2003, 11:39:15 PM

Title: "register" only for fullsize pictures...!?
Post by: hardlocke on October 12, 2003, 11:39:15 PM
hi
i found in FAQ "How can I prevent unregistered user from viewing the gallery? "

but how can i prevent only the fullsize popup pictures from viewing by unregistered users? can anybody help me?
Title: "register" only for fullsize pictures...!?
Post by: Joachim Müller on October 13, 2003, 01:16:15 AM
this will be a possible feature of a future version of coppermine.
At the moment I don't know a hack that'll do that.

GauGau
Title: "register" only for fullsize pictures...!?
Post by: kegobeer on October 13, 2003, 01:54:37 AM
Try this:

In displayimage.php, replace:
if (isset($image_size['reduced'])) {
  $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
  $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
  $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','".uniqid(rand())."','toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
  $pic_html .= "<img src=\"".$picture_url."\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
  $pic_html .= "</a>\n";
} else {
  $pic_html = "<img src=\"".$picture_url."\" {$image_size['geom']} class=\"image\" border=\"0\" /><br />\n";
}

with this:if (isset($image_size['reduced'])) {
  $winsizeX = $CURRENT_PIC_DATA['pwidth'] + 16;
  $winsizeY = $CURRENT_PIC_DATA['pheight'] + 16;
  // Added check for popup only if user is registered
  if (USER_ID or USER_IS_ADMIN) {
    $pic_html = "<a href=\"javascript:;\" onClick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','".uniqid(rand())."','toolbar=yes,status=yes,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
    $pic_html .= "<img src=\"".$picture_url."\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
    $pic_html .= "</a>\n";
  } else {
    $pic_html = "<img src=\"".$picture_url."\" {$image_size['geom']} class=\"image\" border=\"0\" /><br />";
  }
} else {
  $pic_html = "<img src=\"".$picture_url."\" {$image_size['geom']} class=\"image\" border=\"0\" /><br />\n";
}
Tested with the nuke port, should work the same in the standalone version.
Title: "register" only for fullsize pictures...!?
Post by: hardlocke on October 13, 2003, 10:17:57 AM
thanks a lot, now it work fine with pnCPG.
but how can i now remove the "login/logoff" link in coppermine?
i would only show the username who is logged in via postnuke

how can i do this?


and another question:
how can i exclude also a user (ie a guest-user) from viewing the full-images?
Title: "register" only for fullsize pictures...!?
Post by: kegobeer on October 13, 2003, 04:08:52 PM
First, make sure you post your question in the appropriate forum.  This should be in the postNuke board.

Second, the hack I provided allows registered users to see the full size images.  Guest/anonymous users don't get to see the full size pics.

Third, if you want to remove the login/off link, just edit your theme and take it out.
Title: "register" only for fullsize pictures...!?
Post by: casNuy on October 13, 2003, 11:15:56 PM
With pnCPG it is easy to allow only access for registered users. This will be standard available (is actually a bug in the current version).
In addition one needs to change a few files in Coppermine to have people always routed through pnCPG.

Insert the following code :

if (!USER_ID) cpg_die(ERROR, '<a href=../index.php?module=pnCPG&func=main target=_top>Click here to access the Gallery</a>', __FILE__, __LINE__);


into the following files :
index.php, thumbnails.php, search.php, dispaly(image/card).php and showthumb.php

Insert this code just after :
require('include/init.inc.php');


I got this tip from CorkieJP who on his turn found this option on..
GauGau.de

So combining pnCPG with this hack will also take care of non-registered users being able to see Full screen pictures.

Cas
Title: "register" only for fullsize pictures...!?
Post by: hardlocke on November 08, 2003, 03:52:42 AM
hi cas
can i use this hack also to prevent guests from viewing the medium/fullsize pictures???