New function for generating item URIs

This commit is contained in:
Michael 2018-06-16 06:46:25 +00:00
parent 49558d7d22
commit e1714de8ad
5 changed files with 7 additions and 5 deletions

View file

@ -16,6 +16,7 @@ use Friendica\Core\PConfig;
use Friendica\Object\Image; use Friendica\Object\Image;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Model\Item;
require_once 'mod/share.php'; require_once 'mod/share.php';
require_once 'mod/parse_url.php'; require_once 'mod/parse_url.php';
@ -176,7 +177,7 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
$_REQUEST['extid'] = NETWORK_GPLUS; $_REQUEST['extid'] = NETWORK_GPLUS;
if (isset($id)) { if (isset($id)) {
$_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_GPLUS.':'.$id); $_REQUEST['message_id'] = Item::newURI($uid, NETWORK_GPLUS.':'.$id);
} }
// $_REQUEST['verb'] // $_REQUEST['verb']

View file

@ -15,6 +15,7 @@ use Friendica\Core\Addon;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Item;
function ifttt_install() function ifttt_install()
{ {
@ -182,7 +183,7 @@ function ifttt_message($uid, $item)
if (strstr($item['url'], 'facebook.com')) { if (strstr($item['url'], 'facebook.com')) {
$hash = hash('ripemd128', item['url']); $hash = hash('ripemd128', item['url']);
$_REQUEST['extid'] = NETWORK_FACEBOOK; $_REQUEST['extid'] = NETWORK_FACEBOOK;
$_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_FACEBOOK . ':' . $hash); $_REQUEST['message_id'] = Item::newURI($uid, NETWORK_FACEBOOK . ':' . $hash);
} }
if ($item['type'] == 'link') { if ($item['type'] == 'link') {

View file

@ -945,7 +945,7 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
$likedata['gravity'] = 3; $likedata['gravity'] = 3;
$likedata['uid'] = $uid; $likedata['uid'] = $uid;
$likedata['wall'] = 0; $likedata['wall'] = 0;
$likedata['uri'] = item_new_uri($a->get_baseurl(), $uid); $likedata['uri'] = Item::newURI($uid);
$likedata['parent-uri'] = $orig_post["uri"]; $likedata['parent-uri'] = $orig_post["uri"];
$likedata['contact-id'] = $contactid; $likedata['contact-id'] = $contactid;
$likedata['app'] = $post->generator->displayName; $likedata['app'] = $post->generator->displayName;

View file

@ -853,7 +853,7 @@ function statusnet_fetchtimeline(App $a, $uid)
$_REQUEST["extid"] = NETWORK_STATUSNET; $_REQUEST["extid"] = NETWORK_STATUSNET;
if (isset($post->id)) { if (isset($post->id)) {
$_REQUEST['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_STATUSNET . ":" . $post->id); $_REQUEST['message_id'] = Item::newURI($uid, NETWORK_STATUSNET . ":" . $post->id);
} }
//$_REQUEST["date"] = $post->created_at; //$_REQUEST["date"] = $post->created_at;

View file

@ -807,7 +807,7 @@ function twitter_do_mirrorpost(App $a, $uid, $post)
$datarray["api_source"] = true; $datarray["api_source"] = true;
$datarray["profile_uid"] = $uid; $datarray["profile_uid"] = $uid;
$datarray["extid"] = NETWORK_TWITTER; $datarray["extid"] = NETWORK_TWITTER;
$datarray['message_id'] = item_new_uri($a->get_hostname(), $uid, NETWORK_TWITTER . ":" . $post->id); $datarray['message_id'] = Item::newURI($uid, NETWORK_TWITTER . ":" . $post->id);
$datarray['object'] = json_encode($post); $datarray['object'] = json_encode($post);
$datarray["title"] = ""; $datarray["title"] = "";