]> git.mxchange.org Git - friendica.git/commitdiff
remove possibly unnecessary checks for likes or comments created by Diaspora users
authorZach Prezkuta <fermion@gmx.com>
Sat, 23 Jun 2012 18:40:53 +0000 (12:40 -0600)
committerZach Prezkuta <fermion@gmx.com>
Tue, 26 Jun 2012 01:03:03 +0000 (19:03 -0600)
mod/item.php
mod/like.php

index 000f466446969e8b14531b7b92cd127d7864cece..aa022d37d8eda0387476e90ebdfe62caca12e8d7 100644 (file)
@@ -1040,15 +1040,15 @@ function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item,
        $signed_body = html_entity_decode(bb2diaspora($datarray['body']));
 
 //     $myaddr = $user['nickname'] . '@' . substr($baseurl, strpos($baseurl,'://') + 3);
-       if( $author['network'] === NETWORK_DIASPORA)
-               $diaspora_handle = $author['addr'];
-       else {
-               // Only works for NETWORK_DFRN
-               $contact_baseurl_start = strpos($author['url'],'://') + 3;
-               $contact_baseurl_length = strpos($author['url'],'/profile') - $contact_baseurl_start;
-               $contact_baseurl = substr($author['url'], $contact_baseurl_start, $contact_baseurl_length);
-               $diaspora_handle = $author['nick'] . '@' . $contact_baseurl;
-       }
+//     if( $author['network'] === NETWORK_DIASPORA)
+//             $diaspora_handle = $author['addr'];
+//     else {
+       // Only works for NETWORK_DFRN
+       $contact_baseurl_start = strpos($author['url'],'://') + 3;
+       $contact_baseurl_length = strpos($author['url'],'/profile') - $contact_baseurl_start;
+       $contact_baseurl = substr($author['url'], $contact_baseurl_start, $contact_baseurl_length);
+       $diaspora_handle = $author['nick'] . '@' . $contact_baseurl;
+//     }
 
        $signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $diaspora_handle;
 
index dce40a68e121b20d005ba6b805a2ba421510597a..1176c31101000390043e8da0e441bfede9d1c3cf 100755 (executable)
@@ -245,30 +245,30 @@ function store_diaspora_like_retract_sig($activity, $item, $like_item, $contact)
        if(($activity === ACTIVITY_LIKE) && (! $item['resource-id'])) {
                $signed_text = $like_item['guid'] . ';' . 'Like';
 
-               if( $contact['network'] === NETWORK_DIASPORA)
-                       $diaspora_handle = $contact['addr'];
-               else {
-                       // Only works for NETWORK_DFRN
-                       $contact_baseurl_start = strpos($contact['url'],'://') + 3;
-                       $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
-                       $contact_baseurl = substr($contact['url'], $contact_baseurl_start, $contact_baseurl_length);
-                       $diaspora_handle = $contact['nick'] . '@' . $contact_baseurl;
-
-                       // Get contact's private key if he's a user of the local Friendica server
-                       $r = q("SELECT `contact`.`uid` FROM `contact` WHERE `url` = '%s' AND `self` = 1 LIMIT 1",
-                               dbesc($contact['url'])
-                       );
+//             if( $contact['network'] === NETWORK_DIASPORA)
+//                     $diaspora_handle = $contact['addr'];
+//             else {
+               // Only works for NETWORK_DFRN
+               $contact_baseurl_start = strpos($contact['url'],'://') + 3;
+               $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
+               $contact_baseurl = substr($contact['url'], $contact_baseurl_start, $contact_baseurl_length);
+               $diaspora_handle = $contact['nick'] . '@' . $contact_baseurl;
+
+               // Get contact's private key if he's a user of the local Friendica server
+               $r = q("SELECT `contact`.`uid` FROM `contact` WHERE `url` = '%s' AND `self` = 1 LIMIT 1",
+                       dbesc($contact['url'])
+               );
 
-                       if( $r) {
-                               $contact_uid = $r['uid'];
-                               $r = q("SELECT prvkey FROM user WHERE uid = %d LIMIT 1",
-                                       intval($contact_uid)
-                               );
+               if( $r) {
+                       $contact_uid = $r['uid'];
+                       $r = q("SELECT prvkey FROM user WHERE uid = %d LIMIT 1",
+                               intval($contact_uid)
+                       );
 
-                               if( $r)
-                                       $authorsig = base64_encode(rsa_sign($signed_text,$r['prvkey'],'sha256'));
-                       }
+                       if( $r)
+                               $authorsig = base64_encode(rsa_sign($signed_text,$r['prvkey'],'sha256'));
                }
+//             }
 
                if(! isset($authorsig))
                        $authorsig = '';
@@ -299,30 +299,30 @@ function store_diaspora_like_sig($activity, $post_type, $contact, $post_id) {
        logger('mod_like: storing diaspora like signature');
 
        if(($activity === ACTIVITY_LIKE) && ($post_type === t('status'))) {
-               if( $contact['network'] === NETWORK_DIASPORA)
-                       $diaspora_handle = $contact['addr'];
-               else {
-                       // Only works for NETWORK_DFRN
-                       $contact_baseurl_start = strpos($contact['url'],'://') + 3;
-                       $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
-                       $contact_baseurl = substr($contact['url'], $contact_baseurl_start, $contact_baseurl_length);
-                       $diaspora_handle = $contact['nick'] . '@' . $contact_baseurl;
-
-                       // Get contact's private key if he's a user of the local Friendica server
-                       $r = q("SELECT `contact`.`uid` FROM `contact` WHERE `url` = '%s' AND `self` = 1 LIMIT 1",
-                               dbesc($contact['url'])
-                       );
+//             if( $contact['network'] === NETWORK_DIASPORA)
+//                     $diaspora_handle = $contact['addr'];
+//             else {
+               // Only works for NETWORK_DFRN
+               $contact_baseurl_start = strpos($contact['url'],'://') + 3;
+               $contact_baseurl_length = strpos($contact['url'],'/profile') - $contact_baseurl_start;
+               $contact_baseurl = substr($contact['url'], $contact_baseurl_start, $contact_baseurl_length);
+               $diaspora_handle = $contact['nick'] . '@' . $contact_baseurl;
+
+               // Get contact's private key if he's a user of the local Friendica server
+               $r = q("SELECT `contact`.`uid` FROM `contact` WHERE `url` = '%s' AND `self` = 1 LIMIT 1",
+                       dbesc($contact['url'])
+               );
 
-                       if( $r) {
-                               $contact_uid = $r['uid'];
-                               $r = q("SELECT prvkey FROM user WHERE uid = %d LIMIT 1",
-                                       intval($contact_uid)
-                               );
+               if( $r) {
+                       $contact_uid = $r['uid'];
+                       $r = q("SELECT prvkey FROM user WHERE uid = %d LIMIT 1",
+                               intval($contact_uid)
+                       );
 
-                               if( $r)
-                                       $contact_uprvkey = $r['prvkey'];
-                       }
+                       if( $r)
+                               $contact_uprvkey = $r['prvkey'];
                }
+//             }
 
                $r = q("SELECT guid, parent FROM `item` WHERE id = %d LIMIT 1",
                        intval($post_id)