X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=cbf5e4d24dd49113514f0d86e6cf8355fae18642;hb=44a22c29155fa3beeed7cd5d0add30818e409891;hp=c5ecac777193bdde07d78d44e58929965a540b68;hpb=07d4cf53ade51f85edbf7ca2bf8ac60bfd2a5af4;p=friendica.git
diff --git a/include/items.php b/include/items.php
index c5ecac7771..cbf5e4d24d 100644
--- a/include/items.php
+++ b/include/items.php
@@ -113,7 +113,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0)
$items = $r;
- $feed_template = load_view_file('view/atom_feed.tpl');
+ $feed_template = get_markup_template('atom_feed.tpl');
$atom = '';
@@ -354,6 +354,9 @@ function get_atom_elements($feed,$item) {
$res['body'] = preg_replace('##s',
'[youtube]$1[/youtube]', $res['body']);
+ $res['body'] = preg_replace('##s',
+ '[youtube]$1[/youtube]', $res['body']);
+
$res['body'] = oembed_html2bbcode($res['body']);
$config = HTMLPurifier_Config::createDefault();
@@ -381,6 +384,9 @@ function get_atom_elements($feed,$item) {
else
$res['private'] = 0;
+ $extid = $item->get_item_tags(NAMESPACE_DFRN,'extid');
+ if($extid && $extid[0]['data'])
+ $res['extid'] = $extid[0]['data'];
$rawlocation = $item->get_item_tags(NAMESPACE_DFRN, 'location');
if($rawlocation)
@@ -521,6 +527,10 @@ function get_atom_elements($feed,$item) {
$body = preg_replace('##s',
'[youtube]$1[/youtube]', $body);
+ $res['body'] = preg_replace('##s',
+ '[youtube]$1[/youtube]', $res['body']);
+
+
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
@@ -560,6 +570,9 @@ function get_atom_elements($feed,$item) {
$body = preg_replace('##s',
'[youtube]$1[/youtube]', $body);
+ $res['body'] = preg_replace('##s',
+ '[youtube]$1[/youtube]', $res['body']);
+
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.DefinitionImpl', null);
@@ -624,6 +637,7 @@ function item_store($arr,$force_parent = false) {
$arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0);
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string());
+ $arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : '');
$arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : '');
$arr['author-link'] = ((x($arr,'author-link')) ? notags(trim($arr['author-link'])) : '');
$arr['author-avatar'] = ((x($arr,'author-avatar')) ? notags(trim($arr['author-avatar'])) : '');
@@ -701,6 +715,7 @@ function item_store($arr,$force_parent = false) {
$parent_id = 0;
$arr['thr-parent'] = $arr['parent-uri'];
$arr['parent-uri'] = $arr['uri'];
+ $arr['gravity'] = 0;
}
else {
logger('item_store: item parent was not found - ignoring item');
@@ -1204,6 +1219,13 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
$item_id = $item->get_id();
$datarray = get_atom_elements($feed,$item);
+ if(! x($datarray,'author-name'))
+ $datarray['author-name'] = $contact['name'];
+ if(! x($datarray,'author-link'))
+ $datarray['author-link'] = $contact['url'];
+ if(! x($datarray,'author-avatar'))
+ $datarray['author-avatar'] = $contact['thumb'];
+
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
@@ -1277,6 +1299,15 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee
$datarray = get_atom_elements($feed,$item);
+ if(is_array($contact)) {
+ if(! x($datarray,'author-name'))
+ $datarray['author-name'] = $contact['name'];
+ if(! x($datarray,'author-link'))
+ $datarray['author-link'] = $contact['url'];
+ if(! x($datarray,'author-avatar'))
+ $datarray['author-avatar'] = $contact['thumb'];
+ }
+
$r = q("SELECT `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($item_id),
intval($importer['uid'])
@@ -1404,7 +1435,7 @@ function new_follower($importer,$contact,$datarray,$item) {
$a = get_app();
if(count($r)) {
if(($r[0]['notify-flags'] & NOTIFY_INTRO) && ($r[0]['page-flags'] == PAGE_NORMAL)) {
- $email_tpl = load_view_file('view/follow_notify_eml.tpl');
+ $email_tpl = get_intltext_template('follow_notify_eml.tpl');
$email = replace_macros($email_tpl, array(
'$requestor' => ((strlen($name)) ? $name : t('[Name Withheld]')),
'$url' => $url,
@@ -1513,7 +1544,7 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
if(is_array($author))
$o .= atom_author('author',$author['name'],$author['url'],80,80,$author['thumb']);
else
- $o .= atom_author('author',$item['name'],$item['url'],80,80,$item['thumb']);
+ $o .= atom_author('author',(($item['author-name']) ? $item['author-name'] : $item['name']),(($item['author-link']) ? $item['author-link'] : $item['url']),80,80,(($item['author-avatar']) ? $item['author-avatar'] : $item['thumb']));
if(strlen($item['owner-name']))
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
@@ -1541,6 +1572,10 @@ function atom_entry($item,$type,$author,$owner,$comment = false) {
if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']))
$o .= '1' . "\r\n";
+ if($item['extid'])
+ $o .= '' . $item['extid'] . '' . "\r\n";
+
+
$verb = construct_verb($item);
$o .= '' . xmlify($verb) . '' . "\r\n";
$actobj = construct_activity_object($item);