Searching Filenames Searching Filenames
 

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

Searching Filenames

Started by radmofo, April 18, 2008, 05:38:21 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

radmofo

Ok, so I know we can do things like this 


$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.

$USER['search']['params']['title'] = $USER['search']['params']['caption'] = $USER['search']['params']['keywords'] = $USER['search']['params']['filename'] = 1;

Someone please point in the proper direction.
Please give me some negative Karma. :)

vuud


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
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

That was to easy.

Here's what I did

In cpmfetch_dao.php find:
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:
$sourceSql .= " p.filename Like '%" . mysql_escape_string($keyword) . "%' OR ";
Please give me some negative Karma. :)