aboutsummaryrefslogtreecommitdiffstats
path: root/mod/salmon.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-10-06 19:46:44 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-10-06 19:46:44 -0700
commita0ecdd025eadf22142c7ed5018b930127ea10d9f (patch)
tree861eac177aea2bde9a16d3c4d0739a2396d664d8 /mod/salmon.php
parent98ebcada61dd76b0707869ca6e3ee6b16613cadf (diff)
downloadvolse-hubzilla-a0ecdd025eadf22142c7ed5018b930127ea10d9f.tar.gz
volse-hubzilla-a0ecdd025eadf22142c7ed5018b930127ea10d9f.tar.bz2
volse-hubzilla-a0ecdd025eadf22142c7ed5018b930127ea10d9f.zip
infrastructure for salmon
Diffstat (limited to 'mod/salmon.php')
-rw-r--r--mod/salmon.php52
1 files changed, 52 insertions, 0 deletions
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 @@
+<?php
+
+function salmon_return($val) {
+
+ if($val >= 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,'<entry'));
+
+ $xml = $tpl . $base . '</feed>';
+
+salmon_return(500); // until the handler is finished
+
+// consume_salmon($xml,$importer);
+
+ salmon_return(200);
+}
+
+
+