diff options
author | zotlabs <mike@macgirvin.com> | 2018-04-17 21:48:43 -0700 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-04-17 21:48:43 -0700 |
commit | 6903dbcc0dd01e86f853fdd0cba680ece05aa937 (patch) | |
tree | 211caad45fe5b231a090c661ae620d631477d83b /include/taxonomy.php | |
parent | a806c68713baebcc8ca3353e01031593b2f571a4 (diff) | |
download | volse-hubzilla-6903dbcc0dd01e86f853fdd0cba680ece05aa937.tar.gz volse-hubzilla-6903dbcc0dd01e86f853fdd0cba680ece05aa937.tar.bz2 volse-hubzilla-6903dbcc0dd01e86f853fdd0cba680ece05aa937.zip |
re-use directory safemode setting for public stream tag filtering since a handful of well-known tags skews the results wildly. Added 'bot' to the list just because it's noisy. A site can customise or nullify this feature if they desire.
Diffstat (limited to 'include/taxonomy.php')
-rw-r--r-- | include/taxonomy.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/include/taxonomy.php b/include/taxonomy.php index 97cbe03d7..59998be83 100644 --- a/include/taxonomy.php +++ b/include/taxonomy.php @@ -312,10 +312,10 @@ function article_tagadelic($uid, $count = 0, $authors = '', $owner = '', $flags -function pubtagblock($net,$site,$limit,$recent = 0,$type = TERM_HASHTAG) { +function pubtagblock($net,$site,$limit,$recent = 0,$safemode = 1, $type = TERM_HASHTAG) { $o = ''; - $r = pub_tagadelic($net,$site,$limit,$since,$type); + $r = pub_tagadelic($net,$site,$limit,$since,$safemode,$type); $link = z_root() . '/pubstream'; if($r) { @@ -329,13 +329,12 @@ function pubtagblock($net,$site,$limit,$recent = 0,$type = TERM_HASHTAG) { return $o; } -function pub_tagadelic($net,$site,$limit,$recent,$type) { +function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) { $item_normal = item_normal(); $count = intval($limit); - if($site) { $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; } @@ -348,6 +347,16 @@ function pub_tagadelic($net,$site,$limit,$recent,$type) { if($recent) $sql_extra .= " and item.created > '" . datetime_convert('UTC','UTC', 'now - ' . intval($recent) . ' days ') . "' "; + + if($safemode) { + $unsafetags = get_config('system','unsafepubtags', [ 'boobs', 'bot', 'girl','girls', 'nsfw', 'sexy', 'nude' ]); + if($unsafetags) { + stringify_array_elms($unsafetags,true); + $sql_extra .= " and not term.term in ( " . implode(",",$unsafetags) . ") "; + } + } + + // Fetch tags $r = q("select term, count(term) as total from term left join item on term.oid = item.id where term.ttype = %d |