Searching Filenames Searching Filenames
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

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. :)