store photo tags with linked item

This commit is contained in:
nobody 2021-06-19 20:16:08 -07:00
parent b127575110
commit 03e635677c

View file

@ -371,7 +371,7 @@ function photo_upload($channel, $observer, $args) {
$large_photos = 1; $large_photos = 1;
linkify_tags($args['body'], $channel_id); $found_tags = linkify_tags($args['body'], $channel_id);
$alt = ' alt="' . $title . '"' ; $alt = ' alt="' . $title . '"' ;
@ -434,6 +434,23 @@ function photo_upload($channel, $observer, $args) {
'id' => z_root() . '/album/' . $channel['channel_address'] . ((isset($args['folder'])) ? '/' . $args['folder'] : EMPTY_STR) 'id' => z_root() . '/album/' . $channel['channel_address'] . ((isset($args['folder'])) ? '/' . $args['folder'] : EMPTY_STR)
]; ];
$post_tags = [];
if($found_tags) {
foreach($found_tags as $result) {
$success = $result['success'];
if($success['replaced']) {
$post_tags[] = array(
'uid' => $channel['channel_id'],
'ttype' => $success['termtype'],
'otype' => TERM_OBJ_POST,
'term' => $success['term'],
'url' => $success['url']
);
}
}
}
// Create item container // Create item container
if($args['item']) { if($args['item']) {
foreach($args['item'] as $i) { foreach($args['item'] as $i) {
@ -451,7 +468,9 @@ function photo_upload($channel, $observer, $args) {
$item['tgt_type'] = 'orderedCollection'; $item['tgt_type'] = 'orderedCollection';
$item['target'] = json_encode($target); $item['target'] = json_encode($target);
if ($post_tags) {
$arr['term'] = $post_tags;
}
$force = true; $force = true;
} }
$r = q("select id, edited from item where mid = '%s' and uid = %d limit 1", $r = q("select id, edited from item where mid = '%s' and uid = %d limit 1",
@ -510,6 +529,10 @@ function photo_upload($channel, $observer, $args) {
'body' => $summary 'body' => $summary
]; ];
if ($post_tags) {
$arr['term'] = $post_tags;
}
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']); $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . urlencode($arr['mid']);
if($lat && $lon) if($lat && $lon)