aboutsummaryrefslogtreecommitdiffstats
path: root/include/taxonomy.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-11-20 00:15:48 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-11-20 00:15:48 -0800
commit301072a86cacd2620a08cf07f2cef55dffac3c2f (patch)
treee6f64f9e95be882bdb7afeb4939dc485d38d3527 /include/taxonomy.php
parenta44795e6c32d90d54e5a4321cad4ffe0f3409a09 (diff)
downloadvolse-hubzilla-301072a86cacd2620a08cf07f2cef55dffac3c2f.tar.gz
volse-hubzilla-301072a86cacd2620a08cf07f2cef55dffac3c2f.tar.bz2
volse-hubzilla-301072a86cacd2620a08cf07f2cef55dffac3c2f.zip
issue #85, community tags and file tags lost during edits. This required splitting off communitytags as a separate tag type and is not backward compatible. Community tags on older posts or those federated from redmatrix clones will not be preserved during edits.
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r--include/taxonomy.php21
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 .= '@';