Merge https://github.com/friendica/red into pending_merge
This commit is contained in:
commit
9fc9af87e3
@ -4715,3 +4715,34 @@ function item_remove_cid($xchan_hash,$mid,$uid) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set item permissions based on results obtained from linkify_tags()
|
||||||
|
function set_linkified_perms($linkified, &$str_contact_allow, &$str_group_allow, $profile_uid, $parent_item = false) {
|
||||||
|
$first_access_tag = true;
|
||||||
|
foreach($linkified as $x) {
|
||||||
|
$access_tag = $x['access_tag'];
|
||||||
|
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 = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -2350,3 +2350,33 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag) {
|
|||||||
|
|
||||||
return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]);
|
return array('replaced' => $replaced, 'termtype' => $termtype, 'term' => $newname, 'url' => $url, 'contact' => $r[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function linkify_tags($a, &$body, $uid, $profile_uid) {
|
||||||
|
$str_tags = '';
|
||||||
|
$tagged = array();
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$tags = get_tags($body);
|
||||||
|
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;
|
||||||
|
|
||||||
|
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
|
||||||
|
$results[] = array('success' => $success, 'access_tag' => $access_tag);
|
||||||
|
if($success['replaced']) $tagged[] = $tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -225,6 +225,8 @@
|
|||||||
element = this.element;
|
element = this.element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBoxHeights($(element)); // Workaroud for problems with collapse
|
||||||
|
|
||||||
var $this = this,
|
var $this = this,
|
||||||
$element = $(element),
|
$element = $(element),
|
||||||
newHeight = '',
|
newHeight = '',
|
||||||
|
82
mod/item.php
82
mod/item.php
@ -575,78 +575,26 @@ function item_post(&$a) {
|
|||||||
$body = scale_external_images($body,false);
|
$body = scale_external_images($body,false);
|
||||||
|
|
||||||
|
|
||||||
/**
|
// Look for tags and linkify them
|
||||||
* Look for any tags and linkify them
|
$results = linkify_tags($a, $body, $uid, $profile_uid);
|
||||||
*/
|
|
||||||
|
// Set permissions based on tag replacements
|
||||||
|
set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item);
|
||||||
|
|
||||||
$str_tags = '';
|
|
||||||
$inform = '';
|
|
||||||
$post_tags = array();
|
$post_tags = array();
|
||||||
|
foreach($results as $result) {
|
||||||
$tags = get_tags($body);
|
$success = $result['success'];
|
||||||
|
if($success['replaced']) {
|
||||||
$tagged = array();
|
$post_tags[] = array(
|
||||||
|
'uid' => $profile_uid,
|
||||||
if(count($tags)) {
|
'type' => $success['termtype'],
|
||||||
$first_access_tag = true;
|
'otype' => TERM_OBJ_POST,
|
||||||
foreach($tags as $tag) {
|
'term' => $success['term'],
|
||||||
|
'url' => $success['url']
|
||||||
// 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;
|
|
||||||
|
|
||||||
$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']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// logger('post_tags: ' . print_r($post_tags,true));
|
|
||||||
|
|
||||||
|
|
||||||
$attachments = '';
|
$attachments = '';
|
||||||
$match = false;
|
$match = false;
|
||||||
|
|
||||||
|
@ -351,56 +351,27 @@ function photos_post(&$a) {
|
|||||||
if($x !== '@' && $x !== '#')
|
if($x !== '@' && $x !== '#')
|
||||||
$rawtags = '@' . $rawtags;
|
$rawtags = '@' . $rawtags;
|
||||||
|
|
||||||
$taginfo = array();
|
require_once('include/text.php');
|
||||||
$tags = get_tags($rawtags);
|
$profile_uid = $a->profile['profile_uid'];
|
||||||
|
|
||||||
if(count($tags)) {
|
$results = linkify_tags($a, $rawtags, local_user(), $profile_uid);
|
||||||
foreach($tags as $tag) {
|
|
||||||
|
|
||||||
// If we already tagged 'Robert Johnson', don't try and tag 'Robert'.
|
$success = $results['success'];
|
||||||
// Robert Johnson should be first in the $tags array
|
$post_tags = array();
|
||||||
|
|
||||||
$fullnametagged = false;
|
foreach($results as $result) {
|
||||||
for($x = 0; $x < count($tagged); $x ++) {
|
$success = $result['success'];
|
||||||
if(stristr($tagged[$x],$tag . ' ')) {
|
if($success['replaced']) {
|
||||||
$fullnametagged = true;
|
$post_tags[] = array(
|
||||||
break;
|
'uid' => $profile_uid,
|
||||||
}
|
'type' => $success['termtype'],
|
||||||
}
|
'otype' => TERM_OBJ_POST,
|
||||||
if($fullnametagged)
|
'term' => $success['term'],
|
||||||
continue;
|
'url' => $success['url']
|
||||||
|
);
|
||||||
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']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from item where id = %d and uid = %d limit 1",
|
$r = q("select * from item where id = %d and uid = %d limit 1",
|
||||||
intval($item_id),
|
intval($item_id),
|
||||||
intval($page_owner_uid)
|
intval($page_owner_uid)
|
||||||
|
@ -4,7 +4,7 @@ var ispublic = aStr['everybody'];
|
|||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
|
$("#photo-edit-newtag").contact_autocomplete(baseurl + '/acl', 'p', false, function(data) {
|
||||||
$("#photo-edit-newtag").val('@' + data.name.replace(' ','_')); // TODO: Get rid of underscore
|
$("#photo-edit-newtag").val('@' + data.name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user