aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-12 11:26:11 -0800
committerfriendica <info@friendica.com>2015-01-12 11:26:11 -0800
commit9fc9af87e375e65a2bdee4d3c4009df9ed52b4aa (patch)
treec852e9ee19eb6fabd537cde5f407f1e237502b6a /mod
parent962c6207ae0091dd447e2e6d9db3c997b6613cf4 (diff)
parenta0134de28abdaf820d14a161a05578c16911cdbd (diff)
downloadvolse-hubzilla-9fc9af87e375e65a2bdee4d3c4009df9ed52b4aa.tar.gz
volse-hubzilla-9fc9af87e375e65a2bdee4d3c4009df9ed52b4aa.tar.bz2
volse-hubzilla-9fc9af87e375e65a2bdee4d3c4009df9ed52b4aa.zip
Merge https://github.com/friendica/red into pending_merge
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php82
-rw-r--r--mod/photos.php67
2 files changed, 34 insertions, 115 deletions
diff --git a/mod/item.php b/mod/item.php
index 894e23a0f..7a14a8ae9 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -575,78 +575,26 @@ function item_post(&$a) {
$body = scale_external_images($body,false);
- /**
- * Look for any tags and linkify them
- */
-
- $str_tags = '';
- $inform = '';
- $post_tags = array();
-
- $tags = get_tags($body);
-
- $tagged = array();
+ // Look for tags and linkify them
+ $results = linkify_tags($a, $body, $uid, $profile_uid);
- if(count($tags)) {
- $first_access_tag = true;
- foreach($tags as $tag) {
-
- // If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
- // Robert Johnson should be first in the $tags array
-
- $fullnametagged = false;
- for($x = 0; $x < count($tagged); $x ++) {
- if(stristr($tagged[$x],$tag . ' ')) {
- $fullnametagged = true;
- break;
- }
- }
- if($fullnametagged)
- continue;
+ // Set permissions based on tag replacements
+ set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item);
- $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
- logger('handle_tag: ' . print_r($success,true), LOGGER_DATA);
- if(($access_tag) && (! $parent_item)) {
- logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DATA);
- if ($first_access_tag && (! get_pconfig($profile_uid,'system','no_private_mention_acl_override'))) {
-
- // This is a tough call, hence configurable. The issue is that one can type in a @!privacy mention
- // and also have a default ACL (perhaps from viewing a collection) and could be suprised that the
- // privacy mention wasn't the only recipient. So the default is to wipe out the existing ACL if a
- // private mention is found. This can be over-ridden if you wish private mentions to be in
- // addition to the current ACL settings.
-
- $str_contact_allow = '';
- $str_group_allow = '';
- $first_access_tag = false;
- }
- if(strpos($access_tag,'cid:') === 0) {
- $str_contact_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- elseif(strpos($access_tag,'gid:') === 0) {
- $str_group_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- }
-
- if($success['replaced']) {
- $tagged[] = $tag;
- $post_tags[] = array(
- 'uid' => $profile_uid,
- 'type' => $success['termtype'],
- 'otype' => TERM_OBJ_POST,
- 'term' => $success['term'],
- 'url' => $success['url']
- );
- }
+ $post_tags = array();
+ foreach($results as $result) {
+ $success = $result['success'];
+ if($success['replaced']) {
+ $post_tags[] = array(
+ 'uid' => $profile_uid,
+ 'type' => $success['termtype'],
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $success['term'],
+ 'url' => $success['url']
+ );
}
}
-
-// logger('post_tags: ' . print_r($post_tags,true));
-
-
$attachments = '';
$match = false;
diff --git a/mod/photos.php b/mod/photos.php
index 8a54eca4f..df9880c8d 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -351,56 +351,27 @@ function photos_post(&$a) {
if($x !== '@' && $x !== '#')
$rawtags = '@' . $rawtags;
- $taginfo = array();
- $tags = get_tags($rawtags);
-
- if(count($tags)) {
- foreach($tags as $tag) {
-
- // If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
- // Robert Johnson should be first in the $tags array
-
- $fullnametagged = false;
- for($x = 0; $x < count($tagged); $x ++) {
- if(stristr($tagged[$x],$tag . ' ')) {
- $fullnametagged = true;
- break;
- }
- }
- if($fullnametagged)
- continue;
-
- require_once('include/text.php');
- $body = $access_tag = '';
-
- $success = handle_tag($a, $body, $access_tag, $str_tags, (local_user()) ? local_user() : $a->profile['profile_uid'] , $tag);
- logger('handle_tag: ' . print_r($success,tue), LOGGER_DEBUG);
- if($access_tag) {
- logger('access_tag: ' . $tag . ' ' . print_r($access_tag,true), LOGGER_DEBUG);
- if(strpos($access_tag,'cid:') === 0) {
- $str_contact_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- elseif(strpos($access_tag,'gid:') === 0) {
- $str_group_allow .= '<' . substr($access_tag,4) . '>';
- $access_tag = '';
- }
- }
-
- if($success['replaced']) {
- $tagged[] = $tag;
-
- $post_tags[] = array(
- 'uid' => $a->profile['profile_uid'],
- 'type' => $success['termtype'],
- 'otype' => TERM_OBJ_POST,
- 'term' => $success['term'],
- 'url' => $success['url']
- );
- }
+ require_once('include/text.php');
+ $profile_uid = $a->profile['profile_uid'];
+
+ $results = linkify_tags($a, $rawtags, local_user(), $profile_uid);
+
+ $success = $results['success'];
+ $post_tags = array();
+
+ foreach($results as $result) {
+ $success = $result['success'];
+ if($success['replaced']) {
+ $post_tags[] = array(
+ 'uid' => $profile_uid,
+ 'type' => $success['termtype'],
+ 'otype' => TERM_OBJ_POST,
+ 'term' => $success['term'],
+ 'url' => $success['url']
+ );
}
}
-
+
$r = q("select * from item where id = %d and uid = %d limit 1",
intval($item_id),
intval($page_owner_uid)