forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 miscellaneous => Topic started by: nambroque on February 15, 2023, 11:49:21 pm

Title: Editing linked files
Post by: nambroque on February 15, 2023, 11:49:21 pm
Reggarding this thread (https://forum.coppermine-gallery.net/index.php/topic,78606.0.html).
After installing 1.6.21 it doesn´t work any more.  :-[
Title: Re: Editing linked files
Post by: ron4mac 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.
Title: Re: Editing linked files
Post by: nambroque 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
Title: Re: Editing linked files
Post by: ron4mac 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);
Title: Re: Editing linked files
Post by: nambroque 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!
Title: Re: Editing linked files
Post by: Celestiq2020 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?