Standards

This commit is contained in:
Michael 2018-01-21 00:18:31 +00:00
parent efa8dbcfb3
commit 004f46e600
3 changed files with 7 additions and 7 deletions

View File

@ -322,13 +322,13 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
$arr['protocol'] = PROTOCOL_DFRN; $arr['protocol'] = PROTOCOL_DFRN;
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri. // We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
// In difference to the call to "Item::GuidFromUri" several lines below we add the hash of our own host. // In difference to the call to "Item::guidFromUri" several lines below we add the hash of our own host.
// This is done because our host is the original creator of the post. // This is done because our host is the original creator of the post.
if (!isset($arr['guid'])) { if (!isset($arr['guid'])) {
if (isset($arr['plink'])) { if (isset($arr['plink'])) {
$arr['guid'] = Item::GuidFromUri($arr['plink'], $a->get_hostname()); $arr['guid'] = Item::guidFromUri($arr['plink'], $a->get_hostname());
} elseif (isset($arr['uri'])) { } elseif (isset($arr['uri'])) {
$arr['guid'] = Item::GuidFromUri($arr['uri'], $a->get_hostname()); $arr['guid'] = Item::guidFromUri($arr['uri'], $a->get_hostname());
} }
} }
} else { } else {
@ -338,9 +338,9 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
if ($notify) { if ($notify) {
$guid_prefix = ""; $guid_prefix = "";
} elseif ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) { } elseif ((trim($arr['guid']) == "") && (trim($arr['plink']) != "")) {
$arr['guid'] = Item::GuidFromUri($arr['plink']); $arr['guid'] = Item::guidFromUri($arr['plink']);
} elseif ((trim($arr['guid']) == "") && (trim($arr['uri']) != "")) { } elseif ((trim($arr['guid']) == "") && (trim($arr['uri']) != "")) {
$arr['guid'] = Item::GuidFromUri($arr['uri']); $arr['guid'] = Item::guidFromUri($arr['uri']);
} else { } else {
$parsed = parse_url($arr["author-link"]); $parsed = parse_url($arr["author-link"]);
$guid_prefix = hash("crc32", $parsed["host"]); $guid_prefix = hash("crc32", $parsed["host"]);

View File

@ -338,7 +338,7 @@ class Item
* @param string $host (Optional) hostname for the GUID prefix * @param string $host (Optional) hostname for the GUID prefix
* @return string unique guid * @return string unique guid
*/ */
public static function GuidFromUri($uri, $host = "") public static function guidFromUri($uri, $host = "")
{ {
// Our regular guid routine is using this kind of prefix as well // Our regular guid routine is using this kind of prefix as well
// We have to avoid that different routines could accidentally create the same value // We have to avoid that different routines could accidentally create the same value

View File

@ -427,7 +427,7 @@ class Feed {
// Distributed items should have a well formatted URI. // Distributed items should have a well formatted URI.
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items. // Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
if ($notify) { if ($notify) {
$item['guid'] = Item::GuidFromUri($orig_plink, $a->get_hostname()); $item['guid'] = Item::guidFromUri($orig_plink, $a->get_hostname());
unset($item['uri']); unset($item['uri']);
unset($item['parent-uri']); unset($item['parent-uri']);
} }