aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/ItemObject.php9
-rw-r--r--include/bb2diaspora.php24
-rw-r--r--include/network.php12
-rw-r--r--mod/share.php6
4 files changed, 41 insertions, 10 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index a5870ef91..b4a60762b 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -90,6 +90,10 @@ class Item extends BaseObject {
: false);
$shareable = ((($conv->get_profile_owner() == local_user()) && ($item['item_private'] != 1)) ? true : false);
+ // allow an exemption for sharing stuff from your private feeds
+ if($item['author']['xchan_network'] === 'rss')
+ $shareable = true;
+
$mode = $conv->get_mode();
if(local_user() && $observer['xchan_hash'] === $item['author_xchan'])
@@ -207,10 +211,11 @@ class Item extends BaseObject {
if($this->is_commentable()) {
$like = array( t("I like this \x28toggle\x29"), t("like"));
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
- if ($shareable)
- $share = array( t('Share This'), t('share'));
}
+ if ($shareable)
+ $share = array( t('Share This'), t('share'));
+
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$indent .= ' shiny';
diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php
index f15a34e99..623b2d7b7 100644
--- a/include/bb2diaspora.php
+++ b/include/bb2diaspora.php
@@ -77,6 +77,25 @@ function share_unshield($m) {
}
+function diaspora_mention_callback($matches) {
+
+ $webbie = $matches[2];
+ $link = '';
+ if($webbie) {
+ $r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash where hubloc_addr = '%s' limit 1",
+ dbesc($webbie)
+ );
+ if($r)
+ $link = $r[0]['xchan_url'];
+ }
+ if(! $link)
+ $link = 'https://' . $matches[3] . '/u/' . $matches[2];
+
+ return '@[url=' . $link . ']' . trim($matches[1]) . '[/url]';
+
+}
+
+
// we don't want to support a bbcode specific markdown interpreter
// and the markdown library we have is pretty good, but provides HTML output.
@@ -97,7 +116,10 @@ function diaspora2bb($s,$use_zrl = false) {
$s = str_replace("<br/>","<br />",$s);
$s = str_replace("\n","<br />",$s);
- $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+
+// $s = preg_replace('/\@\{(.+?)\; (.+?)\@(.+?)\}/','@[url=https://$3/u/$2]$1[/url]',$s);
+
+ $s = preg_replace_callback('/\@\{(.+?)\; (.+?)\@(.+?)\}/','diaspora_mention_callback',$s);
// Escaping the hash tags - doesn't always seem to work
// $s = preg_replace('/\#([^\s\#])/','\\#$1',$s);
diff --git a/include/network.php b/include/network.php
index c44ed77c4..77c1550ba 100644
--- a/include/network.php
+++ b/include/network.php
@@ -868,15 +868,18 @@ function discover_by_url($url,$arr = null) {
if($feed->error())
logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
+ $name = unxmlify(trim($feed->get_title()));
$photo = $feed->get_image_url();
$author = $feed->get_author();
if($author) {
- $name = unxmlify(trim($author->get_name()));
if(! $name)
+ $name = unxmlify(trim($author->get_name()));
+ if(! $name) {
$name = trim(unxmlify($author->get_email()));
- if(strpos($name,'@') !== false)
- $name = substr($name,0,strpos($name,'@'));
+ if(strpos($name,'@') !== false)
+ $name = substr($name,0,strpos($name,'@'));
+ }
if(! $profile && $author->get_link())
$profile = trim(unxmlify($author->get_link()));
if(! $photo) {
@@ -924,8 +927,7 @@ function discover_by_url($url,$arr = null) {
if(! $network) {
$network = 'rss';
}
- if(! $name)
- $name = notags($feed->get_title());
+
if(! $name)
$name = notags($feed->get_description());
diff --git a/mod/share.php b/mod/share.php
index 8b0403663..78a25ee10 100644
--- a/mod/share.php
+++ b/mod/share.php
@@ -14,10 +14,12 @@ function share_init(&$a) {
killme();
- $r = q("SELECT * from item WHERE id = %d LIMIT 1",
+ $r = q("SELECT * from item left join xchan on author_xchan = xchan_hash WHERE id = %d LIMIT 1",
intval($post_id)
);
- if((! $r) || $r[0]['item_private'])
+ if(! $r)
+ killme();
+ if(($r[0]['item_private']) && ($r[0]['xchan_network'] !== 'rss'))
killme();
$sql_extra = item_permissions_sql($r[0]['uid']);