]> git.mxchange.org Git - friendica.git/commitdiff
don't allow removal of self contact
authorFriendika <info@friendika.com>
Fri, 19 Aug 2011 12:20:30 +0000 (05:20 -0700)
committerFriendika <info@friendika.com>
Fri, 19 Aug 2011 12:20:30 +0000 (05:20 -0700)
include/diaspora.php
mod/contacts.php

index 0be2392d17d3a57149c16f6115e73a2651ff6816..b14c38f1d3bcaf839235c9b819aeaa20d46f63b9 100644 (file)
@@ -789,9 +789,10 @@ function diaspora_share($me,$contact) {
        $myaddr = $me['nickname'] . '@' .  substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
        $theiraddr = $contact['addr'];
 
+logger('diaspora_share: contact: ' . print_r($contact,true), LOGGER_DATA);
        $tpl = get_markup_template('diaspora_share.tpl');
        $msg = replace_macros($tpl, array(
-               '$sender' => myaddr,
+               '$sender' => $myaddr,
                '$recipient' => $theiraddr
        ));
 
index f130b74c04a5cad21f34255746787600cfe04e09..efb0dc75b2b22e51a105c7e0d73d77767f67e1d8 100644 (file)
@@ -141,7 +141,7 @@ function contacts_content(&$a) {
 
                $cmd = $a->argv[2];
 
-               $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+               $orig_record = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1",
                        intval($contact_id),
                        intval(local_user())
                );
@@ -222,7 +222,7 @@ function contacts_content(&$a) {
                        }
 
 
-                       contact_remove($contact_id);
+                       contact_remove($orig_record[0]['id']);
                        info( t('Contact has been removed.') . EOL );
                        goaway($a->get_baseurl() . '/contacts');
                        return; // NOTREACHED