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: Editing linked files  (Read 4687 times)

0 Members and 1 Guest are viewing this topic.

nambroque

  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 95
    • Galería Fotometeo
Editing linked files
« on: February 15, 2023, 11:49:21 pm »

Reggarding this thread.
After installing 1.6.21 it doesn´t work any more.  :-[
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Editing linked files
« Reply #1 on: February 16, 2023, 01:21:26 pm »

If it would be of any help, one of the Admin Tools allows you to remove specific keywords. I assume people add a keyword for contest photos. After the contest, that keyword can be removed from everything with that Admin Tool.
Logged

nambroque

  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 95
    • Galería Fotometeo
Re: Editing linked files
« Reply #2 on: February 17, 2023, 08:27:52 am »

Thanks for your reply, but that is not useful for me
What I need is linked files to appear when clicking on "Edit files" of an album which is empty, but contains files linked there via the keyword of the album
Andrè gave me a solution for 1.5, and it worked great:

Open editpics.php, find
Code: [Select]
    $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p " .
            " INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a " .
            " ON a.aid = p.aid " .
            " WHERE p.aid = '$album_id' $owner_str" .
            " ORDER BY p.pid DESC LIMIT $start, $count";

    $result = cpg_db_query($sql);
and replace with
Code: [Select]
    if (count($FORBIDDEN_SET_DATA) > 0) {
        $forbidden_set_string = ' AND aid NOT IN (' . implode(', ', $FORBIDDEN_SET_DATA) . ')';
    } else {
        $forbidden_set_string = '';
    }

    if (!empty($ALBUM_DATA['keyword'])) {
        $keyword = "OR (keywords like '%{$ALBUM_DATA['keyword']}%' $forbidden_set_string )";
    } else {
        $keyword = '';
    }

    $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p " .
            " INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a " .
            " ON a.aid = p.aid " .
            " WHERE p.aid = '$album_id' $owner_str $keyword" .
            " ORDER BY p.pid DESC LIMIT $start, $count";

    $result = cpg_db_query($sql);

    $pic_count = mysql_num_rows($result);


But after installing 1.6 it doesn't work any more
Logged

ron4mac

  • Administrator
  • Coppermine addict
  • *****
  • Country: us
  • Offline Offline
  • Posts: 2026
Re: Editing linked files
« Reply #3 on: February 17, 2023, 02:38:22 pm »

I see you reverted to CPG 1.5.48.

You should be able to make the same modification to CPG 1.6.x in editpics.php at about line 753.
Just make the last line of the modification:
Code: [Select]
$pic_count = cpg_db_num_rows($result);instead of:
Code: [Select]
$pic_count = mysql_num_rows($result);
Logged

nambroque

  • Coppermine regular visitor
  • **
  • Country: es
  • Offline Offline
  • Gender: Male
  • Posts: 95
    • Galería Fotometeo
Re: Editing linked files
« Reply #4 on: February 18, 2023, 07:12:00 pm »

I'm sorry we`re back to 1.5.48 again, as our gallery failed two days ago. It had never happened before, so we are concerned it may have happened due to any problem with the new version
We'll wait until updating to 1.6.x is mandatory, and then we'll try to change this again.
Thank you very much for your reply!
Logged

Celestiq2020

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Editing linked files
« Reply #5 on: April 16, 2023, 06:24:46 am »

Thanks for your reply, but that is not useful for me
What I need is linked files to appear when clicking on "Edit files" of an album which is empty, but contains files linked there via the keyword of the album
Andrè gave me a solution for 1.5, and it worked great:


But after installing 1.6 it doesn't work any more

hello,
I am not a programmer, where do I need to copy and paste this code?
Logged
Pages: [1]   Go Up
 

Page created in 0.194 seconds with 20 queries.