]> git.mxchange.org Git - friendica.git/commitdiff
Check all keys before use
authorFriendika <info@friendika.com>
Mon, 19 Sep 2011 10:30:59 +0000 (03:30 -0700)
committerFriendika <info@friendika.com>
Mon, 19 Sep 2011 10:30:59 +0000 (03:30 -0700)
include/conversation.php
mod/dfrn_notify.php

index 4398d6a5c126183ff0ef9084cc7c5f8122514394..7cea54db5c5515e41f39559915d81469f52871f0 100644 (file)
@@ -485,6 +485,7 @@ function conversation(&$a, $items, $mode, $update) {
 
 
                        $tmp_item = replace_macros($template,array(
+                               '$body' => $body,
                                '$id' => $item['item_id'],
                                '$linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['author-link'])) ? $item['author-link'] : $item['url'])),
                                '$olinktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, ((strlen($item['owner-link'])) ? $item['owner-link'] : $item['url'])),
@@ -498,7 +499,6 @@ function conversation(&$a, $items, $mode, $update) {
                                '$osparkle' => $osparkle,
                                '$sparkle' => $sparkle,
                                '$title' => $item['title'],
-                               '$body' => $body,
                                '$ago' => ((($item['app']) && ($item['id'] == $item['parent'])) ? sprintf( t('%s from %s'),relative_date($item['created']),$item['app']) : relative_date($item['created'])),
                                '$lock' => $lock,
                                '$location' => $location,
@@ -514,6 +514,7 @@ function conversation(&$a, $items, $mode, $update) {
                                '$like' => $like,
                                '$dislike' => $dislike,
                                '$comment' => $comment
+
                        ));
 
 
index d174c87ee681bdc35181cb17569ef477b7e20329..bd665c208b82592b424330e50ab86fb7445a37de 100644 (file)
@@ -807,7 +807,7 @@ function dfrn_notify_content(&$a) {
                        intval(time() + 90 )
                );
 
-               logger('dfrn_notify: challenge=' . $hash );
+               logger('dfrn_notify: challenge=' . $hash, LOGGER_DEBUG );
 
                $sql_extra = '';
                switch($direction) {
@@ -841,14 +841,18 @@ function dfrn_notify_content(&$a) {
                $encrypted_id = '';
                $id_str = $my_id . '.' . mt_rand(1000,9999);
 
-               if((($r[0]['duplex']) && strlen($r[0]['prvkey'])) || (! strlen($r[0]['pubkey']))) {
-                       openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
-                       openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
-               }
-               else {
-                       openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
-                       openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
+               if(strlen($r[0]['prvkey']) || strlen($r[0]['pubkey'])) {
+                       if(($r[0]['duplex']) || (! strlen($r[0]['pubkey']))) {
+                               openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
+                               openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
+                       }
+                       else {
+                               openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
+                               openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
+                       }
                }
+               else
+                       $status = 1;
 
                $challenge    = bin2hex($challenge);
                $encrypted_id = bin2hex($encrypted_id);