X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FContact.php;h=920ec3c2b406f91054815e6927a09734a5c1106d;hb=2e8caf7f27197be5f12ea22f4a5e9aae2bb1ee89;hp=103dbe9addf31df4adc1496edca59bd6995d762f;hpb=2dd8db7de880794db10664965713f8a46581bd7a;p=friendica.git diff --git a/include/Contact.php b/include/Contact.php index 103dbe9add..920ec3c2b4 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -113,7 +113,7 @@ function terminate_friendship($user,$self,$contact) { '$photo' => $self['photo'], '$thumb' => $self['thumb'], '$published' => datetime_convert('UTC','UTC', 'now', ATOM_TIME), - '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':unfollow:' . random_string(), + '$item_id' => 'urn:X-dfrn:' . $a->get_hostname() . ':unfollow:' . get_guid(32), '$title' => '', '$type' => 'text', '$content' => t('stopped following'), @@ -267,7 +267,12 @@ function contact_photo_menu($contact) { function random_profile() { - $r = q("select url from gcontact where url like '%%://%%/profile/%%' order by rand() limit 1"); + $r = q("SELECT `url` FROM `gcontact` WHERE `network` = '%s' + AND `last_contact` >= `last_failure` + AND `updated` > UTC_TIMESTAMP - INTERVAL 1 MONTH + ORDER BY rand() LIMIT 1", + dbesc(NETWORK_DFRN)); + if(count($r)) return dirname($r[0]['url']); return '';