X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FContact.php;h=8be873bd3089533d01eafe7aa3230befcc7a9940;hb=143e7fc6b707f377d383a498999ce712d04dd102;hp=8b575bf122bfba5f8c8cc887e01eeeca65600823;hpb=c2472d9981d4f768325ee69f5db681ce9cedba55;p=friendica.git diff --git a/include/Contact.php b/include/Contact.php index 8b575bf122..8be873bd30 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -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",