From 4674d09b29dfff124a145e2eca3edfc175de1e29 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 26 Dec 2018 11:00:36 +0000 Subject: [PATCH 1/2] Solves PHP warning "Use of undefined constant" --- jappixmini/jappixmini.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index e2ef01d2..0ef56aed 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -203,8 +203,8 @@ function jappixmini_init() killme(); } - $encrypt_func = openssl_public_encrypt; - $decrypt_func = openssl_public_decrypt; + $encrypt_func = 'openssl_public_encrypt'; + $decrypt_func = 'openssl_public_decrypt'; $key = $r[0]["pubkey"]; } else if ($role == "prv") { $r = q("SELECT * FROM `contact` WHERE LENGTH(`prvkey`) AND `issued-id`='%s' LIMIT 1", DBA::escape($dfrn_id)); @@ -212,8 +212,8 @@ function jappixmini_init() killme(); } - $encrypt_func = openssl_private_encrypt; - $decrypt_func = openssl_private_decrypt; + $encrypt_func = 'openssl_private_encrypt'; + $decrypt_func = 'openssl_private_decrypt'; $key = $r[0]["prvkey"]; } else { killme(); @@ -606,14 +606,14 @@ function jappixmini_cron(App $a, $d) $dfrn_id = $contact_row["dfrn-id"]; if ($dfrn_id) { $key = $contact_row["pubkey"]; - $encrypt_func = openssl_public_encrypt; - $decrypt_func = openssl_public_decrypt; + $encrypt_func = 'openssl_public_encrypt'; + $decrypt_func = 'openssl_public_decrypt'; $role = "prv"; } else { $dfrn_id = $contact_row["issued-id"]; $key = $contact_row["prvkey"]; - $encrypt_func = openssl_private_encrypt; - $decrypt_func = openssl_private_decrypt; + $encrypt_func = 'openssl_private_encrypt'; + $decrypt_func = 'openssl_private_decrypt'; $role = "pub"; } From 20d9884b730964cef260249242b56e69f88720a8 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 26 Dec 2018 11:04:29 +0000 Subject: [PATCH 2/2] Fixes "Trying to get property 'status' of non-object" --- jappixmini/jappixmini.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 0ef56aed..28e238db 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -666,7 +666,7 @@ function jappixmini_cron(App $a, $d) // parse answer $answer = json_decode($answer_json); - if ($answer->status != "ok") { + if (empty($answer->status) || ($answer->status != "ok")) { throw new Exception(); }