aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/post.php44
-rw-r--r--mod/zentity.php8
-rw-r--r--mod/zregister.php4
3 files changed, 13 insertions, 43 deletions
diff --git a/mod/post.php b/mod/post.php
index 4a7e33b23..c5430d46e 100644
--- a/mod/post.php
+++ b/mod/post.php
@@ -5,47 +5,23 @@
*/
-require_once('include/salmon.php');
-require_once('include/crypto.php');
-// not yet ready for prime time
-//require_once('include/zot.php');
+require_once('include/zot.php');
function post_post(&$a) {
- $bulk_delivery = false;
+ $ret = array('result' => false, 'message' => '');
- if($a->argc == 1) {
- $bulk_delivery = true;
- }
- else {
- $nickname = $a->argv[2];
- $r = q("SELECT * FROM `user` WHERE `nickname` = '%s'
- AND `account_expired` = 0 LIMIT 1",
- dbesc($nickname)
- );
- if(! count($r))
- http_status_exit(500);
-
- $importer = $r[0];
- }
-
- $xml = file_get_contents('php://input');
-
- logger('mod-post: new zot: ' . $xml, LOGGER_DATA);
+ $msgtype = ((x($_REQUEST,'type')) ? $_REQUEST['type'] : '');
- if(! $xml)
- http_status_exit(500);
+ if($msgtype === 'notify') {
- $msg = zot_decode($importer,$xml);
+ // add to receive queue
+ // qreceive_add($_REQUEST);
- logger('mod-post: decoded msg: ' . print_r($msg,true), LOGGER_DATA);
-
- if(! is_array($msg))
- http_status_exit(500);
+ $ret['result'] = true;
+ json_return_and_die($ret);
+ }
- $ret = 0;
- $ret = zot_incoming($bulk_delivery, $importer,$msg);
- http_status_exit(($ret) ? $ret : 200);
- // NOTREACHED
}
+
diff --git a/mod/zentity.php b/mod/zentity.php
index 4963d7190..011ae8e79 100644
--- a/mod/zentity.php
+++ b/mod/zentity.php
@@ -29,9 +29,7 @@ function zentity_init(&$a) {
// fullname plus random number
$test[] = legal_webbie($x) . mt_rand(1000,9999);
- header('content-type: application/json');
- echo json_encode(check_webbie($test));
- killme();
+ json_return_and_die(check_webbie($test));
}
if($cmd === 'checkaddr.json') {
@@ -54,9 +52,7 @@ function zentity_init(&$a) {
//print_r($test);
- header('content-type: application/json');
- echo json_encode(check_webbie($test));
- killme();
+ json_return_and_die(check_webbie($test));
}
diff --git a/mod/zregister.php b/mod/zregister.php
index 7a8d67e78..87a5cff0c 100644
--- a/mod/zregister.php
+++ b/mod/zregister.php
@@ -18,9 +18,7 @@ function zregister_init(&$a) {
if($result['message'])
$result['error'] = true;
- header('content-type: application/json');
- echo json_encode($result);
- killme();
+ json_return_and_die($result);
}
$pw1 = t("Password too short");