UBB.Dev
Posted By: ksanuk PhotoPost hack question - 01/09/2005 5:53 AM
Hi,

I found this hack at Photopostdev.com and think it will be perfect for my site (it allows all members to see their own photos, but only paying members to see all photos).
Problem is that part of it is missing, the part that does the checking of access.

Could someone here figure this out, or at least point me in the right direction?

Code of the hack is:
Code
<br />(1) At the end of function get_imagethumb in pp-inc:<br /><br />    // begin hack<br />    if ( ! permitted("PM", $theuser) )<br />      $imgtag="<A HREF=/pay/payMain.php><br />             <IMG SRC=../images/emptyFrame.jpg border=0 height=100 width=100 alt=\"Why is this frame empty?\"><br />             </A>";<br />    // end hack<br />    return( $imgtag );<br />}<br /><br />(2) Approx line 380 of showphoto, after $imgdisp has been assigned (no more found in text search):<br /><br />  // begin hack<br />  if ( ! permitted("PM", $iuserid) )<br />  {<br />    $imgdisp="<table border=\"2\" width=\"$width\" height=\"$height\" bordercolor=\"#996633\" bordercolorlight=\"#996633\" bordercolordark=\"#996633\"><br />       <tr><td width=\"100%\">&nbsp</tr></table>";<br />  }<br />  // end hack<br /><br />(3) In pp-inc, after $User=array();<br /><br />  You would need to write your own function here... depends on how you determine<br />  who is currently logged in and what thier permissions are. Key is to always permit<br />  accesss when id or name matches current login. Otherwise, only for paid members.<br /><br />  // begin hack<br />  function permitted($op, $targetId=0, $targetName="") {<br />    global $memberPermit, $memberId, $memberName;<br />    if ( ($memberId<>0) && ($memberId==$targetId) ) return true;<br />    if ( ($memberName<>"Guest") && ($memberName!="") && strtolower($memberName)==strtolower($targetName) ) return true;<br />    for ($i=0;$i<strlen($op);$i++) {<br />      $c=substr($op,$i,1);<br />      if (is_integer(strpos($memberPermit,$c))) return true;<br />    }<br />  // Allow member to see/do his own stuff  return false;<br />  }<br />  // end hack<br />


Sanuk!
Posted By: AllenAyres Re: PhotoPost hack question - 01/18/2005 7:42 AM
What does this mod do? Did you already get an answer at photopostdev?
Posted By: ksanuk Re: PhotoPost hack question - 01/19/2005 1:57 PM
Hi,

"What does this mod do?"

The hack allows everybody to see the pictures they uploaded themselves, but only those people in a specific usergroup (for instance paying members) to see all pictures.

"Did you already get an answer at photopostdev?"

Must admit I did not post there as I figured this would be more UBBT related than PhotoPost. The post in question was more than 6 months old as well.

Did have a bit of play with it myself, but could not get it working.

Sanuk!
© UBB.Developers