From 6e3561114a5832e432793b11bc7b71926dc33c85 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 25 Mar 2007 19:44:22 +0000 Subject: added ability to search year range --- lib/class/catalog.class.php | 3 +-- lib/search.php | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index f981bf2b..50db6749 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -613,8 +613,6 @@ class Catalog { /* Set it as an empty array */ $files = array(); - $path = $path; - /* Open up the directory */ $handle = @opendir($path); @@ -656,6 +654,7 @@ class Catalog { $pattern = "/\.[" . conf('catalog_file_pattern') . "]$/i"; + // REMOVE SECOND PREG_MATCH if ( preg_match($pattern ,$file) && ($file_info > 0) && (!preg_match("/\.AppleDouble/", $file)) ) { $files[] = $full_file; } //is mp3 of at least some size diff --git a/lib/search.php b/lib/search.php index 99897ec7..2e91a3ef 100644 --- a/lib/search.php +++ b/lib/search.php @@ -160,7 +160,12 @@ function search_song($data,$operator,$method,$limit) { $table_sql .= "genre,"; break; case 'year': - $where_sql .= " song.year $value_string $operator"; + if (empty($data["year2"]) && is_numeric($data["year"])) { + $where_sql .= " song.year $value_string $operator"; + } + elseif (!empty($data["year"]) && is_numeric($data["year"]) && !empty($data["year2"]) && is_numeric($data["year2"])) { + $where_sql .= " (song.year BETWEEN ".$data["year"]." AND ".$data["year2"].") $operator"; + } break; case 'filename': $where_sql .= " song.file $value_string $operator"; -- cgit