]> git.mxchange.org Git - friendica.git/blobdiff - mod/receive.php
Merge pull request #3706 from annando/network-page
[friendica.git] / mod / receive.php
index 15c9f1d412796b1de5e2cd08664bdb36dba59d15..8b28c1656225cc60dba12e6c0a38c6b9c45f528a 100644 (file)
@@ -4,12 +4,12 @@
  * Diaspora endpoint
  */
 
+use Friendica\App;
 
 require_once('include/salmon.php');
 require_once('include/crypto.php');
 require_once('include/diaspora.php');
 
-
 function receive_post(App $a) {
        $enabled = intval(get_config('system', 'diaspora_enabled'));
        if (!$enabled) {
@@ -28,14 +28,10 @@ function receive_post(App $a) {
                }
                $guid = $a->argv[2];
 
-               $r = q("SELECT * FROM `user` WHERE `guid` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
-                       dbesc($guid)
-               );
-               if (!dbm::is_result($r)) {
+               $importer = dba::select('user', array(), array('guid' => $guid, 'account_expired' => false, 'account_removed' => false), array('limit' => 1));
+               if (!dbm::is_result($importer)) {
                        http_status_exit(500);
                }
-
-               $importer = $r[0];
        }
 
        // It is an application/x-www-form-urlencoded
@@ -67,14 +63,14 @@ function receive_post(App $a) {
 
        logger('mod-diaspora: dispatching', LOGGER_DEBUG);
 
-       $ret = 0;
+       $ret = true;
        if ($public) {
                Diaspora::dispatch_public($msg);
        } else {
                $ret = Diaspora::dispatch($importer, $msg);
        }
 
-       http_status_exit(($ret) ? $ret : 200);
+       http_status_exit(($ret) ? 200 : 500);
        // NOTREACHED
 }