diff -r 94af07c8f2f3 -r 88c954d2846c plugins/gallery/search.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/gallery/search.php Wed Jul 25 18:15:14 2007 -0400 @@ -0,0 +1,59 @@ +attachHook('search_results', 'gal_searcher($q, $offset);'); + +$plugins->attachHook('compile_template', ' + // CSS for gallery browser + $template->add_header(\'\'); + $template->add_header(\'\'); + '); + +function gal_searcher($q, $offset) +{ + global $db, $session, $paths, $template, $plugins; // Common objects + + $fulltext_col = 'MATCH(img_title, img_desc) AGAINST (\'' . $db->escape($q) . '\' IN BOOLEAN MODE)'; + $sql = "SELECT img_id, img_title, img_desc, $fulltext_col AS score, CHAR_LENGTH(img_desc) AS length FROM ".table_prefix."gallery + WHERE $fulltext_col > 0 + AND is_folder=0 + ORDER BY score DESC;"; + if ( !$db->sql_unbuffered_query($sql) ) + { + echo $db->get_error(); + return false; + } + echo "
No image results.
'; + } +} + +?>