diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-03-25 19:44:22 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-03-25 19:44:22 +0000 |
commit | 6e3561114a5832e432793b11bc7b71926dc33c85 (patch) | |
tree | d2b5e051bc0c19ba11584bbd249e1a0355503e3b /lib | |
parent | 1eca8a9c7b499b5f4ec58dbd19170d4a642ad674 (diff) | |
download | ampache-6e3561114a5832e432793b11bc7b71926dc33c85.tar.gz ampache-6e3561114a5832e432793b11bc7b71926dc33c85.tar.bz2 ampache-6e3561114a5832e432793b11bc7b71926dc33c85.zip |
added ability to search year range
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/catalog.class.php | 3 | ||||
-rw-r--r-- | lib/search.php | 7 |
2 files changed, 7 insertions, 3 deletions
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"; |