1
1
Fork 0

New function for generating item URI

This commit is contained in:
Michael 2018-06-16 06:44:19 +00:00
commit 14cb128264
10 changed files with 51 additions and 45 deletions

View file

@ -4599,7 +4599,7 @@ function save_media_to_database($mediatype, $media, $type, $album, $allow_cid, $
function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $filetype, $visibility = false)
{
// get data about the api authenticated user
$uri = item_new_uri(get_app()->get_hostname(), intval(api_user()));
$uri = Item::newURI(intval(api_user()));
$owner_record = q("SELECT * FROM `contact` WHERE `uid`= %d AND `self` LIMIT 1", intval(api_user()));
$arr = [];

View file

@ -462,33 +462,6 @@ function perms2str($p) {
return $ret;
}
/**
* generate a guaranteed unique (for this domain) item ID for ATOM
* safe from birthday paradox
*
* @param string $hostname
* @param int $uid
* @return string
*/
function item_new_uri($hostname, $uid, $guid = "") {
do {
if ($guid == "") {
$hash = get_guid(32);
} else {
$hash = $guid;
$guid = "";
}
$uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash;
$dups = dba::exists('item', ['uri' => $uri]);
} while ($dups == true);
return $uri;
}
/**
* @deprecated
* wrapper to load a view template, checking for alternate