]> git.mxchange.org Git - friendica.git/blobdiff - include/Contact.php
dont use the entire url as option
[friendica.git] / include / Contact.php
index 8b575bf122bfba5f8c8cc887e01eeeca65600823..8be873bd3089533d01eafe7aa3230befcc7a9940 100644 (file)
@@ -155,7 +155,7 @@ function mark_for_death($contact) {
 
 function unmark_for_death($contact) {
 
-       $r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND `term-date` > '%s'",
+       $r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND (`term-date` > '%s' OR `archive`)",
                intval($contact['id']),
                dbesc('1000-00-00 00:00:00')
        );
@@ -166,16 +166,11 @@ function unmark_for_death($contact) {
        }
 
        // It's a miracle. Our dead contact has inexplicably come back to life.
-       q("UPDATE `contact` SET `term-date` = '%s' WHERE `id` = %d",
-               dbesc(NULL_DATE),
-               intval($contact['id'])
-       );
+       $fields = array('term-date' => NULL_DATE, 'archive' => false);
+       dba::update('contact', $fields, array('id' => $contact['id']));
 
        if ($contact['url'] != '') {
-               q("UPDATE `contact` SET `term-date` = '%s' WHERE `nurl` = '%s'",
-                       dbesc(NULL_DATE),
-                       dbesc(normalise_link($contact['url']))
-               );
+               dba::update('contact', $fields, array('nurl' => normalise_link($contact['url'])));
        }
 }
 
@@ -808,7 +803,7 @@ function posts_from_contact_url(App $a, $contact_url) {
 
        $author_id = intval($r[0]["author-id"]);
 
-       $contact = ($r[0]["contact-type"] = ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
+       $contact = ($r[0]["contact-type"] == ACCOUNT_TYPE_COMMUNITY ? 'owner-id' : 'author-id');
 
        $r = q(item_query()." AND `item`.`".$contact."` = %d AND ".$sql.
                " ORDER BY `item`.`created` DESC LIMIT %d, %d",