search by username is missing search by username is missing
 

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]

Main Menu

search by username is missing

Started by angelsfire, January 09, 2023, 12:03:17 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

angelsfire

my gallery version: Coppermine Photo Gallery 1.6.09 (stable)
https://www.thefantasiesattic.net/attic/cpg/index.php

I have not needed to search by name in such a long time that I did not notice it missing. But as you can see from the image it is not listed anymore. Now I did get it to show up but the rest of the files that needed the code changed just made it not search and I got an error.



1. Open search.php

FIND:

$customs
$ip

and above, ADD:


                                        <tr>
                                                <td><input type="checkbox" name="owner_name" id="owner_name" class="checkbox" /><label for="owner_name" class="clickable_option">Owner name</label></td>
                                                <td>&nbsp;</td>
                                        </tr>





adding the above code made it appear in the list but no more the following is the rest of the code that was all for version 1.5.48 (I loved that version). I have not updated any farther since it took someone coming in to  make it behave (mainly a hosting issue it much later came out).


2. Open thumbnails.php

FIND

$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type');

REPLACE WITH
$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4', 'type', 'owner_name');


3. Open include/search.inc.php

FIND

$allowed = array('title', 'caption', 'keywords', 'filename', 'pic_raw_ip', 'pic_hdr_ip', 'user1', 'user2', 'user3', 'user4');


ADD BELOW

global $cpg_udb;
// Use actual column name for search by owner name
if ($USER['search']['params']['owner_name']) {
    $USER['search']['params'][$cpg_udb->field['username']] = true;
    $allowed[] = $cpg_udb->field['username'];
}


FIND

            $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
                WHERE $sql
                AND ($sort_order)";

REPLACE

            $query = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} AS p
                LEFT JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
                WHERE $sql
                AND ($sort_order)";


FIND

            $query = "SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE " . $sql;

            $temp = str_replace('SELECT *', 'SELECT COUNT(*)', $query);

REPLACE

            $query = "SELECT p.*, u.{$cpg_udb->field['username']} AS owner_name FROM {$CONFIG['TABLE_PICTURES']} AS p
            LEFT JOIN {$cpg_udb->usertable} AS u ON p.owner_id = u.{$cpg_udb->field['user_id']}
            WHERE " . $sql;

            $temp = str_replace("SELECT p.*, u.{$cpg_udb->field['username']} AS owner_name", 'SELECT COUNT(*)', $query);




Can someone please give me the proper code to allow the username to show and be searched for?  It is bridged but will not let me return to bridging to reset the password or anything else since the upgrade. If an admin password is needed then let me know.

Joe Carver

Try an update to Coppermine 1.6.2 and run Check Versions (versioncheck.php) after completing the update.

What you are looking for is working out of the box for me on 1.6.2.

Dark_Angel

I have avoided updating further than the version I had since it was so hard to update the gallery to it. I will see if I can do it withut killing my gallery.

Dark_Angel

I forgot to mention that my PHP version is 7.1 and the version you said to update to updates for v8.1+ will that mess things up?

Joe Carver

Quote from: Dark_Angel on January 09, 2023, 05:48:50 AM
I have avoided updating further than the version I had since it was so hard to update the gallery to it. I will see if I can do it withut killing my gallery.

Follow the instructions (links above), make your backups first, and take your time.

Quote from: Dark_Angel on January 09, 2023, 05:59:53 AM
I forgot to mention that my PHP version is 7.1 and the version you said to update to updates for v8.1+ will that mess things up?
No, it will not.

Dark_Angel

will try and see what it does and let you know, am getting ready for surgery on Friday so it may be a bit. Thanks

angelsfire

still trying to get caught up to attempt this. hopefully, it won't want me to log into the bridge cause lost that info quite a while ago.

Dark_Angel

Well with sickness and net issues and sheer fright of losing the gallery, I still have not gotten this taken care of. I also have no way of knowing my bridge username/password with the hard drive eating everything I had saved on it.

I don't suppose there is a way to install the prior to these [1.5.48 one not the 1.6+] then importing the database? We all l iked that version, it never gave me problems.