community tagging - it's not much closer to working but a really good developer can now possibly hack their way through it instead of "there's only one person on the planet that can ever make this work".
This commit is contained in:
parent
21491100f8
commit
9f15600c7c
@ -456,6 +456,7 @@ function settings_post(&$a) {
|
|||||||
set_pconfig(local_user(),'system','post_newfriend', $post_newfriend);
|
set_pconfig(local_user(),'system','post_newfriend', $post_newfriend);
|
||||||
set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
|
set_pconfig(local_user(),'system','post_joingroup', $post_joingroup);
|
||||||
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
|
set_pconfig(local_user(),'system','post_profilechange', $post_profilechange);
|
||||||
|
set_pconfig(local_user(),'system','blocktags',$blocktags);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if($page_flags == PAGE_PRVGROUP) {
|
if($page_flags == PAGE_PRVGROUP) {
|
||||||
@ -907,7 +908,6 @@ function settings_content(&$a) {
|
|||||||
$expire = $channel['channel_expire_days'];
|
$expire = $channel['channel_expire_days'];
|
||||||
|
|
||||||
$blockwall = $a->user['blockwall'];
|
$blockwall = $a->user['blockwall'];
|
||||||
$blocktags = $a->user['blocktags'];
|
|
||||||
$unkmail = $a->user['unkmail'];
|
$unkmail = $a->user['unkmail'];
|
||||||
$cntunkmail = $a->user['cntunkmail'];
|
$cntunkmail = $a->user['cntunkmail'];
|
||||||
|
|
||||||
@ -939,6 +939,8 @@ function settings_content(&$a) {
|
|||||||
$post_profilechange = get_pconfig(local_user(), 'system','post_profilechange');
|
$post_profilechange = get_pconfig(local_user(), 'system','post_profilechange');
|
||||||
$post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0
|
$post_profilechange = (($post_profilechange===false)? '0': $post_profilechange); // default if not set: 0
|
||||||
|
|
||||||
|
$blocktags = get_pconfig(local_user(),'system','blocktags');
|
||||||
|
$blocktags = (($blocktags===false) ? '0' : $blocktags);
|
||||||
|
|
||||||
$timezone = date_default_timezone_get();
|
$timezone = date_default_timezone_get();
|
||||||
|
|
||||||
|
119
mod/tagger.php
119
mod/tagger.php
@ -23,11 +23,12 @@ function tagger_content(&$a) {
|
|||||||
logger('tagger: tag ' . $term . ' item ' . $item_id);
|
logger('tagger: tag ' . $term . ' item ' . $item_id);
|
||||||
|
|
||||||
|
|
||||||
$r = q("SELECT * FROM `item` WHERE `id` = '%s' LIMIT 1",
|
$r = q("SELECT * FROM `item` left join xchan on xchan_hash = author_hash WHERE `id` = '%s' and uid = %d LIMIT 1",
|
||||||
dbesc($item_id)
|
dbesc($item_id),
|
||||||
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $item_id || (! count($r))) {
|
if((! $item_id) || (! $r)) {
|
||||||
logger('tagger: no item ' . $item_id);
|
logger('tagger: no item ' . $item_id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -36,85 +37,79 @@ function tagger_content(&$a) {
|
|||||||
|
|
||||||
$owner_uid = $item['uid'];
|
$owner_uid = $item['uid'];
|
||||||
|
|
||||||
$r = q("select `nickname`,`blocktags` from user where uid = %d limit 1",
|
switch($item['resource_type']) {
|
||||||
intval($owner_uid)
|
case 'photo':
|
||||||
);
|
$targettype = ACTIVITY_OBJ_PHOTO;
|
||||||
if(count($r)) {
|
$post_type = t('photo');
|
||||||
$owner_nick = $r[0]['nickname'];
|
break;
|
||||||
$blocktags = $r[0]['blocktags'];
|
case 'event':
|
||||||
|
$targgettype = ACTIVITY_OBJ_EVENT;
|
||||||
|
$post_type = t('event');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$targettype = ACTIVITY_OBJ_NOTE;
|
||||||
|
$post_type = t('status');
|
||||||
|
if($item['mid'] != $item['parent_mid'])
|
||||||
|
$post_type = t('comment');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(local_user() != $owner_uid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
$r = q("select * from contact where self = 1 and uid = %d limit 1",
|
$links = array(array('rel' => 'alternate','type' => 'text/html',
|
||||||
intval(local_user())
|
'href' => z_root() . '/display/' . $item['mid']));
|
||||||
);
|
|
||||||
if(count($r))
|
$target = json_encode(array(
|
||||||
$contact = $r[0];
|
'type' => $targettype,
|
||||||
else {
|
'id' => $item['mid'],
|
||||||
logger('tagger: no contact_id');
|
'link' => $links,
|
||||||
return;
|
'title' => $item['title'],
|
||||||
}
|
'content' => $item['body'],
|
||||||
|
'created' => $item['created'],
|
||||||
|
'edited' => $item['edited'],
|
||||||
|
'author' => array(
|
||||||
|
'name' => $item['xchan_name'],
|
||||||
|
'address' => $item['xchan_addr'],
|
||||||
|
'guid' => $item['xchan_guid'],
|
||||||
|
'guid_sig' => $item['xchan_guid_sig'],
|
||||||
|
'link' => array(
|
||||||
|
array('rel' => 'alternate', 'type' => 'text/html', 'href' => $item['xchan_url']),
|
||||||
|
array('rel' => 'photo', 'type' => $item['xchan_photo_mimetype'], 'href' => $item['xchan_photo_m'])),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$mid = item_message_id();
|
$mid = item_message_id();
|
||||||
$xterm = xmlify($term);
|
$xterm = xmlify($term);
|
||||||
$post_type = (($item['resource_id']) ? t('photo') : t('status'));
|
|
||||||
$targettype = (($item['resource_id']) ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE );
|
|
||||||
|
|
||||||
$link = xmlify('<link rel="alternate" type="text/html" href="'
|
$link = xmlify('<link rel="alternate" type="text/html" href="'
|
||||||
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
|
. $a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id'] . '" />' . "\n") ;
|
||||||
|
|
||||||
$body = xmlify($item['body']);
|
|
||||||
|
|
||||||
$target = <<< EOT
|
|
||||||
<target>
|
|
||||||
<type>$targettype</type>
|
|
||||||
<local>1</local>
|
|
||||||
<id>{$item['mid']}</id>
|
|
||||||
<link>$link</link>
|
|
||||||
<title></title>
|
|
||||||
<content>$body</content>
|
|
||||||
</target>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
$tagid = $a->get_baseurl() . '/search?tag=' . $term;
|
$tagid = $a->get_baseurl() . '/search?tag=' . $term;
|
||||||
$objtype = ACTIVITY_OBJ_TAGTERM;
|
$objtype = ACTIVITY_OBJ_TAGTERM;
|
||||||
|
|
||||||
$obj = <<< EOT
|
$obj = json_encode(array(
|
||||||
<object>
|
'type' => $objtype,
|
||||||
<type>$objtype</type>
|
'id' => $tagid,
|
||||||
<local>1</local>
|
'link' => array(array('rel' => 'alternate','type' => 'text/html', 'href' => $tagid)),
|
||||||
<id>$tagid</id>
|
'title' => $term,
|
||||||
<link>$tagid</link>
|
'content' => $term
|
||||||
<title>$xterm</title>
|
));
|
||||||
<content>$xterm</content>
|
|
||||||
</object>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
|
$bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s');
|
||||||
|
|
||||||
if(! isset($bodyverb))
|
|
||||||
return;
|
|
||||||
|
|
||||||
$termlink = html_entity_decode('⌗') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]';
|
$termlink = html_entity_decode('⌗') . '[zrl=' . $a->get_baseurl() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]';
|
||||||
|
|
||||||
|
$channel = $a->get_channel();
|
||||||
|
|
||||||
|
|
||||||
$arr = array();
|
$arr = array();
|
||||||
|
|
||||||
$arr['mid'] = $mid;
|
|
||||||
$arr['uid'] = $owner_uid;
|
$arr['owner_hash'] = $item['owner_hash'];
|
||||||
$arr['contact-id'] = $contact['id'];
|
$arr['author_hash'] = $channel['channel_hash'];
|
||||||
$arr['type'] = 'activity';
|
|
||||||
$arr['wall'] = $item['wall'];
|
// FIXME - everything past this point is still unported
|
||||||
$arr['gravity'] = GRAVITY_COMMENT;
|
|
||||||
$arr['parent'] = $item['id'];
|
|
||||||
$arr['parent_mid'] = $item['mid'];
|
|
||||||
$arr['owner-name'] = $item['author-name'];
|
|
||||||
$arr['owner-link'] = $item['author-link'];
|
|
||||||
$arr['owner-avatar'] = $item['author-avatar'];
|
|
||||||
$arr['author-name'] = $contact['name'];
|
|
||||||
$arr['author-link'] = $contact['url'];
|
|
||||||
$arr['author-avatar'] = $contact['thumb'];
|
|
||||||
|
|
||||||
$ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]';
|
$ulink = '[zrl=' . $contact['url'] . ']' . $contact['name'] . '[/zrl]';
|
||||||
$alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]';
|
$alink = '[zrl=' . $item['author-link'] . ']' . $item['author-name'] . '[/zrl]';
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-06-03.333
|
2013-06-04.334
|
||||||
|
Reference in New Issue
Block a user