8 require_once('include/salmon.php');
9 require_once('include/crypto.php');
10 require_once('include/diaspora.php');
13 function receive_post(App $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",
37 if (! dbm::is_result($r)) {
38 http_status_exit(500);
44 // It is an application/x-www-form-urlencoded
46 logger('mod-diaspora: receiving post', LOGGER_DEBUG);
48 $xml = urldecode($_POST['xml']);
50 logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
53 http_status_exit(500);
55 logger('mod-diaspora: message is okay', LOGGER_DEBUG);
57 $msg = Diaspora::decode($importer,$xml);
59 logger('mod-diaspora: decoded', LOGGER_DEBUG);
61 logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
64 http_status_exit(500);
66 logger('mod-diaspora: dispatching', LOGGER_DEBUG);
70 Diaspora::dispatch_public($msg);
72 $ret = Diaspora::dispatch($importer,$msg);
75 http_status_exit(($ret) ? $ret : 200);