From a0ecdd025eadf22142c7ed5018b930127ea10d9f Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Wed, 6 Oct 2010 19:46:44 -0700 Subject: infrastructure for salmon --- mod/pubsub.php | 2 +- mod/salmon.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ mod/xrd.php | 3 ++- 3 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 mod/salmon.php (limited to 'mod') diff --git a/mod/pubsub.php b/mod/pubsub.php index 1feb80031..7dea2afb1 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -87,7 +87,7 @@ function pubsub_post(&$a) { $debugging = get_config('system','debugging'); if($debugging) - file_put_contents('pubsub.out',$xml); + file_put_contents('pubsub.out',$xml,FILE_APPEND); $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : ''); $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0); diff --git a/mod/salmon.php b/mod/salmon.php new file mode 100644 index 000000000..d68c74658 --- /dev/null +++ b/mod/salmon.php @@ -0,0 +1,52 @@ += 500) + $err = 'Error'; + if($val == 200) + $err = 'OK'; + + header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err); + killme(); + +} + +function salmon_post(&$a) { + + $xml = file_get_contents('php://input'); + + $debugging = get_config('system','debugging'); + if($debugging) + file_put_contents('salmon.out',$xml,FILE_APPEND); + + $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : ''); + $mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false); + + $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", + dbesc($nick) + ); + if(! count($r)) + salmon_return(500); + + $importer = $r[0]; + + require_once('include/items.php'); + + // Create a fake feed wrapper so simplepie doesn't choke + + $tpl = load_view_file('view/atom_feed.tpl'); + + $base = substr($xml,strpos($xml,''; + +salmon_return(500); // until the handler is finished + +// consume_salmon($xml,$importer); + + salmon_return(200); +} + + + diff --git a/mod/xrd.php b/mod/xrd.php index e60fda48d..d36b47519 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -21,7 +21,8 @@ function xrd_content(&$a) { $o = replace_macros($tpl, array( '$accturi' => $uri, '$profile_url' => $a->get_baseurl() . '/profile/' . $r[0]['nickname'], - '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] + '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'], + '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention' )); echo $o; -- cgit v1.2.3