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 | |
parent | 1eca8a9c7b499b5f4ec58dbd19170d4a642ad674 (diff) | |
download | ampache-6e3561114a5832e432793b11bc7b71926dc33c85.tar.gz ampache-6e3561114a5832e432793b11bc7b71926dc33c85.tar.bz2 ampache-6e3561114a5832e432793b11bc7b71926dc33c85.zip |
added ability to search year range
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 3 | ||||
-rw-r--r-- | lib/search.php | 7 | ||||
-rw-r--r-- | templates/show_search.inc | 6 |
4 files changed, 12 insertions, 5 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 7c8ed3c7..76d743d4 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Alpha1 + - Added ability to search year range (Thx Tom Kiehne) - Updated French and German translations - Added min song count to Browse Artist, refercing min object count preference 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"; diff --git a/templates/show_search.inc b/templates/show_search.inc index f0cf9a17..ee30e90e 100644 --- a/templates/show_search.inc +++ b/templates/show_search.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2006 Ampache.org + Copyright (c) 2001 - 2007 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -62,7 +62,9 @@ <tr class="<?php echo flip_class(); ?>"> <td><?php echo _('Year'); ?></td> <td> - <input type="text" id="s_year" name="s_year" value="<?php echo scrub_out($_REQUEST['s_year']); ?>" /> + <input type="text" id="s_year" name="s_year" size="5" value="<?php echo scrub_out($_REQUEST['s_year']); ?>" /> + - + <input type="text" id="s_year2" name="s_year2" size="5" value="<?php echo scrub_out($_REQUEST['s_year2']); ?>" /> </td> <td><?php echo _('Filename'); ?></td> <td> |