Browse Source

For unique values we should use our guid function - not the random function

pull/1820/head
Michael Vogel 6 years ago
parent
commit
a2d742ec91
3 changed files with 10 additions and 4 deletions
  1. +1
    -1
      include/items.php
  2. +8
    -2
      include/text.php
  3. +1
    -1
      mod/item.php

+ 1
- 1
include/items.php View File

@ -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']);


+ 8
- 2
include/text.php View File

@ -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;


+ 1
- 1
mod/item.php View File

@ -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)


Loading…
Cancel
Save