8 require_once('include/salmon.php');
9 require_once('include/crypto.php');
10 require_once('include/diaspora.php');
13 function receive_post(&$a) {
16 $enabled = intval(get_config('system','diaspora_enabled'));
18 logger('mod-diaspora: disabled');
19 http_status_exit(500);
24 if(($a->argc == 2) && ($a->argv[1] === 'public')) {
29 if($a->argc != 3 || $a->argv[1] !== 'users')
30 http_status_exit(500);
34 $r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
38 http_status_exit(500);
43 // It is an application/x-www-form-urlencoded
45 $xml = urldecode($_POST['xml']);
47 logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
50 http_status_exit(500);
52 $msg = diaspora_decode($importer,$xml);
54 logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
57 http_status_exit(500);
61 diaspora_dispatch_public($msg);
63 $ret = diaspora_dispatch($importer,$msg);
65 http_status_exit(($ret) ? $ret : 200);