aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/thing.php93
1 files changed, 49 insertions, 44 deletions
diff --git a/mod/thing.php b/mod/thing.php
index 2620d660e..cbf83fdf8 100644
--- a/mod/thing.php
+++ b/mod/thing.php
@@ -19,6 +19,7 @@ function thing_init(&$a) {
$name = escape_tags($_REQUEST['term']);
$verb = escape_tags($_REQUEST['verb']);
+ $activity = intval($_REQUEST['activity']);
$profile_guid = escape_tags($_REQUEST['profile_assign']);
$url = $_REQUEST['link'];
$photo = $_REQUEST['img'];
@@ -160,60 +161,62 @@ function thing_init(&$a) {
info( t('Thing added'));
- $arr = array();
- $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $term['url']));
- if($local_photo)
- $links[] = array('rel' => 'photo', 'type' => $local_photo_type, 'href' => $local_photo);
+ if($activity) {
+ $arr = array();
+ $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $term['url']));
+ if($local_photo)
+ $links[] = array('rel' => 'photo', 'type' => $local_photo_type, 'href' => $local_photo);
- $objtype = ACTIVITY_OBJ_THING;
-
- $obj = json_encode(array(
- 'type' => $objtype,
- 'id' => $term['url'],
- 'link' => $links,
- 'title' => $term['term'],
- 'content' => $term['term']
- ));
-
- $bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
-
- $arr['owner_xchan'] = $channel['channel_hash'];
- $arr['author_xchan'] = $channel['channel_hash'];
+ $objtype = ACTIVITY_OBJ_THING;
- $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
-
- $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
- $plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';
+ $obj = json_encode(array(
+ 'type' => $objtype,
+ 'id' => $term['url'],
+ 'link' => $links,
+ 'title' => $term['term'],
+ 'content' => $term['term']
+ ));
- $arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
+ $bodyverb = str_replace('OBJ: ', '',t('OBJ: %1$s %2$s %3$s'));
- if($local_photo)
- $arr['body'] .= "\n\n[zmg]" . $local_photo . "[/zmg]";
+ $arr['owner_xchan'] = $channel['channel_hash'];
+ $arr['author_xchan'] = $channel['channel_hash'];
- $arr['verb'] = $verb;
- $arr['obj_type'] = $objtype;
- $arr['object'] = $obj;
- if(! $profile['is_default']) {
- $arr['item_private'] = true;
- $str = '';
- $r = q("select abook_xchan from abook where abook_channel = %d and abook_profile = '%s'",
- intval(local_user()),
- dbesc($profile_guid)
- );
- if($r) {
- $arr['allow_cid'] = '';
- foreach($r as $rr)
- $arr['allow_cid'] .= '<' . $rr['abook_xchan'] . '>';
- }
- else
- $arr['allow_cid'] = '<' . get_observer_hash() . '>';
- }
+ $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
- $ret = post_activity_item($arr);
+ $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
+ $plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';
+
+ $arr['body'] = sprintf( $bodyverb, $ulink, $translated_verb, $plink );
+
+ if($local_photo)
+ $arr['body'] .= "\n\n[zmg]" . $local_photo . "[/zmg]";
+
+ $arr['verb'] = $verb;
+ $arr['obj_type'] = $objtype;
+ $arr['object'] = $obj;
+
+ if(! $profile['is_default']) {
+ $arr['item_private'] = true;
+ $str = '';
+ $r = q("select abook_xchan from abook where abook_channel = %d and abook_profile = '%s'",
+ intval(local_user()),
+ dbesc($profile_guid)
+ );
+ if($r) {
+ $arr['allow_cid'] = '';
+ foreach($r as $rr)
+ $arr['allow_cid'] .= '<' . $rr['abook_xchan'] . '>';
+ }
+ else
+ $arr['allow_cid'] = '<' . get_observer_hash() . '>';
+ }
+ $ret = post_activity_item($arr);
+ }
}
@@ -269,6 +272,7 @@ function thing_content(&$a) {
'$profile_select' => contact_profile_assign($r[0]['obj_page']),
'$verb_lbl' => t('Select a category of stuff. e.g. I ______ something'),
'$verb_select' => obj_verb_selector($r[0]['obj_verb']),
+ '$activity' => array('activity',t('Post an activity'),true,t('Only sends to viewers of the applicable profile')),
'$thing_hash' => $thing_hash,
'$thing_lbl' => t('Name of thing e.g. something'),
'$thething' => $r[0]['term'],
@@ -314,6 +318,7 @@ function thing_content(&$a) {
'$profile_lbl' => t('Select a profile'),
'$profile_select' => contact_profile_assign(''),
'$verb_lbl' => t('Select a category of stuff. e.g. I ______ something'),
+ '$activity' => array('activity',t('Post an activity'),true,t('Only sends to viewers of the applicable profile')),
'$verb_select' => obj_verb_selector(),
'$thing_lbl' => t('Name of thing e.g. something'),
'$url_lbl' => t('URL of thing (optional)'),