]> git.mxchange.org Git - friendica.git/blob - mod/post.php
Bugfix: The user id wasn't fetched correctly.
[friendica.git] / mod / post.php
1 <?php
2
3 /**
4  * Zot endpoint
5  */
6
7
8 require_once('include/salmon.php');
9 require_once('include/crypto.php');
10 // not yet ready for prime time
11 //require_once('include/zot.php');
12         
13 function post_post(&$a) {
14
15         $bulk_delivery = false;
16
17         if($a->argc == 1) {
18                 $bulk_delivery = true;
19         }
20         else {
21                 $nickname = $a->argv[2];
22                 $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' 
23                                 AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
24                         dbesc($nickname)
25                 );
26                 if(! count($r))
27                         http_status_exit(500);
28
29                 $importer = $r[0];
30         }
31
32         $xml = file_get_contents('php://input');
33
34         logger('mod-post: new zot: ' . $xml, LOGGER_DATA);
35
36         if(! $xml)
37                 http_status_exit(500);
38
39         $msg = zot_decode($importer,$xml);
40
41         logger('mod-post: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
42
43         if(! is_array($msg))
44                 http_status_exit(500);
45
46         $ret = 0;
47         $ret = zot_incoming($bulk_delivery, $importer,$msg);
48         http_status_exit(($ret) ? $ret : 200);
49         // NOTREACHED
50 }
51