equal
deleted
inserted
replaced
26 '); |
26 '); |
27 |
27 |
28 function gal_searcher($q, $offset) |
28 function gal_searcher($q, $offset) |
29 { |
29 { |
30 global $db, $session, $paths, $template, $plugins; // Common objects |
30 global $db, $session, $paths, $template, $plugins; // Common objects |
31 if ( defined('SNAPR_SEARCH_USING_NEW_API') ) |
31 if ( defined('SNAPR_SEARCH_USING_NEW_API') || version_compare(enano_version(true), '1.0.2', '>=') ) |
32 return false; |
32 return false; |
33 |
33 |
34 $fulltext_col = 'MATCH(img_title, img_desc) AGAINST (\'' . $db->escape($q) . '\' IN BOOLEAN MODE)'; |
34 $fulltext_col = 'MATCH(img_title, img_desc) AGAINST (\'' . $db->escape($q) . '\' IN BOOLEAN MODE)'; |
35 $sql = "SELECT img_id, img_title, img_desc, is_folder, $fulltext_col AS score, CHAR_LENGTH(img_desc) AS length FROM ".table_prefix."gallery |
35 $sql = "SELECT img_id, img_title, img_desc, is_folder, $fulltext_col AS score, CHAR_LENGTH(img_desc) AS length FROM ".table_prefix."gallery |
36 WHERE $fulltext_col > 0 |
36 WHERE $fulltext_col > 0 |
126 |
126 |
127 if ( $row = $db->fetchrow() ) |
127 if ( $row = $db->fetchrow() ) |
128 { |
128 { |
129 do |
129 do |
130 { |
130 { |
131 $idstring = 'ns=Image;pid=' . $row['img_id']; |
131 $idstring = 'ns=Gallery;pid=' . $row['img_id']; |
132 foreach ( $word_list as $term ) |
132 foreach ( $word_list as $term ) |
133 { |
133 { |
134 if ( $case_sensitive ) |
134 if ( $case_sensitive ) |
135 { |
135 { |
136 if ( strstr($row['img_title'], $term) || strstr($row['img_desc'], $term) ) |
136 if ( strstr($row['img_title'], $term) || strstr($row['img_desc'], $term) ) |
171 'page_name' => highlight_search_result(htmlspecialchars($row['img_title']), $word_list), |
171 'page_name' => highlight_search_result(htmlspecialchars($row['img_title']), $word_list), |
172 'page_text' => $preview_and_text, |
172 'page_text' => $preview_and_text, |
173 'score' => $scores[$idstring], |
173 'score' => $scores[$idstring], |
174 'page_note' => '[Gallery image]', |
174 'page_note' => '[Gallery image]', |
175 'page_id' => strval($row['img_id']), |
175 'page_id' => strval($row['img_id']), |
176 'namespace' => 'Image', |
176 'namespace' => 'Gallery', |
177 'page_length' => strlen($row['img_desc']), |
177 'page_length' => strlen($row['img_desc']), |
178 ); |
178 ); |
179 } |
179 } |
180 } |
180 } |
181 while ( $row = $db->fetchrow() ); |
181 while ( $row = $db->fetchrow() ); |