aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.htaccess1
-rw-r--r--boot.php2
-rw-r--r--include/bb2diaspora.php15
-rw-r--r--include/diaspora.php101
-rw-r--r--include/event.php2
-rw-r--r--include/items.php1
-rw-r--r--mod/item.php15
-rw-r--r--mod/like.php3
-rw-r--r--mod/network.php16
-rw-r--r--mod/photos.php5
-rw-r--r--view/theme/quattro/quattro.less1
-rw-r--r--view/theme/quattro/style.css1
12 files changed, 144 insertions, 19 deletions
diff --git a/.htaccess b/.htaccess
index 3ababd770..1df509670 100644
--- a/.htaccess
+++ b/.htaccess
@@ -8,7 +8,6 @@ Deny from all
<IfModule mod_rewrite.c>
RewriteEngine on
- RewriteBase /~fabio/friendika/
# Protect repository directory from browsing
RewriteRule "(^|/)\.git" - [F]
diff --git a/boot.php b/boot.php
index e7cd06504..37c530e81 100644
--- a/boot.php
+++ b/boot.php
@@ -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/diaspora.php b/include/diaspora.php
index 2d9e2883d..5ad1a9733 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -28,6 +28,14 @@ function diaspora_dispatch($importer,$msg) {
$ret = 0;
+ // php doesn't like dashes in variable names
+
+ $msg['message'] = str_replace(
+ array('<activity_streams-photo>','</activity_streams-photo>'),
+ array('<asphoto>','</asphoto>'),
+ $msg['message']);
+
+
$parsed_xml = parse_xml_string($msg['message'],false);
$xmlbase = $parsed_xml->post;
@@ -47,6 +55,9 @@ function diaspora_dispatch($importer,$msg) {
elseif($xmlbase->like) {
$ret = diaspora_like($importer,$xmlbase->like,$msg);
}
+ elseif($xmlbase->asphoto) {
+ $ret = diaspora_asphoto($importer,$xmlbase->asphoto);
+ }
elseif($xmlbase->retraction) {
$ret = diaspora_retraction($importer,$xmlbase->retraction,$msg);
}
@@ -569,6 +580,96 @@ function diaspora_post($importer,$xml) {
}
+function diaspora_asphoto($importer,$xml) {
+
+ $a = get_app();
+ $guid = notags(unxmlify($xml->guid));
+ $diaspora_handle = notags(unxmlify($xml->diaspora_handle));
+
+ $contact = diaspora_get_contact_by_handle($importer['uid'],$diaspora_handle);
+ if(! $contact)
+ return;
+
+ if(($contact['rel'] == CONTACT_IS_FOLLOWER) || ($contact['blocked']) || ($contact['readonly'])) {
+ logger('diaspora_asphoto: Ignoring this author.');
+ return 202;
+ }
+
+ $message_id = $diaspora_handle . ':' . $guid;
+ $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `guid` = '%s' LIMIT 1",
+ intval($importer['uid']),
+ dbesc($message_id),
+ dbesc($guid)
+ );
+ if(count($r)) {
+ logger('diaspora_asphoto: message exists: ' . $guid);
+ return;
+ }
+
+ // allocate a guid on our system - we aren't fixing any collisions.
+ // we're ignoring them
+
+ $g = q("select * from guid where guid = '%s' limit 1",
+ dbesc($guid)
+ );
+ if(! count($g)) {
+ q("insert into guid ( guid ) values ( '%s' )",
+ dbesc($guid)
+ );
+ }
+
+ $created = unxmlify($xml->created_at);
+ $private = ((unxmlify($xml->public) == 'false') ? 1 : 0);
+
+ if(strlen($xml->objectId) && ($xml->objectId != 0) && ($xml->image_url))
+ $body = '[url=' . notags(unxmlify($xml->image_url)) . '][img=' . notags(unxmlify($xml->objectId)) . '][/img][/url]' . "\n";
+ elseif($xml->image_url)
+ $body = '[img=' . notags(unxmlify($xml->image_url)) . '][/img]' . "\n";
+ else {
+ logger('diaspora_asphoto: no photo url found.');
+ return;
+ }
+
+
+ $datarray = array();
+
+
+ $datarray['uid'] = $importer['uid'];
+ $datarray['contact-id'] = $contact['id'];
+ $datarray['wall'] = 0;
+ $datarray['guid'] = $guid;
+ $datarray['uri'] = $datarray['parent-uri'] = $message_id;
+ $datarray['created'] = $datarray['edited'] = datetime_convert('UTC','UTC',$created);
+ $datarray['private'] = $private;
+ $datarray['parent'] = 0;
+ $datarray['owner-name'] = $contact['name'];
+ $datarray['owner-link'] = $contact['url'];
+ $datarray['owner-avatar'] = $contact['thumb'];
+ $datarray['author-name'] = $contact['name'];
+ $datarray['author-link'] = $contact['url'];
+ $datarray['author-avatar'] = $contact['thumb'];
+ $datarray['body'] = $body;
+
+ $datarray['app'] = 'Diaspora/Cubbi.es';
+
+ $message_id = item_store($datarray);
+
+ if($message_id) {
+ q("update item set plink = '%s' where id = %d limit 1",
+ dbesc($a->get_baseurl() . '/display/' . $importer['nickname'] . '/' . $message_id),
+ intval($message_id)
+ );
+ }
+
+ return;
+
+}
+
+
+
+
+
+
function diaspora_comment($importer,$xml,$msg) {
$a = get_app();
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/network.php b/mod/network.php
index 5aa39bf63..9ab34ebb0 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -133,15 +133,29 @@ function network_content(&$a, $update = 0) {
&& ($search_active == '')) {
$all_active = 'active';
}
+ $postord_active = '';
+
+ if($all_active && x($_GET,'order') && $_GET['order'] !== 'comment') {
+ $all_active = '';
+ $postord_active = 'active';
+ }
+
+
// tabs
$tabs = array(
array(
- 'label' => t('All'),
+ 'label' => t('Commented Order'),
'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''),
'sel'=>$all_active,
),
array(
+ 'label' => t('Posted Order'),
+ 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?order=post' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''),
+ 'sel'=>$postord_active,
+ ),
+
+ array(
'label' => t('New'),
'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : ''),
'sel' => $new_active,
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]';
diff --git a/view/theme/quattro/quattro.less b/view/theme/quattro/quattro.less
index 782e1b62b..1fbeb7ae2 100644
--- a/view/theme/quattro/quattro.less
+++ b/view/theme/quattro/quattro.less
@@ -438,6 +438,7 @@ input[type="submit"] {
color: @ButtonColor;
padding: 0px 10px;
.rounded(5px);
+ height: 18px;
}
diff --git a/view/theme/quattro/style.css b/view/theme/quattro/style.css
index aa4552837..585214233 100644
--- a/view/theme/quattro/style.css
+++ b/view/theme/quattro/style.css
@@ -700,6 +700,7 @@ input[type="submit"] {
-moz-border-radius: 5px 5px 5px 5px;
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
+ height: 18px;
}
/** acl **/
#photo-edit-perms-select, #photos-upload-permissions-wrapper, #profile-jot-acl-wrapper {