diff --git a/include/bbcode.php b/include/bbcode.php
index 6c7f39a9f..32265363c 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -13,9 +13,9 @@ function bb_map_location($match) {
return str_replace($match[0],'
' . generate_named_map($match[1]) . '
', $match[0]);
}
-function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
+function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
$Text = preg_replace_callback("/(.*?)\[attachment(.*?)\](.*?)\[\/attachment\]/ism",
- function ($match) use ($plaintext, $tryoembed){
+ function ($match) use ($simplehtml, $tryoembed){
$attributes = $match[2];
@@ -83,7 +83,10 @@ function bb_attachment($Text, $plaintext = false, $tryoembed = true) {
$image = "";
}
- if ($plaintext)
+ if ($simplehtml == 7)
+ $text = sprintf('%s',
+ $url, $title, $title);
+ elseif (($simplehtml != 4) AND ($simplehtml != 0))
$text = sprintf('%s
', $url, $title);
else {
$text = sprintf('', $type);
@@ -871,7 +874,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
}
// Handle attached links or videos
- $Text = bb_attachment($Text, ($simplehtml != 4) AND ($simplehtml != 0), $tryoembed);
+ $Text = bb_attachment($Text, $simplehtml, $tryoembed);
$Text = str_replace(array("\r","\n"), array('
','
'), $Text);
diff --git a/include/items.php b/include/items.php
index 3fe624b00..c34859d94 100644
--- a/include/items.php
+++ b/include/items.php
@@ -12,6 +12,7 @@ require_once('include/email.php');
require_once('include/ostatus_conversation.php');
require_once('include/threads.php');
require_once('include/socgraph.php');
+require_once('include/plaintext.php');
require_once('mod/share.php');
function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0, $forpubsub = false) {
@@ -4344,7 +4345,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
if ($item['title'] != "")
$htmlbody = "[b]".$item['title']."[/b]\n\n".$htmlbody;
- $htmlbody = bbcode(bb_remove_share_information($htmlbody), false, false, 7);
+ //$htmlbody = bbcode(bb_remove_share_information($htmlbody), false, false, 7);
+ $htmlbody = bbcode($htmlbody, false, false, 7);
$o .= '' . xmlify($item['uri']) . '' . "\r\n";
$o .= '' . xmlify($item['title']) . '' . "\r\n";
@@ -4401,6 +4403,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) {
}
}
+ $o .= item_get_attachment($item);
+
$o .= item_getfeedattach($item);
$mentioned = get_mentions($item);
@@ -4578,6 +4582,28 @@ function item_getfeedtags($item) {
return $ret;
}
+function item_get_attachment($item) {
+ $o = "";
+ $siteinfo = get_attached_data($item["body"]);
+
+ switch($siteinfo["type"]) {
+ case 'link':
+ $o = ''."\r\n";
+ break;
+ case 'photo':
+ $imgdata = get_photo_info($siteinfo["image"]);
+ $o = ''."\r\n";
+ break;
+ case 'video':
+ $o = ''."\r\n";
+ break;
+ default:
+ break;
+ }
+
+ return $o;
+}
+
function item_getfeedattach($item) {
$ret = '';
$arr = explode('[/attach],',$item['attach']);
@@ -4951,7 +4977,7 @@ function list_post_dates($uid, $wall) {
return array();
// Set the start and end date to the beginning of the month
- $dnow = substr($dnow,0,8).'01';
+ $dnow = substr($dnow,0,8).'01';
$dthen = substr($dthen,0,8).'01';
$ret = array();
@@ -4967,7 +4993,7 @@ function list_post_dates($uid, $wall) {
$str = day_translate(datetime_convert('','',$dnow,'F'));
if(! $ret[$dyear])
$ret[$dyear] = array();
- $ret[$dyear][] = array($str,$end_month,$start_month);
+ $ret[$dyear][] = array($str,$end_month,$start_month);
$dnow = datetime_convert('','',$dnow . ' -1 month', 'Y-m-d');
}
return $ret;
@@ -5015,12 +5041,12 @@ function posted_date_widget($url,$uid,$wall) {
if(! $visible_years)
$visible_years = 5;
- $ret = list_post_dates($uid,$wall);
+ $ret = list_post_dates($uid,$wall);
if(! count($ret))
return $o;
- $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
+ $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
$cutoff = ((array_key_exists($cutoff_year,$ret))? true : false);
$o = replace_macros(get_markup_template('posted_date_widget.tpl'),array(
@@ -5030,7 +5056,7 @@ function posted_date_widget($url,$uid,$wall) {
'$cutoff' => $cutoff,
'$url' => $url,
'$dates' => $ret,
- '$showmore' => t('show more')
+ '$showmore' => t('show more')
));
return $o;
diff --git a/include/ostatus_conversation.php b/include/ostatus_conversation.php
index f40c4827b..2670d1976 100644
--- a/include/ostatus_conversation.php
+++ b/include/ostatus_conversation.php
@@ -53,8 +53,9 @@ function check_conversations($override = false) {
logger('cron_start');
$start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
- $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'",
+ $conversations = q("SELECT `oid`, `url` FROM `term` WHERE `type` = 7 AND `term` > '%s' GROUP BY `url` ORDER BY `term` DESC",
dbesc($start));
+
foreach ($conversations AS $conversation) {
$id = $conversation['oid'];
$url = $conversation['url'];