From 94fabe3a2942ca93b436694f180f8eb2a72df918 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 10 Jul 2012 06:28:02 -0700 Subject: upstream fixes and a lot of taxonomy stuff --- include/text.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'include/text.php') diff --git a/include/text.php b/include/text.php index f3bc94265..59ef5a88f 100644 --- a/include/text.php +++ b/include/text.php @@ -1328,10 +1328,14 @@ function file_tag_decode($s) { function file_tag_file_query($table,$s,$type = 'file') { if($type == 'file') - $str = preg_quote( '[' . str_replace('%','%%',file_tag_encode($s)) . ']' ); + $termtype = TERM_FILE; else - $str = preg_quote( '<' . str_replace('%','%%',file_tag_encode($s)) . '>' ); - return " AND " . (($table) ? dbesc($table) . '.' : '') . "file regexp '" . dbesc($str) . "' "; + $termtype = TERM_CATEGORY; + + return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type = %d and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ", + intval($termtype), + protect_sprintf(dbesc($s)) + ); } // ex. given music,video return