diff options
author | Friendika <info@friendika.com> | 2011-10-24 04:17:46 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-24 04:17:46 -0700 |
commit | f48fd5aa1651cdc801473e9d24c1736304533e63 (patch) | |
tree | fafca7b9ace612d39e3ce4267fddaeb7164cd430 /mod/tagger.php | |
parent | 87aedacec77025c8d1474d26b364be6ba58e1192 (diff) | |
download | volse-hubzilla-f48fd5aa1651cdc801473e9d24c1736304533e63.tar.gz volse-hubzilla-f48fd5aa1651cdc801473e9d24c1736304533e63.tar.bz2 volse-hubzilla-f48fd5aa1651cdc801473e9d24c1736304533e63.zip |
more tagging
Diffstat (limited to 'mod/tagger.php')
-rw-r--r-- | mod/tagger.php | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/mod/tagger.php b/mod/tagger.php index c64184db7..dd4b8ffea 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -21,7 +21,7 @@ function tagger_content(&$a) { logger('tagger: tag ' . $term . ' item ' . $item_id); - $r = q("SELECT * FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s') LIMIT 1", + $r = q("SELECT * FROM `item` WHERE `id` = '%s' LIMIT 1", dbesc($item_id), dbesc($item_id) ); @@ -35,12 +35,13 @@ function tagger_content(&$a) { $owner_uid = $item['uid']; - $r = q("select `nickname` from user where uid = %d limit 1", + $r = q("select `nickname`,`blocktags` from user where uid = %d limit 1", intval($owner_uid) ); - if(count($r)) + if(count($r)) { $owner_nick = $r[0]['nickname']; - + $blocktags = $r[0]['blocktags']; + } // if(local_user() != $owner_uid) // return; @@ -156,13 +157,37 @@ EOT; ); } + if((! $blocktags) && (! stristr($item['tag'], ']' . $term . '[' ))) { + q("update item set tag = '%s' where id = %d limit 1", + dbesc($item['tag'] . (strlen($item['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?search=' . $term . ']'. $term . '[/url]'), + intval($item['id']) + ); + } + + // if the original post is on this site, update it. + $r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1", + dbesc($item['uri']) + ); + if(count($r)) { + $x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1", + intval($r[0]['uid']) + ); + if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) { + q("update item set tag = '%s' where id = %d limit 1", + dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?search=' . $term . ']'. $term . '[/url]'), + intval($r[0]['id']) + ); + } + + } + $arr['id'] = $post_id; call_hooks('post_local_end', $arr); - proc_run('php',"include/notifier.php","like","$post_id"); + proc_run('php',"include/notifier.php","tag","$post_id"); return; // NOTREACHED |