X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=cc03a776462d1165f83e1bbc512bc9d89a564858;hb=bc92b922b45eb8da9d03f4a4d276a0ef706cf3e8;hp=45d25e379f84713931de7ba41653b6a2c826a681;hpb=fcb3cbffe41a1cdd090a864bb2a918895e8f34e6;p=friendica.git diff --git a/include/items.php b/include/items.php index 45d25e379f..cc03a77646 100644 --- a/include/items.php +++ b/include/items.php @@ -969,7 +969,7 @@ function query_page_info($url, $no_photos = false, $photo = "", $keywords = fals $data = Cache::get("parse_url:".$url); if (is_null($data)){ $data = parseurl_getsiteinfo($url, true); - Cache::set("parse_url:".$url,serialize($data)); + Cache::set("parse_url:".$url,serialize($data), CACHE_DAY); } else $data = unserialize($data); @@ -1210,7 +1210,8 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa } $arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0); - $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string()); + $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network'])); + $arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']); $arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : ''); $arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : ''); $arr['author-link'] = ((x($arr,'author-link')) ? notags(trim($arr['author-link'])) : ''); @@ -1248,7 +1249,6 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa $arr['app'] = ((x($arr,'app')) ? notags(trim($arr['app'])) : ''); $arr['origin'] = ((x($arr,'origin')) ? intval($arr['origin']) : 0 ); $arr['network'] = ((x($arr,'network')) ? trim($arr['network']) : ''); - $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network'])); $arr['postopts'] = ((x($arr,'postopts')) ? trim($arr['postopts']) : ''); $arr['resource-id'] = ((x($arr,'resource-id')) ? trim($arr['resource-id']) : ''); $arr['event-id'] = ((x($arr,'event-id')) ? intval($arr['event-id']) : 0 ); @@ -1986,13 +1986,12 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { if($contact['duplex'] && $contact['issued-id']) $idtosend = '1:' . $orig_id; - + $rino = get_config('system','rino_encrypt'); $rino = intval($rino); - + logger("Local rino version: ". $rino, LOGGER_DEBUG); - $ssl_val = intval(get_config('system','ssl_policy')); $ssl_policy = ''; @@ -2043,6 +2042,8 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $rino_remote_version = intval($res->rino); $page = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0); + logger("Remote rino version: ".$rino_remote_version." for ".$contact["url"], LOGGER_DEBUG); + if($owner['page-flags'] == PAGE_PRVGROUP) $page = 2; @@ -2120,26 +2121,26 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { return -1; } catch (CannotPerformOperation $ex) { logger('Cannot safely create a key'); - return -1; + return -1; } try { $data = Crypto::encrypt($postvars['data'], $key); } catch (CryptoTestFailed $ex) { logger('Cannot safely perform encryption'); - return -1; + return -1; } catch (CannotPerformOperation $ex) { logger('Cannot safely perform encryption'); - return -1; + return -1; } break; default: logger("rino: invalid requested verision '$rino_remote_version'"); return -1; } - + $postvars['rino'] = $rino_remote_version; $postvars['data'] = bin2hex($data); - + #logger('rino: sent key = ' . $key, LOGGER_DEBUG); @@ -2167,7 +2168,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { $postvars['key'] = bin2hex($postvars['key']); } - + logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true), LOGGER_DATA); @@ -2968,7 +2969,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']); @@ -2977,9 +2978,6 @@ function item_is_remote_self($contact, &$datarray) { $datarray['private'] = 0; } - //if (!isset($datarray["app"]) OR ($datarray["app"] == "")) - // $datarray["app"] = network_to_name($contact['network']); - if ($contact['network'] != NETWORK_FEED) { // Store the original post $r = item_store($datarray2, false, false); @@ -4159,9 +4157,12 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) { $name = notags(trim($datarray['author-name'])); $photo = notags(trim($datarray['author-avatar'])); - $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); - if($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) - $nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']; + if (is_object($item)) { + $rawtag = $item->get_item_tags(NAMESPACE_ACTIVITY,'actor'); + if($rawtag && $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']) + $nick = $rawtag[0]['child'][NAMESPACE_POCO]['preferredUsername'][0]['data']; + } else + $nick = $item; if(is_array($contact)) { if(($contact['network'] == NETWORK_OSTATUS && $contact['rel'] == CONTACT_IS_SHARING)