Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: modding "enable buddy view of private album"  (Read 2819 times)

0 Members and 1 Guest are viewing this topic.

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
modding "enable buddy view of private album"
« on: February 07, 2007, 05:22:22 pm »

Hi Stramm,

Hope you are well.

I am currently integrating your modpack, mainly for the buddies feature. Even though, I decided that for buddy queries I will use my own social network db. (my 'buddy' db stores buddies separated by commas, and does not make a new row for each buddy)

The main feature I would like to use is enabling buddy view of the private album!

I have been analyzing the code, and I think I found where CPG pulls the array of buddies and checks it the current user is a member of the buddy array.
 here it is
functions.inc.php
   
line 747

Code: [Select]
if ($CONFIG['enable_buddy_private_view'] && USER_ID) {
[b]$buddies[/b] = cpg_db_query("SELECT a.aid FROM {$CONFIG['TABLE_ALBUMS']} as a INNER JOIN {$CONFIG['TABLE_BUDDY']} AS b on a.category=b.buddy_id + ". FIRST_USER_CAT ." WHERE b.user_id = ".USER_ID." AND a.visibility = '-1' AND buddy_ok = 'YES' OR category = ".(USER_ID + FIRST_USER_CAT));
while(list($allowed_list[]) = mysql_fetch_row($buddies));


Will the $buddies array contain a list of buddies separated by commas? Looking at the query it seems like it is pulling in some albums as well...
For my db I can pull the same array, it is just called $friends, and I could plug that in here...

Please let me know.

Thank you,

Gyuri
Logged

Stramm

  • Moderator
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: modding "enable buddy view of private album"
« Reply #1 on: February 07, 2007, 08:24:56 pm »

The buddy feature is making use of CPGs private album feature and therefore integrating into that system. So it's pulling a list of forbidden albums (comma separated). Few lines below you'll see exactly what it does...

Code: [Select]
                $FORBIDDEN_SET = "p.aid NOT IN (".substr($set, 0, -1).') ';
                $ALBUM_SET .= 'AND aid NOT IN ('.substr($set, 0, -1).') ';

-> ~ p.aid NOT IN 2,3,19,174

giorgio79

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 114
Re: modding "enable buddy view of private album"
« Reply #2 on: February 08, 2007, 12:31:16 am »

Thanks Stramm!

And as I udnerstand it does so by selecting the albums (a.id) which belong to the buddies (a.category=b.buddy_id) of the current user (b.user_id), right? I am just trying to grasp the flow :)

SELECT a.aid FROM {$CONFIG['TABLE_ALBUMS']} as a INNER JOIN {$CONFIG['TABLE_BUDDY']} AS b on a.category=b.buddy_id + ". FIRST_USER_CAT ." WHERE b.user_id = ".USER_ID." AND a.visibility = '-1' AND buddy_ok = 'YES' OR category = ".(USER_ID + FIRST_USER_CAT))
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.