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: Showing private albums, but not "Me Only" albums without a password.  (Read 4980 times)

0 Members and 1 Guest are viewing this topic.

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33

As always I've been messing around with the code, but can't get it to work.

I'd like to have Show private album icon to unlogged user on, but still hide private albums which have no password set.
So it should only show:

Public albums (obviously :))
Group Access albums
Private Albums with password protection

Where and how would I be able to code this?

Thanks for you help :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #1 on: December 09, 2013, 12:10:28 pm »

Open index.php, find
Code: [Select]
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        //unused code {SaWey}
        //$pic_filter = ' ' . $FORBIDDEN_SET;
    }
and replace with
Code: [Select]
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        //unused code {SaWey}
        //$pic_filter = ' ' . $FORBIDDEN_SET;
    } elseif (!empty($FORBIDDEN_SET)) {
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT);
        while ($row = mysql_fetch_assoc($result)) {
            $tmp_array[] = $row['aid'];
        }
        mysql_free_result($result);
        if ($tmp_array) {
            $album_filter = " AND a.aid NOT IN (" . implode(', ', $tmp_array) . ') ';
        }
       
    }
Logged

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #2 on: December 11, 2013, 08:33:22 am »

Thanks for this Andre.

It works as that it does show albums listed in groups, but still hides private albums with password protection.

I tried changing the line:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT);

to:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT." OR alb_password != NULL");
and variations of NULL like \"\" and 0, but to no avail. It still hides password protected albums.

Any idea how I can get password protected albums to show as well?
Logged

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Showing private albums, but not "Me Only" albums without a password.
« Reply #3 on: December 11, 2013, 08:51:10 am »

Never mind :)

I screwed up.

Changed the line to:
        $result = cpg_db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE visibility > ".FIRST_USER_CAT." AND alb_password = \"\"");

And now it works perfectly :).
Thanks for helping me in the right direction. You are a king :).
Logged
Pages: [1]   Go Up
 

Page created in 0.035 seconds with 19 queries.