Advanced search  

News:

cpg1.5.42 maintenance release - upgrade recommended
The Coppermine development team is releasing an update for Coppermine in order to fix several minor issues. All fixes are not security critical, so if your gallery is running fine with cpg1.5.36, cpg1.5.38 or cpg1.5.40 you don't need to upgrade. If you are running an older version than cpg1.5.36, you must update to this latest version as soon as possible because of the security impact!
[more]

Pages: [1]   Go Down

Author Topic: Show/count only keywords for accessible categories  (Read 2366 times)

0 Members and 1 Guest are viewing this topic.

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Show/count only keywords for accessible categories
« on: November 06, 2013, 11:23:22 AM »

Hi everyone,

First post, so please be gentle :).

I was wondering if it's possible to count only keywords from albums which you have a right to view.

So for instance, a guest will only see keywords from albums available to guests, but not those reserved for registered users, and registered users will see the keywords for all albums except private ones (but including his own private albums).

I'm pretty sure the following section from keyword.inc.php would need some modification, but I'm unsure how to do it:

Code: [Select]
    while (list($keywords) = mysql_fetch_row($result)) {
        $array = explode($CONFIG['keyword_separator'], html_entity_decode($keywords));

        foreach($array as $word) {
            if (!in_array($word = utf_strtolower($word), $keywords_array)) {
                $keywords_array[] = $word;
                $keyword_count[$word] = 1;
            } else {
                $keyword_count[$word]++;
            }
        }
    }
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15039
Re: Show/count only keywords for accessible categories
« Reply #1 on: November 06, 2013, 12:57:41 PM »

Open include/keyword.inc.php, find
Code: [Select]
$result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> '' $ALBUM_SET");and replace with
Code: [Select]
get_meta_album_set(0);
$result = cpg_db_query("SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} AS r $RESTRICTEDWHERE AND keywords <> ''");


It seems that $ALBUM_SET is always empty. It's probably a leftover of cpg1.4.x and not used anymore in cpg1.5.x. I've found two other references to it in sidebar.php which should be replaced accordingly and
Code: [Select]
$ALBUM_SET          = ''; in include/init.inc.php, which should be removed.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15039
Re: Show/count only keywords for accessible categories
« Reply #2 on: November 06, 2013, 01:07:46 PM »

Fixed clickable keyword list content in SVN revision 8620.
Logged

E. William

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
Re: Show/count only keywords for accessible categories
« Reply #3 on: November 07, 2013, 12:07:27 AM »

Works like a charm :).

Thanks a lot for the help.
Logged
Pages: [1]   Go Up
 

Page created in 0.071 seconds with 20 queries.