Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Searching Filenames  (Read 4035 times)

0 Members and 1 Guest are viewing this topic.

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Searching Filenames
« on: April 18, 2008, 05:38:21 am »

Ok, so I know we can do things like this 

Code: [Select]
$searchword = "whatever";

$objCpm->cpm_viewRandomMediaFrom("cat=:album=:text=$searchword", 1, 4, $options);

to get image results using keywords, title etc which is cool. But it doesn't work with Filenames, I've dug into a few files but don't see anything jumping out at me saying "change me" can I get a nudge in the proper direction?

I know you can direct link to search results like this  thumbnails.php?album=search&search=findthisword

I've messed with this line from search.inc.php a tad thinking maybe it prioritized in order...it don't.

Code: [Select]
$USER['search']['params']['title'] = $USER['search']['params']['caption'] = $USER['search']['params']['keywords'] = $USER['search']['params']['filename'] = 1;
Someone please point in the proper direction.
Logged
Please give me some negative Karma. :)

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Searching Filenames
« Reply #1 on: April 18, 2008, 06:01:29 am »


You would need to mess with the cpmfetch_dao's makeSourceSql code to include a new flag to generate the SQL code to check filesnames.

Hope that helps
Logged
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Searching Filenames
« Reply #2 on: April 18, 2008, 03:38:24 pm »

That was to easy.

Here's what I did

In cpmfetch_dao.php find:
Code: [Select]
if (sizeof($textlist)) {
foreach ($textlist as $keyword) {
$sourceSql .= " p.keywords LIKE '%" . mysql_escape_string($keyword) . "%' OR ";
$sourceSql .= " p.title LIKE '%" . mysql_escape_string($keyword) . "%' OR ";
$sourceSql .= " p.caption LIKE '%" . mysql_escape_string($keyword) . "%' OR ";

Add after:
Code: [Select]
$sourceSql .= " p.filename Like '%" . mysql_escape_string($keyword) . "%' OR ";
Logged
Please give me some negative Karma. :)
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 20 queries.