diff options
Diffstat (limited to 'mod/item.php')
-rw-r--r-- | mod/item.php | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/mod/item.php b/mod/item.php index b09ee06f3..c504c77e1 100644 --- a/mod/item.php +++ b/mod/item.php @@ -140,7 +140,9 @@ function item_post(&$a) { } } - if($parent) logger('mod_item: item_post parent=' . $parent); + if($parent) { + logger('mod_item: item_post parent=' . $parent); + } $observer = $a->get_observer(); @@ -320,6 +322,18 @@ function item_post(&$a) { $body = fix_mce_lf($body); } + // If we're sending a private top-level message with a single @-taggable channel as a recipient, @-tag it. + + if((! $parent) && (substr_count($str_contact_allow,'<') == 1) && ($str_group_allow == '') && ($str_contact_deny == '') && ($str_group_deny == '')) { + $x = q("select abook_id, abook_their_perms from abook where abook_xchan = '%s' and abook_channel = %d limit 1", + dbesc(str_replace(array('<','>'),array('',''),$str_contact_allow)), + intval($profile_uid) + ); + if($x && ($x[0]['abook_their_perms'] & PERMS_W_TAGWALL)) + $body .= "\n\n@group+" . $x[0]['abook_id'] . "\n"; + } + + /** * fix naked links by passing through a callback to see if this is a red site @@ -532,6 +546,7 @@ function item_post(&$a) { $datarray['item_restrict'] = $item_restrict; $datarray['item_flags'] = $item_flags; + $datarray['comment_policy'] = map_scope($channel['channel_w_comment']); // preview mode - prepare the body for display and send it via json @@ -799,15 +814,23 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) { if(strpos($tag,'[zrl=')) //...do nothing return $replaced; - //base tag has the tags name only - $basetag = str_replace('_',' ',substr($tag,1)); - //create text for link - $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag); - $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]'; - //replace tag by the link - $body = str_replace($tag, $newtag, $body); - $replaced = true; - + if($tag == '#getzot') { + $basetag = 'getzot'; + $url = 'http://getzot.com'; + $newtag = '#[zrl=' . $url . ']' . $basetag . '[/zrl]'; + $body = str_replace($tag,$newtag,$body); + $replace = true; + } + else { + //base tag has the tags name only + $basetag = str_replace('_',' ',substr($tag,1)); + //create text for link + $url = $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag); + $newtag = '#[zrl=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/zrl]'; + //replace tag by the link + $body = str_replace($tag, $newtag, $body); + $replaced = true; + } //is the link already in str_tags? if(! stristr($str_tags,$newtag)) { //append or set str_tags |