aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-10-17 14:52:03 -0700
committerFriendika <info@friendika.com>2011-10-17 14:52:03 -0700
commit278433eac75639052686f70e98621466d6c44df3 (patch)
treeac9d4dbe9d6a64636143d9a6eb8e591245129143 /mod
parentb820dfa31fd0fead82f238f18c965dcdbf5f672d (diff)
downloadvolse-hubzilla-278433eac75639052686f70e98621466d6c44df3.tar.gz
volse-hubzilla-278433eac75639052686f70e98621466d6c44df3.tar.bz2
volse-hubzilla-278433eac75639052686f70e98621466d6c44df3.zip
origin flag handling, and bug #137 - provide timezone conversion for events posted across to Diaspora
Diffstat (limited to 'mod')
-rw-r--r--mod/item.php15
-rw-r--r--mod/like.php3
-rw-r--r--mod/photos.php5
3 files changed, 17 insertions, 6 deletions
diff --git a/mod/item.php b/mod/item.php
index 9e6d33230..ab104735b 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -484,7 +484,12 @@ function item_post(&$a) {
$verb = ACTIVITY_POST ;
$gravity = (($parent) ? 6 : 0 );
-
+
+ // even if the post arrived via API we are considering that it
+ // originated on this site by default for determining relayability.
+
+ $origin = ((x($_REQUEST,'origin')) ? intval($_REQUEST['origin']) : 1);
+
$notify_type = (($parent) ? 'comment-new' : 'wall-new' );
$uri = item_new_uri($a->get_hostname(),$profile_uid);
@@ -525,6 +530,7 @@ function item_post(&$a) {
$datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
$datarray['postopts'] = '';
+ $datarray['origin'] = $origin;
/**
* These fields are for the convenience of plugins...
@@ -566,8 +572,8 @@ function item_post(&$a) {
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
- `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark` )
- VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d )",
+ `tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin` )
+ VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
@@ -603,7 +609,8 @@ function item_post(&$a) {
intval($datarray['private']),
intval($datarray['pubmail']),
dbesc($datarray['attach']),
- intval($datarray['bookmark'])
+ intval($datarray['bookmark']),
+ intval($datarray['origin'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
diff --git a/mod/like.php b/mod/like.php
index 95bedcc20..5c3dd323e 100644
--- a/mod/like.php
+++ b/mod/like.php
@@ -154,7 +154,8 @@ EOT;
$arr['uid'] = $owner_uid;
$arr['contact-id'] = $contact['id'];
$arr['type'] = 'activity';
- $arr['wall'] = 1;
+ $arr['wall'] = $item['wall'];
+ $arr['origin'] = 1;
$arr['gravity'] = GRAVITY_LIKE;
$arr['parent'] = $item['id'];
$arr['parent-uri'] = $item['uri'];
diff --git a/mod/photos.php b/mod/photos.php
index 284169221..663d0a40c 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -348,6 +348,7 @@ function photos_post(&$a) {
$arr['deny_gid'] = $p[0]['deny_gid'];
$arr['last-child'] = 1;
$arr['visible'] = $visibility;
+ $arr['origin'] = 1;
$arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']'
. '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]'
@@ -506,7 +507,7 @@ function photos_post(&$a) {
$arr['target-type'] = ACTIVITY_OBJ_PHOTO;
$arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2];
-
+ $arr['origin'] = 1;
$arr['body'] = '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]' . ' ' . t('was tagged in a') . ' ' . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . t('photo') . '[/url]' . ' ' . t('by') . ' ' . '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]' ;
$arr['body'] .= "\n\n" . '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $p[0]['resource-id'] . ']' . '[img]' . $a->get_baseurl() . "/photo/" . $p[0]['resource-id'] . '-' . $best . '.jpg' . '[/img][/url]' . "\n" ;
@@ -695,6 +696,8 @@ function photos_post(&$a) {
$arr['deny_gid'] = $str_group_deny;
$arr['last-child'] = 1;
$arr['visible'] = $visible;
+ $arr['origin'] = 1;
+
$arr['body'] = '[url=' . $a->get_baseurl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo_hash . ']'
. '[img]' . $a->get_baseurl() . "/photo/{$photo_hash}-{$smallest}.jpg" . '[/img]'
. '[/url]';