build feeds rather than template them
This commit is contained in:
parent
4f4d6bace6
commit
36a77c6db2
4 changed files with 101 additions and 233 deletions
13
boot.php
13
boot.php
|
@ -8,6 +8,14 @@ define ( 'DFRN_PROTOCOL_VERSION', '2.0' );
|
||||||
define ( 'EOL', "<br />\r\n" );
|
define ( 'EOL', "<br />\r\n" );
|
||||||
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
|
||||||
|
|
||||||
|
// log levels
|
||||||
|
|
||||||
|
define ( 'LOGGER_NORMAL', 0 );
|
||||||
|
define ( 'LOGGER_TRACE', 1 );
|
||||||
|
define ( 'LOGGER_DEBUG', 2 );
|
||||||
|
define ( 'LOGGER_DATA', 3 );
|
||||||
|
define ( 'LOGGER_ALL', 4 );
|
||||||
|
|
||||||
// registration policy
|
// registration policy
|
||||||
|
|
||||||
define ( 'REGISTER_CLOSED', 0 );
|
define ( 'REGISTER_CLOSED', 0 );
|
||||||
|
@ -1281,12 +1289,13 @@ function attribute_contains($attr,$s) {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
if(! function_exists('logger')) {
|
if(! function_exists('logger')) {
|
||||||
function logger($msg) {
|
function logger($msg,$level = 0) {
|
||||||
|
|
||||||
$debugging = get_config('system','debugging');
|
$debugging = get_config('system','debugging');
|
||||||
|
$loglevel = intval(get_config('system','loglevel'));
|
||||||
$logfile = get_config('system','logfile');
|
$logfile = get_config('system','logfile');
|
||||||
|
|
||||||
if((! $debugging) || (! $logfile))
|
if((! $debugging) || (! $logfile) || ($level > $loglevel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $msg . "\n", FILE_APPEND);
|
@file_put_contents($logfile, datetime_convert() . ':' . session_id() . ' ' . $msg . "\n", FILE_APPEND);
|
||||||
|
|
|
@ -27,8 +27,10 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1",
|
||||||
intval($owner_id)
|
intval($owner_id)
|
||||||
);
|
);
|
||||||
if(count($r))
|
if(count($r)) {
|
||||||
$owner = $r[0];
|
$owner = $r[0];
|
||||||
|
$owner['nickname'] = $owner_nick;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
|
@ -90,7 +92,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
|
||||||
$sort = 'ASC';
|
$sort = 'ASC';
|
||||||
|
|
||||||
if(! strlen($last_update))
|
if(! strlen($last_update))
|
||||||
$last_update = 'now - 30 days';
|
$last_update = 'now -30 days';
|
||||||
|
|
||||||
$check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
|
$check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
|
||||||
|
|
||||||
|
@ -117,9 +119,6 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
|
||||||
$items = $r;
|
$items = $r;
|
||||||
|
|
||||||
$feed_template = load_view_file('view/atom_feed.tpl');
|
$feed_template = load_view_file('view/atom_feed.tpl');
|
||||||
$tomb_template = load_view_file('view/atom_tomb.tpl');
|
|
||||||
$item_template = load_view_file('view/atom_item.tpl');
|
|
||||||
$cmnt_template = load_view_file('view/atom_cmnt.tpl');
|
|
||||||
|
|
||||||
$atom = '';
|
$atom = '';
|
||||||
|
|
||||||
|
@ -169,69 +168,13 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) {
|
||||||
// public feeds get html, our own nodes use bbcode
|
// public feeds get html, our own nodes use bbcode
|
||||||
|
|
||||||
if($dfrn_id === '*') {
|
if($dfrn_id === '*') {
|
||||||
$allow = (($item['last-child']) ? 1 : 0);
|
|
||||||
$item['body'] = bbcode($item['body']);
|
|
||||||
$type = 'html';
|
$type = 'html';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$allow = ((($item['last-child']) && ($contact['rel']) && ($contact['rel'] != REL_FAN)) ? 1 : 0);
|
|
||||||
$type = 'text';
|
$type = 'text';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($item['deleted']) {
|
$atom .= atom_entry($item,$type,null,$owner,true);
|
||||||
$atom .= replace_macros($tomb_template, array(
|
|
||||||
'$id' => xmlify($item['uri']),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME))
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$verb = construct_verb($item);
|
|
||||||
$actobj = construct_activity($item);
|
|
||||||
$mentioned = get_mentions($item);
|
|
||||||
|
|
||||||
if($item['parent'] == $item['id']) {
|
|
||||||
$atom .= replace_macros($item_template, array(
|
|
||||||
'$name' => xmlify($item['name']),
|
|
||||||
'$profile_page' => xmlify($item['url']),
|
|
||||||
'$thumb' => xmlify($item['thumb']),
|
|
||||||
'$owner_name' => xmlify($item['owner-name']),
|
|
||||||
'$owner_profile_page' => xmlify($item['owner-link']),
|
|
||||||
'$owner_thumb' => xmlify($item['owner-avatar']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => $type,
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner_nick . '/' . $item['id']),
|
|
||||||
'$content' => xmlify($item['body']),
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj, // do not xmlify
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$comment_allow' => $allow
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$atom .= replace_macros($cmnt_template, array(
|
|
||||||
'$name' => xmlify($item['name']),
|
|
||||||
'$profile_page' => xmlify($item['url']),
|
|
||||||
'$thumb' => xmlify($item['thumb']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$type' => $type,
|
|
||||||
'$content' => xmlify($item['body']),
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner_nick . '/' . $item['id']),
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj, // do not xmlify
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$parent_id' => xmlify($item['parent-uri']),
|
|
||||||
'$comment_allow' => $allow
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$atom .= '</feed>' . "\r\n";
|
$atom .= '</feed>' . "\r\n";
|
||||||
|
@ -1050,4 +993,73 @@ function subscribe_to_hub($url,$importer,$contact) {
|
||||||
post_url($url,$params);
|
post_url($url,$params);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function atom_author($tag,$name,$uri,$h,$w,$photo) {
|
||||||
|
$o = '';
|
||||||
|
if(! $tag)
|
||||||
|
return $o;
|
||||||
|
$name = xmlify($name);
|
||||||
|
$uri = xmlify($uri);
|
||||||
|
$h = intval($h);
|
||||||
|
$w = intval($w);
|
||||||
|
$photo = xmlify($photo);
|
||||||
|
|
||||||
|
|
||||||
|
$o .= "<$tag>\r\n";
|
||||||
|
$o .= "<name>$name</name>\r\n";
|
||||||
|
$o .= "<uri>$uri</uri>\r\n";
|
||||||
|
$o .= '<link rel="photo" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
|
||||||
|
$o .= '<link rel="avatar" type="image/jpeg" media:width="' . $w . '" media:height="' . $h . '" href="' . $photo . '" />' . "\r\n";
|
||||||
|
$o .= "</$tag>\r\n";
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
||||||
|
function atom_entry($item,$type,$author,$owner,$comment = false) {
|
||||||
|
|
||||||
|
if($item['deleted'])
|
||||||
|
return '<at:deleted-entry ref="' . xmlify($item['uri']) . '" when="' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '" />' . "\r\n";
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
|
$o = "<entry>\r\n";
|
||||||
|
|
||||||
|
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']);
|
||||||
|
if(strlen($item['owner-name']))
|
||||||
|
$o .= atom_author('dfrn:owner',$item['owner-name'],$item['owner-link'],80,80,$item['owner-avatar']);
|
||||||
|
|
||||||
|
if($item['parent'] != $item['id'])
|
||||||
|
$o .= '<thr:in-reply-to ref="' . xmlify($item['parent-uri']) . '" />' . "\r\n";
|
||||||
|
|
||||||
|
$o .= '<id>' . xmlify($item['uri']) . '</id>' . "\r\n";
|
||||||
|
$o .= '<title>' . xmlify($item['title']) . '</title>' . "\r\n";
|
||||||
|
$o .= '<published>' . xmlify(datetime_convert('UTC','UTC',$item['created'] . '+00:00',ATOM_TIME)) . '</published>' . "\r\n";
|
||||||
|
$o .= '<updated>' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '</updated>' . "\r\n";
|
||||||
|
$o .= '<content type="' . $type . '" >' . xmlify(($type === 'html') ? bbcode($item['body']) : $item['body']) . '</content>' . "\r\n";
|
||||||
|
$o .= '<link rel="alternate" href="' . xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']) . '" />' . "\r\n";
|
||||||
|
if($comment)
|
||||||
|
$o .= '<dfrn:comment-allow>' . intval($item['last-child']) . '</dfrn:comment-allow>' . "\r\n";
|
||||||
|
if($item['location'])
|
||||||
|
$o .= '<dfrn:location>' . xmlify($item['location']) . '</dfrn:location>' . "\r\n";
|
||||||
|
if($item['coord'])
|
||||||
|
$o .= '<georss:point>' . xmlify($item['coord']) . '</georss:point>' . "\r\n";
|
||||||
|
|
||||||
|
$verb = construct_verb($item);
|
||||||
|
$o .= '<as:verb>' . xmlify($verb) . '</as:verb>' . "\r\n";
|
||||||
|
$actobj = construct_activity($item);
|
||||||
|
if(strlen($actobj))
|
||||||
|
$o .= $actobj;
|
||||||
|
|
||||||
|
$mentioned = get_mentions($item);
|
||||||
|
if($mentioned)
|
||||||
|
$o .= $mentioned;
|
||||||
|
|
||||||
|
$o .= '</entry>' . "\r\n";
|
||||||
|
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
// If this is a public conversation, notify the feed hub
|
// If this is a public conversation, notify the feed hub
|
||||||
$notify_hub = true;
|
$notify_hub = true;
|
||||||
|
|
||||||
// fill this in with a salmon slap if applicable
|
// fill this in with a single salmon slap if applicable
|
||||||
$slap = '';
|
$slap = '';
|
||||||
|
|
||||||
if($cmd != 'mail') {
|
if($cmd != 'mail') {
|
||||||
|
@ -152,10 +152,6 @@
|
||||||
killme();
|
killme();
|
||||||
|
|
||||||
$contacts = $r;
|
$contacts = $r;
|
||||||
|
|
||||||
$tomb_template = load_view_file('view/atom_tomb.tpl');
|
|
||||||
$item_template = load_view_file('view/atom_item.tpl');
|
|
||||||
$cmnt_template = load_view_file('view/atom_cmnt.tpl');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$feed_template = load_view_file('view/atom_feed.tpl');
|
$feed_template = load_view_file('view/atom_feed.tpl');
|
||||||
|
@ -210,178 +206,28 @@
|
||||||
|
|
||||||
if($followup) {
|
if($followup) {
|
||||||
foreach($items as $item) { // there is only one item
|
foreach($items as $item) { // there is only one item
|
||||||
|
|
||||||
$verb = construct_verb($item);
|
|
||||||
$actobj = construct_activity($item);
|
|
||||||
$mentioned = get_mentions($item);
|
|
||||||
|
|
||||||
if($item['id'] == $item_id) {
|
if($item['id'] == $item_id) {
|
||||||
$slap = replace_macros($cmnt_template, array(
|
$slap = atom_entry($item,'html',$owner,$owner,false);
|
||||||
'$name' => xmlify($owner['name']),
|
$atom .= atom_entry($item,'text',$owner,$owner,false);
|
||||||
'$profile_page' => xmlify($owner['url']),
|
|
||||||
'$thumb' => xmlify($owner['thumb']),
|
|
||||||
'$owner_name' => xmlify($item['owner-name']),
|
|
||||||
'$owner_profile_page' => xmlify($item['owner-link']),
|
|
||||||
'$owner_thumb' => xmlify($item['owner-avatar']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'html',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$content' => xmlify(bbcode($item['body'])),
|
|
||||||
'$parent_id' => xmlify($item['parent-uri']),
|
|
||||||
'$comment_allow' => 0
|
|
||||||
));
|
|
||||||
|
|
||||||
$atom .= replace_macros($cmnt_template, array(
|
|
||||||
'$name' => xmlify($owner['name']),
|
|
||||||
'$profile_page' => xmlify($owner['url']),
|
|
||||||
'$thumb' => xmlify($owner['thumb']),
|
|
||||||
'$owner_name' => xmlify($item['owner-name']),
|
|
||||||
'$owner_profile_page' => xmlify($item['owner-link']),
|
|
||||||
'$owner_thumb' => xmlify($item['owner-avatar']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'text',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$content' => xmlify($item['body']),
|
|
||||||
'$parent_id' => xmlify($item['parent-uri']),
|
|
||||||
'$comment_allow' => 0
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
if($item['deleted']) {
|
$contact = get_item_contact($item,$contacts);
|
||||||
$atom .= replace_macros($tomb_template, array(
|
if(! $contact)
|
||||||
'$id' => xmlify($item['uri']),
|
continue;
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME))
|
|
||||||
));
|
|
||||||
$slaps[] = replace_macros($tomb_template, array(
|
|
||||||
'$id' => xmlify($item['uri']),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME))
|
|
||||||
));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$contact = get_item_contact($item,$contacts);
|
|
||||||
if(! $contact)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
$verb = construct_verb($item);
|
$atom .= atom_entry($item,'text',$contact,$owner,true);
|
||||||
$actobj = construct_activity($item);
|
$slaps[] = atom_entry($item,'html',$contact,$owner,true);
|
||||||
$mentioned = get_mentions($item);
|
|
||||||
|
|
||||||
if($item['parent'] == $item['id']) {
|
|
||||||
$atom .= replace_macros($item_template, array(
|
|
||||||
'$name' => xmlify($contact['name']),
|
|
||||||
'$profile_page' => xmlify($contact['url']),
|
|
||||||
'$thumb' => xmlify($contact['thumb']),
|
|
||||||
'$owner_name' => xmlify($item['owner-name']),
|
|
||||||
'$owner_profile_page' => xmlify($item['owner-link']),
|
|
||||||
'$owner_thumb' => xmlify($item['owner-avatar']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'text',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$content' => xmlify($item['body']),
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$comment_allow' => (($item['last-child']) ? 1 : 0)
|
|
||||||
));
|
|
||||||
$slaps[] = replace_macros($item_template, array(
|
|
||||||
'$name' => xmlify($contact['name']),
|
|
||||||
'$profile_page' => xmlify($contact['url']),
|
|
||||||
'$thumb' => xmlify($contact['thumb']),
|
|
||||||
'$owner_name' => xmlify($item['owner-name']),
|
|
||||||
'$owner_profile_page' => xmlify($item['owner-link']),
|
|
||||||
'$owner_thumb' => xmlify($item['owner-avatar']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'html',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$content' => xmlify(bbcode($item['body'])),
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$comment_allow' => (($item['last-child']) ? 1 : 0)
|
|
||||||
));
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$atom .= replace_macros($cmnt_template, array(
|
|
||||||
'$name' => xmlify($contact['name']),
|
|
||||||
'$profile_page' => xmlify($contact['url']),
|
|
||||||
'$thumb' => xmlify($contact['thumb']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$content' => xmlify($item['body']),
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'text',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$parent_id' => xmlify($item['parent-uri']),
|
|
||||||
'$comment_allow' => (($item['last-child']) ? 1 : 0)
|
|
||||||
));
|
|
||||||
$slaps[] = replace_macros($cmnt_template, array(
|
|
||||||
'$name' => xmlify($contact['name']),
|
|
||||||
'$profile_page' => xmlify($contact['url']),
|
|
||||||
'$thumb' => xmlify($contact['thumb']),
|
|
||||||
'$item_id' => xmlify($item['uri']),
|
|
||||||
'$title' => xmlify($item['title']),
|
|
||||||
'$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
|
|
||||||
'$content' => xmlify(bbcode($item['body'])),
|
|
||||||
'$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
|
|
||||||
'$location' => xmlify($item['location']),
|
|
||||||
'$coord' => xmlify($item['coord']),
|
|
||||||
'$type' => 'html',
|
|
||||||
'$verb' => xmlify($verb),
|
|
||||||
'$actobj' => $actobj,
|
|
||||||
'$mentioned' => $mentioned,
|
|
||||||
'$parent_id' => xmlify($item['parent-uri']),
|
|
||||||
'$comment_allow' => (($item['last-child']) ? 1 : 0)
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$atom .= '</feed>' . "\r\n";
|
$atom .= '</feed>' . "\r\n";
|
||||||
|
|
||||||
logger('notifier: ' . $atom);
|
logger('notifier: ' . $atom, LOGGER_DATA);
|
||||||
|
|
||||||
logger('notifier: slaps: ' . print_r($slaps,true));
|
logger('notifier: slaps: ' . print_r($slaps,true), LOGGER_DATA);
|
||||||
|
|
||||||
if($followup)
|
if($followup)
|
||||||
$recip_str = $parent['contact-id'];
|
$recip_str = $parent['contact-id'];
|
||||||
|
@ -407,8 +253,8 @@
|
||||||
|
|
||||||
switch($contact['network']) {
|
switch($contact['network']) {
|
||||||
case 'dfrn':
|
case 'dfrn':
|
||||||
|
logger('notifier: dfrndelivery: ' . $contact['name']);
|
||||||
$deliver_status = dfrn_deliver($owner,$contact,$atom);
|
$deliver_status = dfrn_deliver($owner,$contact,$atom);
|
||||||
logger('notifier: delivery: ' . $contact['name']);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if($followup) {
|
if($followup) {
|
||||||
|
@ -420,10 +266,10 @@
|
||||||
// a public hub, it's ok to send a salmon
|
// a public hub, it's ok to send a salmon
|
||||||
|
|
||||||
if(count($slaps) && $notify_hub) {
|
if(count($slaps) && $notify_hub) {
|
||||||
|
logger('notifier: slapdelivery: ' . $contact['name']);
|
||||||
foreach($slaps as $slappy) {
|
foreach($slaps as $slappy) {
|
||||||
slapper($owner,$contact['notify'],$slappy);
|
slapper($owner,$contact['notify'],$slappy);
|
||||||
}
|
}
|
||||||
logger('notifier: slapdelivery: ' . $contact['name']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -441,10 +287,10 @@
|
||||||
|
|
||||||
if(count($slaps) && count($url_recipients) && $notify_hub) {
|
if(count($slaps) && count($url_recipients) && $notify_hub) {
|
||||||
foreach($url_recipients as $url) {
|
foreach($url_recipients as $url) {
|
||||||
|
logger('notifier: urldelivery: ' . $url);
|
||||||
foreach($slaps as $slappy) {
|
foreach($slaps as $slappy) {
|
||||||
slapper($owner,$url,$slappy);
|
slapper($owner,$url,$slappy);
|
||||||
}
|
}
|
||||||
logger('notifier: urldelivery: ' . $url);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,8 @@ function pubsub_post(&$a) {
|
||||||
|
|
||||||
$xml = file_get_contents('php://input');
|
$xml = file_get_contents('php://input');
|
||||||
|
|
||||||
logger('pubsub: feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd . ':' . $xml);
|
logger('pubsub: feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd );
|
||||||
|
logger('pubsub: data: ' . $xml, $LOGGER_DATA);
|
||||||
|
|
||||||
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
|
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
|
||||||
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
$contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
|
||||||
|
|
Loading…
Reference in a new issue