]> git.mxchange.org Git - friendica.git/commitdiff
backward compatibility
authorFriendika <info@friendika.com>
Wed, 2 Feb 2011 06:45:46 +0000 (22:45 -0800)
committerFriendika <info@friendika.com>
Wed, 2 Feb 2011 06:45:46 +0000 (22:45 -0800)
include/items.php
mod/dfrn_notify.php

index f909fde6ad8760540aed9728324754df528ca50e..0c9d54a330ac58e3ec9f5166c71fb61a73664e86 100644 (file)
@@ -813,28 +813,16 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
 
        $final_dfrn_id = '';
 
-       if($dfrn_version > 2.1) {
-               if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
-                       openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
-                       openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
-               }
-               else {
-                       openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
-                       openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
-               }
+
+       if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+               openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
+               openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
        }
        else {
-               if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
-                       openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
-                       openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
-               }
-               else {
-                       openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
-                       openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
-               }
+               openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
+               openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
        }
 
-
        $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
 
        if(strpos($final_dfrn_id,':') == 1)
@@ -868,12 +856,21 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
                logger('rino: sent key = ' . $key);     
 
 
-       
-               if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
-                       openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+               if($dfrn_version >= 2.1) {      
+                       if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+                               openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+                       }
+                       else {
+                               openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+                       }
                }
                else {
-                       openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+                       if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+                               openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+                       }
+                       else {
+                               openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+                       }
                }
 
                logger('md5 rawkey ' . md5($postvars['key']));
index 1eb2ff725a2174db48a38c234c38085e95b8b9dd..cad7f9563772be33a7531a55738d8d7d65d278db 100644 (file)
@@ -91,7 +91,7 @@ function dfrn_notify_post(&$a) {
                logger('rino: md5 raw key: ' . md5($rawkey));
                $final_key = '';
 
-               if($dfrn_version > 2.1) {
+               if($dfrn_version >= 2.1) {
                        if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) {
                                openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']);
                        }