[imc-sf-coders] CVS update of sf-active/sf-active/shared/classes
(newswire_class.inc)
Bart M
pseudopunk at codecoop.org
Fri Dec 30 12:04:27 PST 2005
Date: Friday, December 30, 2005 @ 21:04:27
Author: pseudopunk
Path: /cvsroot/sf-active/sf-active/sf-active/shared/classes
Modified: newswire_class.inc
fixing various search settings -- closes #380 as well
Index: sf-active/sf-active/shared/classes/newswire_class.inc
diff -u sf-active/sf-active/shared/classes/newswire_class.inc:1.60 sf-active/sf-active/shared/classes/newswire_class.inc:1.61
--- sf-active/sf-active/shared/classes/newswire_class.inc:1.60 Fri Dec 30 19:32:36 2005
+++ sf-active/sf-active/shared/classes/newswire_class.inc Fri Dec 30 21:04:27 2005
@@ -222,7 +222,7 @@
* @param int num_results
* @param bool include_summaries
*/
- function find_articles($keywords, $author, $conditions, $start_result = 0, $num_results = false, $sort_by = false, $include_summaries = true) {
+ function find_articles($keywords, $author, $conditions, $start_result = 0, $num_results = false, $sort_by = false, $include_summaries = false) {
$num_results = ($num_results) ? $num_results : $GLOBALS['default_search_size'];
$summary_text = $include_summaries ? 'summary, ' : '';
@@ -234,7 +234,7 @@
* We can also find the number of attachments
* by counting the number of rows, if there is at least one attachment
*/
- $sql = array_key_exists('category', $conditions) ? "SELECT w.id as id, heading, lang.language_code as language, IF(m.mime_type IS NULL, 0, count(*)) as num_attachments, w.author as author, UNIX_TIMESTAMP(w.modified) AS modified, w.created as created w.display as display, $summary_text m.mime_type AS mime_type FROM webcast w LEFT JOIN webcast_text b ON b.id = w.id LEFT JOIN catlink l ON l.id = w.id LEFT JOIN webcast_media m ON m.webcast_id = w.id LEFT JOIN language lang ON lang.id = w.language_id WHERE " :
+ $sql = array_key_exists('category', $conditions) ? "SELECT w.id as id, heading, lang.language_code as language, IF(m.mime_type IS NULL, 0, count(*)) as num_attachments, w.author as author, UNIX_TIMESTAMP(w.modified) AS modified, w.created as created, w.display as display, $summary_text m.mime_type AS mime_type FROM webcast w LEFT JOIN webcast_text b ON b.id = w.id LEFT JOIN catlink l ON l.id = w.id LEFT JOIN webcast_media m ON m.webcast_id = w.id LEFT JOIN language lang ON lang.id = w.language_id WHERE " :
"SELECT w.id as id, lang.language_code as language, heading,IF(m.mime_type IS NULL, 0, count(*)) as num_attachments, w.author as author, UNIX_TIMESTAMP(w.modified) AS modified,w.created as created, w.display as display, $summary_text m.mime_type AS mime_type FROM webcast w LEFT JOIN webcast_text b ON b.id = w.id LEFT JOIN webcast_media m ON m.webcast_id = w.id LEFT JOIN language lang ON lang.id = w.language_id WHERE ";
// hack to speed up searches
@@ -242,8 +242,13 @@
if(!$this->max_id) $this->get_max_id();
$limiting_id = $this->max_id - 5000;
$sql .= "w.id > $limiting_id";
- } else
- $sql .= ' 1 ';
+ } else {
+ $sql .= 'w.id > 1 ';
+ }
+
+ if(array_key_exists('category', $conditions)) {
+ $sql .= " AND l.catid = " .$conditions['category']. " ";
+ }
$sql .= array_key_exists('year', $conditions) ?
" AND YEAR(created) = ". $conditions['year'] : '';
@@ -252,7 +257,7 @@
$sql .= array_key_exists('day', $conditions) ?
" AND DAY(created) = " . $conditions['day'] : '';
$sql .= array_key_exists('mime_type', $conditions) ?
- " AND mime_type LIKE '%{$conditions['mime_type']}%'": '';
+ " AND m.mime_type LIKE '%{$conditions['mime_type']}%'": '';
$sql .= array_key_exists('language', $conditions) ?
" AND language_id = " . $conditions['language'] : '';
if (array_key_exists('status', $conditions)) {
More information about the imc-sf-coders
mailing list