diff options
author | Wave <wave72@users.noreply.github.com> | 2015-11-25 09:39:44 +0100 |
---|---|---|
committer | Wave <wave72@users.noreply.github.com> | 2015-11-25 09:39:44 +0100 |
commit | 2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3 (patch) | |
tree | 783f90531c93f498609fb1dbd0e199ca65bb2cc0 /include/taxonomy.php | |
parent | e785b723aad51d4f7202dbbb24a0e2245428cb5b (diff) | |
parent | 0559db9cf81267c34ca014fef1aebe1cf31de2ab (diff) | |
download | volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.tar.gz volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.tar.bz2 volse-hubzilla-2de65ab39fc704fd8b7abcf9003ee98e3ffb1cc3.zip |
Merge pull request #3 from redmatrix/master
Update branch
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r-- | include/taxonomy.php | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php index e68b9659f..b396d53f1 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -26,12 +26,21 @@ function file_tag_file_query($table,$s,$type = 'file') { ); } -function term_query($table,$s,$type = TERM_UNKNOWN) { +function term_query($table,$s,$type = TERM_UNKNOWN, $type2 = '') { - 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($type), - protect_sprintf(dbesc($s)) - ); + if($type2) { + return sprintf(" AND " . (($table) ? dbesc($table) . '.' : '') . "id in (select term.oid from term where term.type in (%d, %d) and term.term = '%s' and term.uid = " . (($table) ? dbesc($table) . '.' : '') . "uid ) ", + intval($type), + intval($type2), + protect_sprintf(dbesc($s)) + ); + } + else { + 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($type), + protect_sprintf(dbesc($s)) + ); + } } @@ -84,7 +93,7 @@ function get_terms_oftype($arr,$type) { function format_term_for_display($term) { $s = ''; - if($term['type'] == TERM_HASHTAG) + if(($term['type'] == TERM_HASHTAG) || ($term['type'] == TERM_COMMUNITYTAG)) $s .= '#'; elseif($term['type'] == TERM_MENTION) $s .= '@'; |