]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_notify.php
Bugfix Diaspora: We exited with the wrong return values and the guid for messages...
[friendica.git] / mod / dfrn_notify.php
index 84d589a217f732a38a33ac54a99a7ce324fea634..44e016599e486862c0d4493499ba10e331838e33 100644 (file)
@@ -5,6 +5,9 @@
  * @brief The dfrn notify endpoint
  * @see PDF with dfrn specs: https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
  */
+
+use Friendica\App;
+
 require_once('include/items.php');
 require_once('include/dfrn.php');
 require_once('include/event.php');
@@ -138,10 +141,6 @@ function dfrn_notify_post(App $a) {
 
        $rino = get_config('system', 'rino_encrypt');
        $rino = intval($rino);
-       // use RINO1 if mcrypt isn't installed and RINO2 was selected
-       if ($rino == 2 && !function_exists('mcrypt_create_iv')) {
-               $rino = 1;
-       }
 
        logger("Local rino version: " .  $rino, LOGGER_DEBUG);
 
@@ -160,15 +159,15 @@ function dfrn_notify_post(App $a) {
 
                if ($dfrn_version >= 2.1) {
                        if ((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
-                               openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
+                               openssl_private_decrypt($rawkey, $final_key, $importer['cprvkey']);
                        } else {
-                               openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
+                               openssl_public_decrypt($rawkey, $final_key, $importer['cpubkey']);
                        }
                } else {
                        if ((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) {
-                               openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']);
+                               openssl_public_decrypt($rawkey, $final_key, $importer['cpubkey']);
                        } else {
-                               openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
+                               openssl_private_decrypt($rawkey, $final_key, $importer['cprvkey']);
                        }
                }
 
@@ -178,14 +177,14 @@ function dfrn_notify_post(App $a) {
                        case 0:
                        case 1:
                                /*
-                                * we got a key. old code send only the key, without RINO version.
+                                *we got a key. old code send only the key, without RINO version.
                                 * we assume RINO 1 if key and no RINO version
                                 */
-                               $data = aes_decrypt(hex2bin($data),$final_key);
+                               $data = dfrn::aes_decrypt(hex2bin($data), $final_key);
                                break;
                        case 2:
                                try {
-                                       $data = Crypto::decrypt(hex2bin($data),$final_key);
+                                       $data = Crypto::decrypt(hex2bin($data), $final_key);
                                } catch (InvalidCiphertext $ex) { // VERY IMPORTANT
                                        /*
                                         * Either:
@@ -195,13 +194,13 @@ function dfrn_notify_post(App $a) {
                                         * Assume the worst.
                                         */
                                        logger('The ciphertext has been tampered with!');
-                                       xml_status(0,'The ciphertext has been tampered with!');
+                                       xml_status(0, 'The ciphertext has been tampered with!');
                                } catch (Ex\CryptoTestFailed $ex) {
                                        logger('Cannot safely perform dencryption');
-                                       xml_status(0,'CryptoTestFailed');
+                                       xml_status(0, 'CryptoTestFailed');
                                } catch (Ex\CannotPerformOperation $ex) {
                                        logger('Cannot safely perform decryption');
-                                       xml_status(0,'Cannot safely perform decryption');
+                                       xml_status(0, 'Cannot safely perform decryption');
                                }
                                break;
                        default:
@@ -314,12 +313,8 @@ function dfrn_notify_content(App $a) {
                $encrypted_id = bin2hex($encrypted_id);
 
 
-               $rino = get_config('system','rino_encrypt');
+               $rino = get_config('system', 'rino_encrypt');
                $rino = intval($rino);
-               // use RINO1 if mcrypt isn't installed and RINO2 was selected
-               if ($rino == 2 && !function_exists('mcrypt_create_iv')) {
-                       $rino = 1;
-               }
 
                logger("Local rino version: ". $rino, LOGGER_DEBUG);