From: Michael Vogel Date: Sat, 13 Jun 2015 07:59:17 +0000 (+0200) Subject: Send poco data in the atom entries. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e0147a24ad6adfb0b17db97108c9fc24018dff85;p=friendica.git Send poco data in the atom entries. --- diff --git a/include/items.php b/include/items.php index e483fcb7f7..fa370c82a8 100644 --- a/include/items.php +++ b/include/items.php @@ -2239,6 +2239,10 @@ function edited_timestamp_is_newer($existing, $update) { function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) { if ($contact['network'] === NETWORK_OSTATUS) { if ($pass < 2) { + // Test - remove before flight + //$tempfile = tempnam(get_temppath(), "ostatus"); + //file_put_contents($tempfile, $xml); + logger("Consume OStatus messages ", LOGGER_DEBUG); ostatus_import($xml,$importer,$contact, $hub); } @@ -2253,12 +2257,6 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) return; } - // Test - remove before flight -// if ($contact['network'] === NETWORK_OSTATUS) { -// $tempfile = tempnam(get_temppath(), "ostatus"); -// file_put_contents($tempfile, $xml); -// } - $feed = new SimplePie(); $feed->set_raw_data($xml); if($datedir) @@ -4318,10 +4316,48 @@ function atom_author($tag,$name,$uri,$h,$w,$photo) { $o .= "<$tag>\r\n"; - $o .= "$name\r\n"; - $o .= "$uri\r\n"; - $o .= '' . "\r\n"; - $o .= '' . "\r\n"; + $o .= "\t$name\r\n"; + $o .= "\t$uri\r\n"; + $o .= "\t".'' . "\r\n"; + $o .= "\t".'' . "\r\n"; + + if ($tag == "author") { + $r = q("SELECT `profile`.`locality`, `profile`.`region`, `profile`.`country-name`, + `profile`.`name`, `profile`.`pub_keywords`, `profile`.`about`, + `profile`.`homepage`,`contact`.`nick` FROM `profile` + INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid` + INNER JOIN `user` ON `user`.`uid` = `profile`.`uid` + WHERE `profile`.`is-default` AND `contact`.`self` AND + NOT `user`.`hidewall` AND `contact`.`nurl`='%s'", + dbesc(normalise_link($uri))); + if ($r) { + $location = ''; + if($r[0]['locality']) + $location .= $r[0]['locality']; + if($r[0]['region']) { + if($location) + $location .= ', '; + $location .= $r[0]['region']; + } + if($r[0]['country-name']) { + if($location) + $location .= ', '; + $location .= $r[0]['country-name']; + } + + $o .= "\t".xmlify($r[0]["nick"])."\r\n"; + $o .= "\t".xmlify($r[0]["name"])."\r\n"; + $o .= "\t".xmlify($r[0]["about"])."\r\n"; + $o .= "\t\r\n"; + $o .= "\t\t".xmlify($location)."\r\n"; + $o .= "\t\r\n"; + $o .= "\t\r\n"; + $o .= "\thomepage\r\n"; + $o .= "\t\t".xmlify($r[0]["homepage"])."\r\n"; + $o .= "\t\ttrue\r\n"; + $o .= "\t\r\n"; + } + } call_hooks('atom_author', $o); @@ -4377,6 +4413,8 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { $o .= '' . "\r\n"; + $o .= ''."\r\n"; + if($comment) $o .= '' . intval($item['last-child']) . '' . "\r\n"; @@ -4423,9 +4461,11 @@ function atom_entry($item,$type,$author,$owner,$comment = false,$cid = 0) { $o .= '' . "\r\n"; } + // To-Do: + // To support these elements, the API needs to be enhanced //$o .= ''."\r\n"; - //$o .= ''."\r\n"; - //$o .= ''."\r\n"; + //$o .= "\t".''."\r\n"; + //$o .= "\t".''."\r\n"; $o .= item_get_attachment($item);