From: Michael Vogel Date: Thu, 13 Aug 2015 22:40:36 +0000 (+0200) Subject: For unique values we should use our guid function - not the random function X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a2d742ec911291bdc3878aafd00c19d27327cb3f;p=friendica.git For unique values we should use our guid function - not the random function --- diff --git a/include/items.php b/include/items.php index 848c21df36..eaa0565467 100644 --- a/include/items.php +++ b/include/items.php @@ -2968,7 +2968,7 @@ function item_is_remote_self($contact, &$datarray) { if ($contact['network'] != NETWORK_FEED) { $datarray["guid"] = get_guid(32); unset($datarray["plink"]); - $datarray["uri"] = item_new_uri($a->get_hostname(),$contact['uid']); + $datarray["uri"] = item_new_uri($a->get_hostname(),$contact['uid'], $datarray["guid"]); $datarray["parent-uri"] = $datarray["uri"]; $datarray["extid"] = $contact['network']; $urlpart = parse_url($datarray2['author-link']); diff --git a/include/text.php b/include/text.php index 18ce232f1d..285c674d70 100644 --- a/include/text.php +++ b/include/text.php @@ -470,11 +470,17 @@ if(! function_exists('item_new_uri')) { * @param int $uid * @return string */ -function item_new_uri($hostname,$uid) { +function item_new_uri($hostname,$uid, $guid = "") { do { $dups = false; - $hash = random_string(); + + if ($guid == "") + $hash = get_guid(32); + else { + $hash = $guid; + $guid = ""; + } $uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash; diff --git a/mod/item.php b/mod/item.php index a5f483b352..d203ce64d4 100644 --- a/mod/item.php +++ b/mod/item.php @@ -674,7 +674,7 @@ function item_post(&$a) { $notify_type = (($parent) ? 'comment-new' : 'wall-new' ); - $uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid)); + $uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid)); // Fallback so that we alway have a thr-parent if(!$thr_parent)