diff options
-rw-r--r-- | boot.php | 2 | ||||
-rw-r--r-- | include/bb2diaspora.php | 15 | ||||
-rw-r--r-- | include/event.php | 2 | ||||
-rw-r--r-- | include/items.php | 1 | ||||
-rw-r--r-- | mod/item.php | 15 | ||||
-rw-r--r-- | mod/like.php | 3 | ||||
-rw-r--r-- | mod/photos.php | 5 |
7 files changed, 26 insertions, 17 deletions
@@ -8,7 +8,7 @@ require_once("include/pgettext.php"); require_once('include/nav.php'); define ( 'FRIENDIKA_PLATFORM', 'Free Friendika'); -define ( 'FRIENDIKA_VERSION', '2.3.1134' ); +define ( 'FRIENDIKA_VERSION', '2.3.1137' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1097 ); diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index c72c78445..bdf278213 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -11,12 +11,7 @@ function diaspora2bb($s) { $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s); $s = Markdown($s); $s = html2bbcode($s); - -// $s = preg_replace('/\[url=(.+?)\<em\>(.+?)\]/ism','[url=$1_$2]',$s); -// $s = preg_replace('/\[url=(.+?)\<\/em\>(.+?)\]/ism','[url=$1_$2]',$s); - return $s; - } @@ -185,6 +180,8 @@ function bb2diaspora($Text,$preserve_nl = false) { function format_event_diaspora($ev) { + $a = get_app(); + if(! ((is_array($ev)) && count($ev))) return ''; @@ -194,20 +191,20 @@ function format_event_diaspora($ev) { $o .= '**' . bb2diaspora($ev['desc']) . '**' . "\n"; - $o .= t('Starts:') . ' ' + $o .= t('Starts:') . ' ' . '[' . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC', $ev['start'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $ev['start'] , $bd_format))) - . "\n"; + . '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['start'])) . ")\n"; if(! $ev['nofinish']) - $o .= t('Finishes:') . ' ' + $o .= t('Finishes:') . ' ' . '[' . (($ev['adjust']) ? day_translate(datetime_convert('UTC', 'UTC', $ev['finish'] , $bd_format )) : day_translate(datetime_convert('UTC', 'UTC', $ev['finish'] , $bd_format ))) - . "\n"; + . '](' . $a->get_baseurl() . '/localtime/?f=&time=' . urlencode(datetime_convert('UTC','UTC',$ev['finish'])) . ")\n"; if(strlen($ev['location'])) $o .= t('Location:') . bb2diaspora($ev['location']) diff --git a/include/event.php b/include/event.php index 99f685d0b..746422a13 100644 --- a/include/event.php +++ b/include/event.php @@ -352,7 +352,7 @@ function event_store($arr) { $item_arr['visible'] = 1; $item_arr['verb'] = ACTIVITY_POST; $item_arr['object-type'] = ACTIVITY_OBJ_EVENT; - + $item_arr['origin'] = ((intval($arr['cid']) == 0) ? 1 : 0); $item_arr['body'] = format_event_bbcode($event); diff --git a/include/items.php b/include/items.php index 0c3c8b1d7..136dee90f 100644 --- a/include/items.php +++ b/include/items.php @@ -730,6 +730,7 @@ function item_store($arr,$force_parent = false) { $arr['tag'] = ((x($arr,'tag')) ? notags(trim($arr['tag'])) : ''); $arr['attach'] = ((x($arr,'attach')) ? notags(trim($arr['attach'])) : ''); $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : ''); + $arr['origin'] = ((x($arr,'origin')) ? intval($arr['origin']) : 0 ); $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid()); if($arr['parent-uri'] === $arr['uri']) { 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]'; |