Permalink
Browse files

fixed bug when filenames contains more than one dot.

  • Loading branch information...
1 parent ffb6cbd commit 5bc2009d7f38ad297fe39935bd0e0910d18654f2 @staabm staabm committed Oct 4, 2011
@@ -253,7 +253,7 @@ static public function generateCategoryList($category_id)
*/
static public function generateExtensionList($extension)
{
- $query = 'SELECT filename FROM ' . rex_ooMedia :: _getTableName() . ' WHERE SUBSTRING(filename,LOCATE( ".",filename)+1) = "' . $extension . '"';
+ $query = 'SELECT filename FROM ' . rex_ooMedia :: _getTableName() . ' WHERE LOWER(RIGHT(filename, LOCATE(".", REVERSE(filename))-1)) = "' . strtolower($extension) . '"';
$sql = rex_sql::factory();
$sql->setQuery($query);
@@ -640,7 +640,7 @@
$types = array();
foreach(explode(',',$args['types']) as $type)
{
- $types[] = 'SUBSTRING(f.filename,LOCATE(".",f.filename)+1)="'. htmlspecialchars($type) .'"';
+ $types[] = 'LOWER(RIGHT(f.filename, LOCATE(".", REVERSE(f.filename))-1))="'. strtolower(htmlspecialchars($type)) .'"';
}
$where .= ' AND ('. implode(' OR ', $types) .')';
}

0 comments on commit 5bc2009

Please sign in to comment.