';
$allow_gid = EMPTY_STR;
$deny_cid = EMPTY_STR;
$deny_gid = EMPTY_STR;
}
$arr = [];
$arr['item_wall'] = 1;
$arr['owner_xchan'] = $channel['channel_hash'];
$arr['author_xchan'] = $channel['channel_hash'];
$arr['allow_cid'] = $allow_cid;
$arr['allow_gid'] = $allow_gid;
$arr['deny_cid'] = $deny_cid;
$arr['deny_gid'] = $deny_gid;
$arr['verb'] = 'Create';
$arr['item_private'] = 1;
$arr['obj_type'] = 'Note';
$arr['body'] = '[zrl=' . $channel['xchan_url'] . ']' . $channel['xchan_name'] . '[/zrl]' . ' ' . $verbs[$verb][2] . ' ' . '[zrl=' . $target['xchan_url'] . ']' . $target['xchan_name'] . '[/zrl]';
$arr['item_origin'] = 1;
$arr['item_wall'] = 1;
$obj = Activity::encode_item($arr,((get_config('system','activitypub', ACTIVITYPUB_ENABLED)) ? true : false));
$i = post_activity_item($arr);
if ($i['success']) {
$item_id = $i['item_id'];
$r = q("select * from item where id = %d",
intval($item_id)
);
if ($r) {
xchan_query($r);
$sync_item = fetch_post_tags($r);
Libsync::build_sync_packet($uid, [ 'item' => [ encode_item($sync_item[0],true) ] ] );
}
info(sprintf( t('You %1$s %2$s'), $verbs[$verb][2], $target['xchan_name']));
}
json_return_and_die([ 'success' => true ]);
}
function get() {
if(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
}
if(! Apps::system_app_installed(local_channel(), 'Poke')) {
$o = '' . t('Poke App (Not Installed)') . '
';
$o .= t('Poke or do something else to somebody');
return $o;
}
nav_set_selected('Poke');
$name = '';
$id = '';
$verbs = get_poke_verbs();
$shortlist = [];
$current = get_pconfig(local_channel(),'system','pokeverb','poke');
foreach($verbs as $k => $v) {
$shortlist[] = [ $k,$v[1], (($k === $current) ? true : false) ];
}
$title = t('Poke');
$desc = t('Poke, prod or do other things to somebody');
$o = replace_macros(get_markup_template('poke_content.tpl'),array(
'$title' => $title,
'$desc' => $desc,
'$clabel' => t('Recipient'),
'$choice' => t('Choose your default action'),
'$verbs' => $shortlist,
'$submit' => t('Submit'),
'$id' => $id
));
return $o;
}
}